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

completion_criteria_completion->mark_complete() does not take a timestamp

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      As an admin, create completion criteria for a course.
      As a student, meet the completion criteria for the course.
      compare the database values for the records in the mdl_course_completion_crit_compl table with the respective timestamp in the mdl_course_modules_completion these most probably will not match, and they should.

      Show
      As an admin, create completion criteria for a course. As a student, meet the completion criteria for the course. compare the database values for the records in the mdl_course_completion_crit_compl table with the respective timestamp in the mdl_course_modules_completion these most probably will not match, and they should.
    • Affected Branches:
      MOODLE_28_STABLE
    • Sprint:
      Team B Sprint 1

      Description

      the completion criteria that are packaged with core iterate through their completion criteria, and when a record is identified, they mark the requirement as complete, and pass a timestamp to indicate when it was completed. This can be seen here:

      https://github.com/moodle/moodle/blob/master/completion/criteria/completion_criteria_course.php#L197

      https://github.com/moodle/moodle/blob/master/completion/criteria/completion_criteria_activity.php#L239

      https://github.com/moodle/moodle/blob/master/completion/criteria/completion_criteria_grade.php#L225

      Currently, the completion_criteria_completion::mark_complete() function does not take a timestamp value. see: https://github.com/moodle/moodle/blob/master/completion/completion_criteria_completion.php#L106

      Rather than remove the values being passed to mark_complete(), It should be that mark_complete can accept and use a timestamp. If this doesn't happen, the completion time is bound by the cron-run time rather than the actual time the action happened.

      The attached patch corrects mark_complete() to accept a timestamp, and use it if it's available. If not, the system time() is used as before.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                2 Vote for this issue
                Watchers:
                9 Start watching this issue

                Dates

                • Created:
                  Updated: