diff --git a/mod/scorm/lib.php b/mod/scorm/lib.php index 517812fca22..dfc90c19d35 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 95c29fa158f..4f05f72db1c 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; }