]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-9552, update the gradebook everytime score is sent
authortoyomoyo <toyomoyo>
Mon, 5 Nov 2007 07:31:35 +0000 (07:31 +0000)
committertoyomoyo <toyomoyo>
Mon, 5 Nov 2007 07:31:35 +0000 (07:31 +0000)
mod/scorm/lib.php
mod/scorm/locallib.php

index 517812fca22b89e536fa1247f65229b4e93c77e6..dfc90c19d35883ce6040fa83d148ab4a6f15dae1 100755 (executable)
@@ -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();
index 95c29fa158f049c2b6b68e8d02fa0fcfc837f261..4f05f72db1cd8cfb8b3a4546e3b3a26bc8c28cb1 100755 (executable)
@@ -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;
 }