Moodle
  1. Moodle
  2. MDL-19442

ToolBook SCORM (SCORM _1.2) Score Moodle truncates "cmi.core.score.raw" value (type conversion issue)

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.9.5
    • Fix Version/s: 1.9.10
    • Component/s: SCORM
    • Labels:
      None
    • Environment:
      Linux Apache 2.2 / PHP 5.2.9 / Moodle 1.9.5
    • Database:
      MySQL
    • Difficulty:
      Moderate
    • Affected Branches:
      MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_19_STABLE
    • Rank:
      31657

      Description

      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
      case GRADEHIGHEST:
      $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.

        Activity

        Hide
        Dan Marsden added a comment -

        Hi John, thanks for the good report!

        Piers - any chance you could have a look at this?

        the ADL spec does allow for a decimal cmi.core.score.raw, but unfortunately we'll need to re-run the 1.2 ADL tests after this change right?

        Show
        Dan Marsden added a comment - Hi John, thanks for the good report! Piers - any chance you could have a look at this? the ADL spec does allow for a decimal cmi.core.score.raw, but unfortunately we'll need to re-run the 1.2 ADL tests after this change right?
        Hide
        Dan Marsden added a comment -

        Piers has pushed a fix through to 1.9Stable and HEAD - John it would be great if you could test this and post back on the bug to let us know if it is resolved for you. - thanks!

        Show
        Dan Marsden added a comment - Piers has pushed a fix through to 1.9Stable and HEAD - John it would be great if you could test this and post back on the bug to let us know if it is resolved for you. - thanks!

          People

          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: