Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-19442

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

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.9.5
    • 1.9.10
    • SCORM
    • None
    • Linux Apache 2.2 / PHP 5.2.9 / Moodle 1.9.5
    • MySQL
    • MOODLE_19_STABLE
    • MOODLE_19_STABLE
    • Moderate

    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.

      Attachments

        Activity

          People

            piers Piers Harding
            viperf117a John T. Macklin
            Dan Marsden, Matteo Scaramuccia, Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Sujith Haridasan
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              25/Oct/10