Skip to content

Commit

Permalink
IOMAD: adding soem leeway on the final grade updates for IOMAD report…
Browse files Browse the repository at this point in the history
…ing tables in case of race conditions between that and course completion.
  • Loading branch information
turf212 committed Oct 17, 2023
1 parent b9aaf0b commit 8ca0eb9
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions local/iomad_track/classes/observer.php
Original file line number Diff line number Diff line change
Expand Up @@ -697,9 +697,15 @@ public static function user_graded($event) {
}

// Check if there is already an entry for this.
if ($entry = $DB->get_record('local_iomad_track', array('userid' => $userid,
'courseid' => $courseid,
'timecompleted' => null))) {
if ($entry = $DB->get_record_sql("SELECT * FROM {local_iomad_track}
WHERE userid = :userid
AND courseid = :courseid
AND
(timecompleted IS NULL OR
timecompleted + 5 > :eventtime)",
array('userid' => $userid,
'courseid' => $courseid,
'eventtime' => $event->timecreated))) {
// We already have an entry. Remove it.
// check for max grade = 0
$mygrade = 0;
Expand Down

0 comments on commit 8ca0eb9

Please sign in to comment.