Moodle
  1. Moodle
  2. MDL-20122

SCORM: Restorelib.php diff with fix for restoring several scorm values properly instead of restoring with default values.

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 1.9.5
    • Fix Version/s: 1.9.8
    • Component/s: SCORM
    • Labels:
      None
    • Environment:
      MySql v.5.0.51a
    • Database:
      MySQL
    • Difficulty:
      Easy
    • Affected Branches:
      MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_19_STABLE
    • Rank:
      31366

      Description

      Restoring a Scorm activity does not retain the following Scorm db values:

      • maxgrade
      • updatefreq
      • maxattempt
      • grademethod

      Attached is a diff file that contains a small change to the /mod/scorm/restorelib.php which resolves this issue.

      Process to reproduce issue.

      1. Create a new SCORM within a valid course. Fill values as desired/required, making sure to change the fields below as follows:

      • Under 'Other Settings', Change 'Grading Method' to any non-default value (grademethod)
      • Under 'Other Settings', change 'Maximum Grade' to any value > 0 (maxgrade)
      • Under 'Other Settings', change 'Number of Attempts' to any value > 0 (maxattempt)
      • Under 'Other Settings', change 'Auto-update Frequency' to any non-default value (updatefreq)
        2. Create a backup of the course with all Scorm information/data.
        3. Restore the backup file to a new course.
        4. Check the Scorm values for the fields mentioned in step 1.

      Expected Results:
      Restored Scorm values for Grading Method, Maximum Grade, Number of Attempts, and Auto-update Frequency equal to original backed-up scorm values.

      Actual Results:
      Restored Scorm values for Grading Method, Maximum Grade, Number of Attempts, and Auto-update Frequency are reset to default values.

      1. restorelib.diff
        2 kB
        Michael Avelar
      2. restorelib2.diff
        0.4 kB
        Michael Avelar

        Activity

        Hide
        Dan Marsden added a comment -

        Hi Michael - thanks for the report and patch! - I'll look into it further this week!

        thanks,

        Dan

        Show
        Dan Marsden added a comment - Hi Michael - thanks for the report and patch! - I'll look into it further this week! thanks, Dan
        Hide
        Michael Avelar added a comment -

        Found an additional and hopefully final value not being restored by Scorm module:

        • options (popup window option checkboxes)

        See attached this diff file (restorelib2.php) which contains a small change to the /mod/scorm/restorelib.php.

        added line: 112
        $scorm->options = backup_todb($info['MOD']['#']['OPTIONS']['0']['#']);
        

        Process to reproduce issue.

        1. Create a new SCORM within a valid course. Fill values as desired/required, making sure to check at least one of the checkboxes located:

        • Under 'Other Settings', under the Options subtitle.
          2. Create a backup of the course with all Scorm information/data.
          3. Restore the backup file to a new course.
          4. Check the Scorm values for the fields mentioned in step 1.

        Expected Results:
        Restored Scorm with all checkbox values for popup form checked as before.

        Actual Results:
        Restored Scorm checkbox values all reset to default values (un-checked).

        Show
        Michael Avelar added a comment - Found an additional and hopefully final value not being restored by Scorm module: options (popup window option checkboxes) See attached this diff file (restorelib2.php) which contains a small change to the /mod/scorm/restorelib.php. added line: 112 $scorm->options = backup_todb($info['MOD']['#']['OPTIONS']['0']['#']); Process to reproduce issue. 1. Create a new SCORM within a valid course. Fill values as desired/required, making sure to check at least one of the checkboxes located: Under 'Other Settings', under the Options subtitle. 2. Create a backup of the course with all Scorm information/data. 3. Restore the backup file to a new course. 4. Check the Scorm values for the fields mentioned in step 1. Expected Results: Restored Scorm with all checkbox values for popup form checked as before. Actual Results: Restored Scorm checkbox values all reset to default values (un-checked).
        Hide
        Dan Marsden added a comment -

        finally got round to spending some time on this! - fix now in 1.9Stable and HEAD - thanks for the report and patch!

        Show
        Dan Marsden added a comment - finally got round to spending some time on this! - fix now in 1.9Stable and HEAD - thanks for the report and patch!

          People

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

            Dates

            • Created:
              Updated:
              Resolved: