Permalink
Browse files

MDL-18023 - add type check to check against default to avoid 0 error.…

… backport 1.8.
  • Loading branch information...
1 parent f75507d commit 40ab2ed04bc1e12c12d177e48c9e4e25a42e10e4 piers committed Feb 4, 2009
Showing with 3 additions and 3 deletions.
  1. +1 −1 mod/scorm/datamodels/scorm_12.js.php
  2. +1 −1 mod/scorm/datamodels/scorm_13.js.php
  3. +1 −1 mod/scorm/locallib.php
@@ -537,7 +537,7 @@ function CollectData(data,parent) {
if (eval('datamodel["'+elementmodel+'"].mod') != 'r') {
elementstring = '&'+underscore(element)+'='+encodeURIComponent(data[property]);
if ((typeof eval('datamodel["'+elementmodel+'"].defaultvalue')) != "undefined") {
- if (eval('datamodel["'+elementmodel+'"].defaultvalue') != data[property]) {
+ if (eval('datamodel["'+elementmodel+'"].defaultvalue') != data[property] || eval('typeof(datamodel["'+elementmodel+'"].defaultvalue)') != typeof(data[property])) {
datastring += elementstring;
}
} else {
@@ -1189,7 +1189,7 @@ function CollectData(data,parent) {
if (eval('datamodel["'+elementmodel+'"].mod') != 'r') {
var elementstring = '&'+underscore(element)+'='+encodeURIComponent(data[property]);
if ((typeof eval('datamodel["'+elementmodel+'"].defaultvalue')) != "undefined") {
- if (eval('datamodel["'+elementmodel+'"].defaultvalue') != data[property]) {
+ if (eval('datamodel["'+elementmodel+'"].defaultvalue') != data[property] || eval('typeof(datamodel["'+elementmodel+'"].defaultvalue)') != typeof(data[property])) {
datastring += elementstring;
}
} else {
View
@@ -307,7 +307,7 @@ function scorm_get_tracks($scoid,$userid,$attempt='') {
break;
case 'cmi.core.score.raw':
case 'cmi.score.raw':
- $usertrack->score_raw = $track->value;
+ $usertrack->score_raw = sprintf('%0d', $track->value);
break;
case 'cmi.core.session_time':
case 'cmi.session_time':

0 comments on commit 40ab2ed

Please sign in to comment.