Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MDL-19442 - fix type cast of values for gradebook calculations

  • Loading branch information...
commit 35332cda8e97cd2ae3e36d5227756f176e0f135c 1 parent d29c037
@piersharding piersharding authored
Showing with 4 additions and 4 deletions.
  1. +4 −4 mod/scorm/locallib.php
View
8 mod/scorm/locallib.php
@@ -362,7 +362,7 @@ function scorm_get_tracks($scoid,$userid,$attempt='') {
break;
case 'cmi.core.score.raw':
case 'cmi.score.raw':
- $usertrack->score_raw = sprintf('%0d', $track->value);
+ $usertrack->score_raw = (float) sprintf('%2.2f', $track->value);
break;
case 'cmi.core.session_time':
case 'cmi.session_time':
@@ -405,7 +405,7 @@ function scorm_get_sco_runtime($scormid, $scoid, $userid, $attempt=1) {
$tracks = array_values($tracks);
}
- if ($tracks) {
+ if ($tracks) {
$timedata->start = $tracks[0]->timemodified;
}
else {
@@ -459,7 +459,7 @@ function scorm_grade_user_attempt($scorm, $userid, $attempt=1, $time=false) {
}
switch ($scorm->grademethod) {
case GRADEHIGHEST:
- $score = $attemptscore->max;
+ $score = (float) $attemptscore->max;
break;
case GRADEAVERAGE:
if ($attemptscore->values > 0) {
@@ -1350,4 +1350,4 @@ function scorm_format_date_time($datetime) {
return $result;
}
-?>
+?>
Please sign in to comment.
Something went wrong with that request. Please try again.