MDL-21096 - fixed inconsistency in mod/scorm attempts counting. Also added in except...
authorPiers Harding <piers@ompka.net>
Wed, 13 Jan 2010 20:47:12 +0000 (20:47 +0000)
committerPiers Harding <piers@ompka.net>
Wed, 13 Jan 2010 20:47:12 +0000 (20:47 +0000)
mod/scorm/datamodels/scorm_12lib.php

index aa909e7b8cafd56927f9dd92dce298843ae3e8e6..709bec570fddfbaebec481695cef4092b69cf939 100644 (file)
@@ -134,9 +134,9 @@ function scorm_get_toc($user,$scorm,$liststyle,$currentorg='',$scoid='',$mode='n
     // If not specified retrieve the last attempt number
     //
     if (empty($attempt)) {
-        $attempt = scorm_get_last_attempt($scorm->id, $user->id);
+        $attempt = scorm_get_attempt_count($user, $scorm);
     }
-    $result->attemptleft = $scorm->maxattempt - $attempt;
+    $result->attemptleft = $scorm->maxattempt == 0 ? 1 : $scorm->maxattempt - $attempt;
     $conditions['scorm'] = $scorm->id;
     if ($scoes = scorm_get_scoes($scorm->id, $currentorg)){
         //