Details
Description
With Attempts grading set to Last Attempt, if a user has an incomplete exam, the assessments report page shows that user as having a grade of '0'.
It's questionable if this is really a "bug", but it was not what our users expected or wanted.
The fix was to add a function "scorm_get_last_completed_attempt" to mod/scorm/locallib.php, nearly identical to "scorm_get_last_attempt":
function scorm_get_last_completed_attempt($scormid, $userid) {
/// Find the last completed 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))
else
{ return $lastattempt->a; } }
}
and to change the call to "scorm_get_last_attempt" in the LASTATTEMPT block in the switch statement in scorm_grade_user, to "scorm_get_last_completed_attempt".