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

Scorm in Moodle 2.4 cannot be reviewed

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Duplicate
    • Affects Version/s: 2.4, 2.4.1
    • Fix Version/s: None
    • Component/s: SCORM
    • Labels:
      None
    • Affected Branches:
      MOODLE_24_STABLE

      Description

      Scorm in Moodle 2.4 has an error when review a lesson.

      Reproduction steps:

      • Attempting a Scorm lesson the first time, everything goes well.
      • Enter that lesson again with Start new attempt checked => fine
        However, enter that lesson again with Start new attempt unchecked => error

      The problem is in the player.php file, scorm_get_toc is expected to always return a sco object:

      $result = scorm_get_toc($USER, $scorm, $cm->id, TOCJSLINK, $currentorg, $scoid, $mode, $attempt, true, true);
      $sco = $result->sco;
      ...
          if ($trackdata = scorm_get_tracks($sco->id, $USER->id, $attempt)) {
      
      

      However, the scorm_get_toc function return either a sco object or an array of sco objects:

          if (empty($scoid)) {
              $result->sco = $scoes['scoes'][0]->children;
          } else {
              $result->sco = scorm_get_sco($scoid);
          }
      

      Therefore, when reviewing, the array of scos is returned and it cannot select any sco to display. Placing an if like below seems to work but I'm not sure it works in every case, since I'm not familiar with the scorm specification.

      $result = scorm_get_toc($USER, $scorm, $cm->id, TOCJSLINK, $currentorg, $scoid, $mode, $attempt, true, true);
      if (is_array($result->sco)) {
          $sco = $result->sco[0];
      } else {
          $sco = $result->sco;
      }
      ...
          if ($trackdata = scorm_get_tracks($sco->id, $USER->id, $attempt)) {...
      
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              danmarsden Dan Marsden
              Reporter:
              lnthanhtri Tri Le
              Participants:
              Component watchers:
              Damyon Wiese, Dan Marsden, Matteo Scaramuccia, Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: