]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-16111 - SCORM grade not updated in Grader Report. Include grading by learning...
authorpiers <piers>
Sun, 24 Aug 2008 21:10:09 +0000 (21:10 +0000)
committerpiers <piers>
Sun, 24 Aug 2008 21:10:09 +0000 (21:10 +0000)
mod/scorm/locallib.php

index a2b89bfd2a6ec3ef762c901dd72d508b86a4de69..38126ac614c0391594c4aa0a71746b9731b80f9d 100755 (executable)
@@ -249,10 +249,15 @@ function scorm_insert_track($userid,$scormid,$scoid,$attempt,$element,$value) {
     }
     
     // MDL-9552, update the gradebook everything raw score is sent
-    if (strstr($element, '.score.raw')) {
-        $scorm = $DB->get_record('scorm', array('id'=>$scormid));
-        include_once('lib.php');
-        scorm_update_grades($scorm, $userid);    
+    // Scoring by learning objects also needs to be included in the gradebook update
+    if (strstr($element, '.score.raw') || 
+        (($element == 'cmi.core.lesson_status' || $element == 'cmi.completion_status') && ($track->value == 'completed' || $track->value == 'passed'))) {
+        $scorm = $DB->get_record('scorm', array('id' => $scormid));
+        $grademethod = $scorm->grademethod % 10;
+        if (strstr($element, '.score.raw') || $grademethod == GRADESCOES) {
+            include_once('lib.php');
+            scorm_update_grades($scorm, $userid);
+        }
     }
     
     return $id;