Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

SCORM MDL-22046 - show last completed attempt in gradebook - thanks t…

…o Bruce Cota for the report/fix merged from HEAD
  • Loading branch information...
commit 649e176ed669f95969ef560cb26fe77ba085833f 1 parent 74dd5c5
@danmarsden danmarsden authored
Showing with 12 additions and 1 deletion.
  1. +12 −1 mod/scorm/locallib.php
View
13 mod/scorm/locallib.php
@@ -510,7 +510,7 @@ function scorm_grade_user($scorm, $userid, $time=false) {
return scorm_grade_user_attempt($scorm, $userid, 1, $time);
break;
case LASTATTEMPT:
- return scorm_grade_user_attempt($scorm, $userid, scorm_get_last_attempt($scorm->id, $userid), $time);
+ return scorm_grade_user_attempt($scorm, $userid, scorm_get_last_completed_attempt($scorm->id, $userid), $time);
break;
case HIGHESTATTEMPT:
$maxscore = 0;
@@ -584,6 +584,17 @@ function scorm_get_last_attempt($scormid, $userid) {
}
}
+function scorm_get_last_completed_attempt($scormid, $userid) {
+/// Find the last attempt number for the given user id and scorm id
+ if ($lastattempt = get_record('scorm_scoes_track', 'userid', $userid, 'scormid', $scormid, 'value', 'completed', 'max(attempt) as a')) {
+ if (empty($lastattempt->a)) {
+ return '1';
+ } else {
+ return $lastattempt->a;
+ }
+ }
+}
+
function scorm_course_format_display($user,$course) {
global $CFG;
Please sign in to comment.
Something went wrong with that request. Please try again.