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

Unable to delete scorm activity from course

    Details

    • Testing Instructions:
      Hide

      */ Create a scorm activity
      */ To emulate a broken activity, delete the records in the mdl_scorm_scoes table related to the new activity.
      */ Attempt to delete the activity from the course

      Show
      */ Create a scorm activity */ To emulate a broken activity, delete the records in the mdl_scorm_scoes table related to the new activity. */ Attempt to delete the activity from the course
    • Affected Branches:
      MOODLE_23_STABLE
    • Fixed Branches:
      MOODLE_23_STABLE, MOODLE_24_STABLE
    • Pull from Repository:
    • Pull Master Branch:

      Description

      The root cause is likely related to scorm packages that aren't 100% compliant with the scorm definition, but it still causes an issue that needs fixing in moodle.

      So when a scorm activity is created, and for whatever reason, there are no 'elements' in it, causing the mdl_scorm_scoes table to not get any data in it, trying to then delete the course module (afterall, its buggy) results in moodle reporting that it was unable to delete the course module. The module is then stuck in the course and selecting it results in an error as it was able to delete some of the data before returning its error.

      In the scorm_delete_instance method, it returns false if any of the various delete_records calls fails. At one point it does a get_records_select on the scorm_scoes table in order to be able to delete all its child data, now if there are no scorm_scoes records in the first place, it reports that as a fault and returns false, causing the deletion process to not remove the course_module record.

      If there are no scorm_scoes records, then realistically, the data was removed, so the end result of the delete process is the same as a successful deletion.

      My fix prevents the function returning false if it didn't find any scorm_scoes records.

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            danmarsden Dan Marsden added a comment -

            makes sense - pushing up for integration - thanks.

            Show
            danmarsden Dan Marsden added a comment - makes sense - pushing up for integration - thanks.
            Hide
            poltawski Dan Poltawski added a comment -

            Thanks Dan/Adam, integrated to 23, 24 and master.

            Show
            poltawski Dan Poltawski added a comment - Thanks Dan/Adam, integrated to 23, 24 and master.
            Hide
            ankit_frenz Ankit Agarwal added a comment -

            works as described.
            passing.
            Thanks

            Show
            ankit_frenz Ankit Agarwal added a comment - works as described. passing. Thanks
            Hide
            stronk7 Eloy Lafuente (stronk7) added a comment -

            Many thanks for your effort, the whole Moodle Community will be enjoying your great solutions starting now!

            Closing, ciao

            Show
            stronk7 Eloy Lafuente (stronk7) added a comment - Many thanks for your effort, the whole Moodle Community will be enjoying your great solutions starting now! Closing, ciao

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  14/Jan/13