From 8037f32b8a4c53a4059c31ae1c05ffbf037b2449 Mon Sep 17 00:00:00 2001 From: Davo Smith Date: Fri, 9 Feb 2018 11:53:41 +0000 Subject: [PATCH] MDL-61324 enrol_lti: fix detection of changed grades during sync --- enrol/lti/classes/task/sync_grades.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/enrol/lti/classes/task/sync_grades.php b/enrol/lti/classes/task/sync_grades.php index 944de3704ff..f20802eb622 100644 --- a/enrol/lti/classes/task/sync_grades.php +++ b/enrol/lti/classes/task/sync_grades.php @@ -154,8 +154,8 @@ class sync_grades extends \core\task\scheduled_task { continue; } - // This can happen if the sync process has an unexpected error. - if ($grade == $ltiuser->lastgrade) { + // Check to see if the grade has changed. + if (!grade_floats_different($grade, $ltiuser->lastgrade)) { mtrace("Not sent - The grade $mtracecontent was not sent as the grades are the same."); continue; } @@ -174,7 +174,7 @@ class sync_grades extends \core\task\scheduled_task { } if (strpos(strtolower($response), 'success') !== false) { - $DB->set_field('enrol_lti_users', 'lastgrade', intval($grade), array('id' => $ltiuser->id)); + $DB->set_field('enrol_lti_users', 'lastgrade', grade_floatval($grade), array('id' => $ltiuser->id)); mtrace("Success - The grade '$floatgrade' $mtracecontent was sent."); $sendcount = $sendcount + 1; } else {