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

Conditional section availability - incorrect restore handling on partial restores

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.3
    • Fix Version/s: 2.3
    • Component/s: Conditional activities
    • Labels:
      None
    • Testing Instructions:
      Hide

      0. Server must have completion and conditions enabled.
      1. Create a new course A set to topics mode with 2 sections and with completion enabled.
      2. In section 0, add a label text 'Course A label', set so students can manually mark complete.
      3. Edit settings for section 1 and set it to only be available if the label is marked complete.

      • Note that the availability restriction is now displayed when editing.

      4. Create a new course B with the same settings.
      5. Set up course B the same, except call the label 'Course B label', and edit settings for section 2 (not 1) to make it only available if the label is marked complete.
      6. Additionally, add a new label 'Section 2 label' into section 2. (Not sure this is actually needed...)
      7. Back up course B using default settings.
      8. Restore the backup. On screen 2, choose 'Restore into an existing course' and select course A from this test. (Other options default.)

      • The restored course now has two sections.
      • The first section should still indicate that it's not available until you complete the 'Course A label'. The added second section should indicate that it's not available until you complete the 'Course B label'.

      9. Turn editing off and turn on/off the two tickboxes.

      • The two tickboxes on this course should make the 'Not available until...' messages on each section appear/disappear, indicating that they are indeed connected to the right sections.

      Before fixing this bug, this test failed at point 8. Section 1 says 'Not available unless you have a grade in !missing'.

      Show
      0. Server must have completion and conditions enabled. 1. Create a new course A set to topics mode with 2 sections and with completion enabled. 2. In section 0, add a label text 'Course A label', set so students can manually mark complete. 3. Edit settings for section 1 and set it to only be available if the label is marked complete. Note that the availability restriction is now displayed when editing. 4. Create a new course B with the same settings. 5. Set up course B the same, except call the label 'Course B label', and edit settings for section 2 (not 1) to make it only available if the label is marked complete. 6. Additionally, add a new label 'Section 2 label' into section 2. (Not sure this is actually needed...) 7. Back up course B using default settings. 8. Restore the backup. On screen 2, choose 'Restore into an existing course' and select course A from this test. (Other options default.) The restored course now has two sections. The first section should still indicate that it's not available until you complete the 'Course A label'. The added second section should indicate that it's not available until you complete the 'Course B label'. 9. Turn editing off and turn on/off the two tickboxes. The two tickboxes on this course should make the 'Not available until...' messages on each section appear/disappear, indicating that they are indeed connected to the right sections. Before fixing this bug, this test failed at point 8. Section 1 says 'Not available unless you have a grade in !missing'.
    • Affected Branches:
      MOODLE_23_STABLE
    • Fixed Branches:
      MOODLE_23_STABLE
    • Pull Master Branch:
      MDL-33133-master

      Description

      Eloy pointed out problems with the restore of this new feature:

      We need to know which records are existing ones and which have been introduced by the restore. And also we need to detect invalid duplicates.

      All that makes me thing if really the introduction of the after_restore() in steps is a good idea. They are only available at task level because only modules not being auto-contained should use them (bad citizens). And also, they are supported by restore_plugins, because some of them require access to the whole thing (plagiarism...). But bringing support to steps... could lead to abuse, so my proposal would be about to:

      1) drop support for restore_steps->after_restore()
      2) implement the section_availability restore as a new step, much like modules availability is handled, in 2 steps:

      a) reading section_availability information simply store it in backupids table
      b) later one new step "restore_process_course_sections_availability" executed by the restore_final_task.

        Gliffy Diagrams

          Attachments

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  25/Jun/12