diff --git a/mod/scorm/locallib.php b/mod/scorm/locallib.php index 56f3d3567a7..525c4ddfa84 100644 --- a/mod/scorm/locallib.php +++ b/mod/scorm/locallib.php @@ -1009,11 +1009,11 @@ function scorm_get_attempt_status($user, $scorm) { $result = '
'.get_string('noattemptsallowed', 'scorm').': ';
if ($scorm->maxattempt > 0) {
- $result .= $scorm->maxattempt . '
';
+ $result .= $scorm->maxattempt . '
';
} else {
- $result .= get_string('unlimited').'
';
+ $result .= get_string('unlimited').'
';
}
- $result .= get_string('noattemptsmade', 'scorm').': ' . $attemptcount . '
';
+ $result .= get_string('noattemptsmade', 'scorm').': ' . $attemptcount . '
';
if ($scorm->maxattempt == 1) {
switch ($scorm->grademethod) {
@@ -1051,16 +1051,24 @@ function scorm_get_attempt_status($user, $scorm) {
$i = 1;
foreach($attempts as $attempt) {
$gradereported = scorm_grade_user_attempt($scorm, $user->id, $attempt->attemptnumber);
- $result .= get_string('gradeforattempt', 'scorm').' ' . $i . ': ' . $gradereported .'%
';
+ if ($scorm->grademethod !== GRADESCOES && !empty($scorm->maxgrade)) {
+ $gradereported = $gradereported/$scorm->maxgrade;
+ $gradereported = number_format($gradereported*100, 0) .'%';
+ }
+ $result .= get_string('gradeforattempt', 'scorm').' ' . $i . ': ' . $gradereported .'
';
$i++;
}
}
$calculatedgrade = scorm_grade_user($scorm, $user->id);
+ if ($scorm->grademethod !== GRADESCOES && !empty($scorm->maxgrade)) {
+ $calculatedgrade = $calculatedgrade/$scorm->maxgrade;
+ $calculatedgrade = number_format($calculatedgrade*100, 0) .'%';
+ }
$result .= get_string('grademethod', 'scorm'). ': ' . $grademethod;
if(empty($attempts)) {
- $result .= '
' . get_string('gradereported','scorm') . ': ' . get_string('none') . '
';
+ $result .= '
' . get_string('gradereported','scorm') . ': ' . get_string('none') . '
';
} else {
- $result .= '
' . get_string('gradereported','scorm') . ': ' . $calculatedgrade . ($scorm->grademethod == GRADESCOES ? '' : '%') .'
';
+ $result .= '
' . get_string('gradereported','scorm') . ': ' . $calculatedgrade . '
';
}
$result .= '