Affects Version/s: 1.9.5
Fix Version/s: 1.9.10
Environment:Linux Apache 2.2 / PHP 5.2.9 / Moodle 1.9.5
ToolBook SCORM_1.2 Activity reports correct "cmi.core.score.raw" value in Complete Report while Grader and Attempts Reports displays only
whole score with zero remainder: cmi.core.score.raw => 69.57 Moodle grade showing up = 69.00 in Grader and 69 in Attempts SCORM Report.
Report Decimal Point settings does not affect behavior. A teacher reported this and was using Highest Attempt ( Attempts Grading) with Highest Grade Grading Method. Issue shows up after first attempt with same behavior after multiple attempts.
When using ToolBook and other SCORM Authoring tools there is an issue with type conversion of the cmi.core.score.raw value as it is processed by Moodle. The main issue is within the mod/scorm/locallib.php function scorm_get_tracks where on line 365
$usertrack->score_raw = sprintf('%0d', $track->value)
attempts to format the usertrack->score_raw variable as integer while PHP returns string type via sprintf function.
The issue here is with the PHP Type conversion which when a decimal point is not carried over assumes the value to be an integer or in this case var_dump( $usertrack->score_raw ) reported data type as string rather than the appropriate floating point value passed by ToolBook.
Some stricter type checking here may be needed as $usertrack->score_raw = (float) sprintf('%2.2f', $track->value) affords the returned score by this function to be in correlation to the expected data type.
Also Line 473 does benefit from
$score = (float) $attemptscore->max;
Recently I have been seeing allot of these type of Issues with Moodle 1.9.4-1.9.5 and ToolBook SCO's. Currently if there is no 10ths of 1 or a fractional value the decimal will not be reflected in reports.