Moodle
  1. Moodle
  2. MDL-34233

SCORM Activities Not Restoring Correctly - data is reversed in backup

    Details

    • Testing Instructions:
      Hide

      Create a course with a SCORM package and back it up.
      Open the scorm.xml file in the backup and look at the order of the <scoes> items
      the ids listed should be in ascending order as stored in the db. eg 1, 2, 3, not in descending order (3, 2, 1)

      Restore that backed up course and check the order of the fields stored in the db for the scorm_scoes table is the same as the order in the original course. (ping me on jabber if you need more info)

      eg data from scorm_scoes looks like this:

      id scorm manifest
      3 24 name
      4 24 name
      5 24 name

      but when backed up it reverses the order of the records in the xml like this:
      5 24 name
      4 24 name
      3 24 name

      Show
      Create a course with a SCORM package and back it up. Open the scorm.xml file in the backup and look at the order of the <scoes> items the ids listed should be in ascending order as stored in the db. eg 1, 2, 3, not in descending order (3, 2, 1) Restore that backed up course and check the order of the fields stored in the db for the scorm_scoes table is the same as the order in the original course. (ping me on jabber if you need more info) eg data from scorm_scoes looks like this: id scorm manifest 3 24 name 4 24 name 5 24 name but when backed up it reverses the order of the records in the xml like this: 5 24 name 4 24 name 3 24 name
    • Affected Branches:
      MOODLE_23_STABLE
    • Fixed Branches:
      MOODLE_21_STABLE, MOODLE_22_STABLE, MOODLE_23_STABLE
    • Pull Master Branch:
      master_MDL-34233
    • Rank:
      42575

      Description

      When restoring a course backup, SCORM activities do not display content without opening up the settings for that activity and then clicking "Save and Display". Inspecting 'mdl_scorm_scoes' revealed that each of the newly created scoes have two records, one for the "_ORG" element (Articulate) and one for the "_SCO". When first restored, the "_SCO" record is always created first, with the "_ORG" record immediately following. Moodle doesn't seem to like that as it will not load the content without the "_ORG" record being first and "_SCO" second. Manually switching the ids of these two records in the DB for an affected SCO fixes the issue, as does opening up the SCO's settings page and then clicking "Save and Display".

        Issue Links

          Activity

          Hide
          Dan Marsden added a comment -

          looks like this is because the data is stored in reverse order when doing the backup.

          Show
          Dan Marsden added a comment - looks like this is because the data is stored in reverse order when doing the backup.
          Hide
          Dan Marsden added a comment -

          adding Eloy here - Eloy any idea why the backup uses the reverse order when storing the records?

          eg data from scorm_scoes looks like this:

          id scorm manifest
          3 24 name
          4 24 name
          5 24 name

          but when backed up it reverses the order of the records in the xml like this:
          5 24 name
          4 24 name
          3 24 name

          so when the restore runs it will restore id5 first when it should be restoring id3 first

          Show
          Dan Marsden added a comment - adding Eloy here - Eloy any idea why the backup uses the reverse order when storing the records? eg data from scorm_scoes looks like this: id scorm manifest 3 24 name 4 24 name 5 24 name but when backed up it reverses the order of the records in the xml like this: 5 24 name 4 24 name 3 24 name so when the restore runs it will restore id5 first when it should be restoring id3 first
          Hide
          Dan Marsden added a comment -

          attaching scorm.xml from a moodle backup (from master) - it shows sco id="1660" then sco id "1659" - why does it do this in reverse order?

          Show
          Dan Marsden added a comment - attaching scorm.xml from a moodle backup (from master) - it shows sco id="1660" then sco id "1659" - why does it do this in reverse order?
          Hide
          Dan Marsden added a comment -

          throwing this up for peer review - not sure if this should be fixed in core backup.

          I don't think we need to add any handlers to the restore process to fix badly ordered data - if experiencing the issue the teacher just needs to edit the SCORM and re-save in the restored course and the standard parse should fix it up.

          Show
          Dan Marsden added a comment - throwing this up for peer review - not sure if this should be fixed in core backup. I don't think we need to add any handlers to the restore process to fix badly ordered data - if experiencing the issue the teacher just needs to edit the SCORM and re-save in the restored course and the standard parse should fix it up.
          Hide
          Dan Marsden added a comment -

          linking related bug

          Show
          Dan Marsden added a comment - linking related bug
          Hide
          Ankit Agarwal added a comment -

          Hi Dan,
          Looks good to me,
          ORDER BY id is a bit redundant, but seems it is needed for more readability.

          +1 for integration.
          Thanks

          Show
          Ankit Agarwal added a comment - Hi Dan, Looks good to me, ORDER BY id is a bit redundant, but seems it is needed for more readability. +1 for integration. Thanks
          Hide
          Dan Marsden added a comment -

          thanks Ankit - yeah, it keeps it consistent with the other usages in core as well.

          Show
          Dan Marsden added a comment - thanks Ankit - yeah, it keeps it consistent with the other usages in core as well.
          Hide
          Sam Hemelryk added a comment -

          Thanks Dan this have been integrated now

          Show
          Sam Hemelryk added a comment - Thanks Dan this have been integrated now
          Hide
          Adrian Greeve added a comment -

          I couldn't replicate this issue in master. I ran through all of the branches and tested the patch anyway. It still works. No problems encountered during testing.
          Thanks.

          Show
          Adrian Greeve added a comment - I couldn't replicate this issue in master. I ran through all of the branches and tested the patch anyway. It still works. No problems encountered during testing. Thanks.
          Hide
          Aparup Banerjee added a comment -

          yay, it works!

          This issue has been put through rigorous processes and finally swam upstream along with some 65 others this week.

          Thank you all for taking the time to get us here.

          cheers!

          Show
          Aparup Banerjee added a comment - yay, it works! This issue has been put through rigorous processes and finally swam upstream along with some 65 others this week. Thank you all for taking the time to get us here. cheers!

            People

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

              Dates

              • Created:
                Updated:
                Resolved: