Skip to content

Commit

Permalink
avoid "duplicate value x found in column 'userid'" in recompletion task
Browse files Browse the repository at this point in the history
  • Loading branch information
usqfowlerj committed Feb 22, 2024
1 parent 5c2632e commit 1363bbf
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions classes/task/check_recompletion.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function get_user_courses_to_reset() {

$now = time();
// Period based recompletion users.
$sql = "SELECT cc.userid, cc.course, null as nextresettime
$sql = "SELECT cc.id, cc.userid, cc.course, null as nextresettime
FROM {course_completions} cc
JOIN {local_recompletion_config} r2 ON r2.course = cc.course AND r2.name = 'recompletionduration'
JOIN {local_recompletion_config} r3 ON r3.course = cc.course
Expand All @@ -62,7 +62,8 @@ public function get_user_courses_to_reset() {
$users = $DB->get_records_sql($sql, [$now]);

// Schedule based recompletion.
$sql = "SELECT cc.userid,
$sql = "SELECT cc.id,
cc.userid,
cc.course,
r4.value as schedule,
cc.timecompleted,
Expand Down

0 comments on commit 1363bbf

Please sign in to comment.