From 220e5b5216af646eab6affc104e5eb7066f1d3ed Mon Sep 17 00:00:00 2001 From: Dan Marsden Date: Thu, 31 Jan 2013 10:45:11 +1300 Subject: [PATCH] MDL-34231 SCORM: calculate correct number of attemptsleft when entering an attempt. --- mod/scorm/locallib.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mod/scorm/locallib.php b/mod/scorm/locallib.php index 648c62bfc45..2fb5dcd8804 100644 --- a/mod/scorm/locallib.php +++ b/mod/scorm/locallib.php @@ -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) {