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

timeenrolled not always set correctly

    Details

    • Testing Instructions:
      Hide

      Test 1

      1. Run phpunit and make sure completion test pass

      Test 2

      1. Create a course and enable "Completion tracking"
      2. Check "Completion tracking begins on enrolment"
      3. Enrol users and run cron
      4. Check timeenrolled field in course_completions table and user_enrolments table have same value in timeenrolled and timecreated.
      Show
      Test 1 Run phpunit and make sure completion test pass Test 2 Create a course and enable "Completion tracking" Check "Completion tracking begins on enrolment" Enrol users and run cron Check timeenrolled field in course_completions table and user_enrolments table have same value in timeenrolled and timecreated.
    • Affected Branches:
      MOODLE_22_STABLE, MOODLE_23_STABLE
    • Pull Master Branch:

      Description

      The logic around setting timeenrolled in course completion has a couple of issues.

      First, the cron uses the enrolments timecreated if it's higher than timeenrolled - this was to try work around the fact enrolment plugins might have a timeenrolled value of 0. Unfortunately this means that if an enrolment is created for the past the timecreated value will be higher and therefore completion will pick up the wrong date.

      Secondly, if the course_completions record is created between the user enrolling in the course and the first cron run, completion_completion::mark_inprogress() does not set the timeenrolled value and will be set at 0.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Votes:
                  1 Vote for this issue
                  Watchers:
                  3 Start watching this issue

                  Dates

                  • Created:
                    Updated: