Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-53532

completion_criteria_course wrong timecompleted

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Do
    • Icon: Minor Minor
    • None
    • 3.0
    • Course completion
    • MOODLE_30_STABLE
    • Easy

      The criterion during review, does not take into account the completion time of course it is checking, instead it applies current time.
      Affected method:

       public function review($completion, $mark = true) {
              global $DB;
       
              $course = $DB->get_record('course', array('id' => $this->courseinstance));
              $info = new completion_info($course);
       
              // If the course is complete
              if ($info->is_course_complete($completion->userid)) {
       
                  if ($mark) {
                      $completion->mark_complete();
                  }
       
                  return true;
              }
       
              return false;
          }
      

      And a simple fix:

      public function review($completion, $mark = true) {
              global $DB;
       
              $course = $DB->get_record('course', array('id' => $this->courseinstance));
              $info = new completion_info($course);
       
              // If the course is complete
              if ($info->is_course_complete($completion->userid)) {
       
                  if ($mark) {
                      $cc = new completion_completion(['userid'=>$completion->userid,'course'=>$course->id]);
                      $completion->mark_complete($cc->timecompleted);
                  }
       
                  return true;
              }
       
              return false;
          }
      

            Unassigned Unassigned
            artur.poninski Artur Poniński
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.