Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge branch 'master_MDL-24734_gradefix' of git://github.com/danmarsd…

…en/moodle
  • Loading branch information...
commit 13516b7c1f620599e6a2a689642f66035f240ee7 2 parents 6b7fb33 + 4f4a8ac
Petr Skoda skodak authored

Showing 1 changed file with 14 additions and 6 deletions. Show diff stats Hide diff stats

  1. +14 6 mod/scorm/locallib.php
20 mod/scorm/locallib.php
@@ -1008,11 +1008,11 @@ function scorm_get_attempt_status($user, $scorm) {
1008 1008
1009 1009 $result = '<p>'.get_string('noattemptsallowed', 'scorm').': ';
1010 1010 if ($scorm->maxattempt > 0) {
1011   - $result .= $scorm->maxattempt . '<BR>';
  1011 + $result .= $scorm->maxattempt . '<br />';
1012 1012 } else {
1013   - $result .= get_string('unlimited').'<BR>';
  1013 + $result .= get_string('unlimited').'<br />';
1014 1014 }
1015   - $result .= get_string('noattemptsmade', 'scorm').': ' . $attemptcount . '<BR>';
  1015 + $result .= get_string('noattemptsmade', 'scorm').': ' . $attemptcount . '<br />';
1016 1016
1017 1017 if ($scorm->maxattempt == 1) {
1018 1018 switch ($scorm->grademethod) {
@@ -1050,16 +1050,24 @@ function scorm_get_attempt_status($user, $scorm) {
1050 1050 $i = 1;
1051 1051 foreach($attempts as $attempt) {
1052 1052 $gradereported = scorm_grade_user_attempt($scorm, $user->id, $attempt->attemptnumber);
1053   - $result .= get_string('gradeforattempt', 'scorm').' ' . $i . ': ' . $gradereported .'%<BR>';
  1053 + if ($scorm->grademethod !== GRADESCOES && !empty($scorm->maxgrade)) {
  1054 + $gradereported = $gradereported/$scorm->maxgrade;
  1055 + $gradereported = number_format($gradereported*100, 0) .'%';
  1056 + }
  1057 + $result .= get_string('gradeforattempt', 'scorm').' ' . $i . ': ' . $gradereported .'<br />';
1054 1058 $i++;
1055 1059 }
1056 1060 }
1057 1061 $calculatedgrade = scorm_grade_user($scorm, $user->id);
  1062 + if ($scorm->grademethod !== GRADESCOES && !empty($scorm->maxgrade)) {
  1063 + $calculatedgrade = $calculatedgrade/$scorm->maxgrade;
  1064 + $calculatedgrade = number_format($calculatedgrade*100, 0) .'%';
  1065 + }
1058 1066 $result .= get_string('grademethod', 'scorm'). ': ' . $grademethod;
1059 1067 if(empty($attempts)) {
1060   - $result .= '<BR>' . get_string('gradereported','scorm') . ': ' . get_string('none') . '<BR>';
  1068 + $result .= '<br />' . get_string('gradereported','scorm') . ': ' . get_string('none') . '<br />';
1061 1069 } else {
1062   - $result .= '<BR>' . get_string('gradereported','scorm') . ': ' . $calculatedgrade . ($scorm->grademethod == GRADESCOES ? '' : '%') .'<BR>';
  1070 + $result .= '<br />' . get_string('gradereported','scorm') . ': ' . $calculatedgrade . '<br />';
1063 1071 }
1064 1072 $result .= '</p>';
1065 1073 if ($attemptcount >= $scorm->maxattempt and $scorm->maxattempt > 0) {

0 comments on commit 13516b7

Please sign in to comment.
Something went wrong with that request. Please try again.