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

Redundant/bugged code on aicc.js and scorm_12.js?

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.9.7
    • Fix Version/s: 1.9.10
    • Component/s: SCORM
    • Labels:
      None
    • Environment:
      LAMP, PHP 5.2.11
    • Database:
      MySQL
    • Difficulty:
      Easy
    • Affected Branches:
      MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_19_STABLE

      Description

      While attempting to analize MDL-21305 issue we've found issues in the way the code around Mastery Score management has been duplicated client side (see at the end of this description):
      1. [OK] credit is correclty involved in the conditional branching
      2. [OK] "not attempted" => "completed" only in SCORM 1.2: the SCORM specs clearly write about this behaviour. It would be advisable to do the same with AICC, since SCORM has been derived from AICC using both Data Model and API but AICC spec doesnt' mention anything about this extra behaviour
      3. [KO] scorm_12.js adds the extra/wrong conditional branch using the status value, with no check about the availability of score
      4. [KO] aicc.js.php always set the status to "completed", regardless the intial status

      Fix proposal:
      a. alignment of the code on both files (maybe also scorm_13.js.php);
      b. move the Mastery Score management server side where there is already a bugged code (MDL-21305), keeping here just the status management in case of asset (not attempted)
      c. remove everything and let the server side code do such things.

      mod/scorm/datamodel/aicc.js.php:
      ...
      function StoreData(data,storetotaltime) {
      if (storetotaltime) {
      if (cmi.core.lesson_mode == 'normal') {
      if (cmi.core.credit == 'credit') {
      cmi.core.lesson_status = 'completed';
      if (cmi.student_data.mastery_score != '') {
      if (cmi.core.score.raw >= cmi.student_data.mastery_score)

      { cmi.core.lesson_status = 'passed'; }

      else

      { cmi.core.lesson_status = 'failed'; }

      }
      }
      }
      ...

      mod/scorm/datamodels/scorm_12.js.php:
      ...
      function StoreData(data,storetotaltime) {
      if (storetotaltime) {
      if (cmi.core.lesson_status == 'not attempted')

      { cmi.core.lesson_status = 'completed'; }

      if (cmi.core.lesson_mode == 'normal') {
      if (cmi.core.credit == 'credit') {
      if (cmi.core.lesson_status == 'completed') {
      if (cmi.student_data.mastery_score != '' && cmi.core.score.raw != '') {
      if (parseFloat(cmi.core.score.raw) >= parseFloat(cmi.student_data.mastery_score))

      { cmi.core.lesson_status = 'passed'; }

      else

      { cmi.core.lesson_status = 'failed'; }

      }
      }
      }
      }
      ...

        Gliffy Diagrams

          Attachments

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  25/Oct/10