-
Bug
-
Resolution: Unresolved
-
Major
-
2.2.4, 2.3.1, 3.1, 3.8.2, 3.9.2
-
MOODLE_22_STABLE, MOODLE_23_STABLE, MOODLE_31_STABLE, MOODLE_38_STABLE, MOODLE_39_STABLE
The course completion cron code sometimes has to run twice before students are marked as complete in a course.
I think this is because:
- as part of completion_cron_mark_started() and maybe completion_cron_criteria(), records get inserted into course_completions with a reaggregate value of time()
- in completion_cron_completions(), only course completions with a reaggregate less than the the value of time() are checked
For small sites its possible for records that should be processed in completion_cron_completion() to get missed.
The function completion_cron_completions should check for records that have a reaggregate value less than *or equal* to the current value of time().
Edited (2022): Side note, don't forget to look for "MDL-33320" in code when fixing this because there are a bunch of "hacks" related with PHPUnit mainly that may need to be removed too.