From d23121ab31d8249113f531453e983b9c737bb809 Mon Sep 17 00:00:00 2001 From: toyomoyo Date: Mon, 5 Nov 2007 07:31:35 +0000 Subject: [PATCH] MDL-9552, update the gradebook everytime score is sent --- mod/scorm/lib.php | 2 +- mod/scorm/locallib.php | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/mod/scorm/lib.php b/mod/scorm/lib.php index 517812fca2..dfc90c19d3 100755 --- a/mod/scorm/lib.php +++ b/mod/scorm/lib.php @@ -461,7 +461,7 @@ function scorm_update_grades($scorm=null, $userid=0, $nullifnone=true) { if ($scorm != null) { if ($grades = scorm_get_user_grades($scorm, $userid)) { - grade_update('mod/scorm', $scorm->course, 'mod', 'scorm', $scorm->id, 0, $grades); + grade_update('mod/scorm', $scorm->course, 'mod', 'scorm', $scorm->id, 0, $grades[$userid]); } else if ($userid and $nullifnone) { $grade = new object(); diff --git a/mod/scorm/locallib.php b/mod/scorm/locallib.php index 95c29fa158..4f05f72db1 100755 --- a/mod/scorm/locallib.php +++ b/mod/scorm/locallib.php @@ -237,6 +237,14 @@ function scorm_insert_track($userid,$scormid,$scoid,$attempt,$element,$value) { $track->timemodified = time(); $id = insert_record('scorm_scoes_track',$track); } + + // MDL-9552, update the gradebook everything raw score is sent + if (strstr($element, '.score.raw')) { + $scorm = get_record('scorm', 'id', $scormid); + include_once('lib.php'); + scorm_update_grades($scorm, $userid); + } + return $id; } -- 2.39.5