SCORM MDL-22046 - show last completed attempt in gradebook - thanks to Bruce Cota for the report/fix merged from HEAD
This commit is contained in:
+12
-1
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user