Merge branch 'master_MDL-34231' of git://github.com/danmarsden/moodle
authorDan Poltawski <dan@moodle.com>
Thu, 31 Jan 2013 02:14:46 +0000 (10:14 +0800)
committerDan Poltawski <dan@moodle.com>
Thu, 31 Jan 2013 02:14:46 +0000 (10:14 +0800)
mod/scorm/locallib.php

index 648c62b..2fb5dcd 100644 (file)
@@ -1580,7 +1580,8 @@ function scorm_format_toc_for_treeview($user, $scorm, $scoes, $usertracks, $cmid
     $result->incomplete = true;
 
     if (!$children) {
-        $result->attemptleft = $scorm->maxattempt == 0 ? 1 : $scorm->maxattempt - $attempt;
+        $attemptsmade = scorm_get_attempt_count($user->id, $scorm);
+        $result->attemptleft = $scorm->maxattempt == 0 ? 1 : $scorm->maxattempt - $attemptsmade;
     }
 
     if (!$children) {