as part of the changes for
MDL-11501 the new function "scorm_get_attempt_status" was added, however it's calculation of grades/attempts isn't quite right -
$attempts = $DB->get_records_select('scorm_scoes_track',"element='cmi.core.score.raw' AND userid=? AND scormid=?", array($user->id, $scorm->id),'attempt','attempt AS attemptnumber, value AS grade');
gets this error:
Did you remember to make the first column something unique in your call to get_records? Duplicate value '1' found in column 'attemptnumber'.
because each SCO within a SCORM returns a value - this wouldn't be a problem if "grade" from the above sql wasn't used later in the function:
$result .= get_string('gradeforattempt', 'scorm').' ' . $attempt->attemptnumber . ': ' . $attempt->grade .'%<BR>';