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

Add refresh calendar events restore step for activities after course restore

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.3
    • Fix Version/s: 3.3.2
    • Component/s: Backup
    • Labels:
    • Testing Instructions:
      Hide

      Test 1

      1. Create a course
      2. Create a manual course event for the month of June
      3. Create an assign activity and set a "due date" for month of June
      4. Create multiple groups in the course (Say A and B)
      5. Set group override for a user for a group (say A) for July
      6. Enrol 2 users in each group A and B)(Students A1, A2 and B1, B2)
      7. For one of the student of group (A1) set user override for the month of Aug
      8. Verify you see the following events -
        1. As A1
          1. Manual event in June
          2. Assign event in Aug
        2. As A2
          1. Manual event in June
          2. Assign event in July
        3. As B1
          1. Manual event in June
          2. Assign event in June
      9. Enable completion in course
      10. Create a page activity and set "Expect to be completed on " to a date in November
      11. Back up the course.
      12. Download the backup file and rename it with tgz extension
      13. Open the archive and go to activities/assign/calendar.xml
      14. Make sure there are no events in the backup file.

      Test 2

      1. Restore this course.
      2. Make sure no assign events are created in the new course, check db to be sure.
      3. Check db table task_adhoc and make sure there is task \core\task\refresh_mod_calendar_events_task in the list
      4. Run cron
      5. You should see something similar (not exact) in your cron logs

        Refreshing events for assign
        Refreshing events for chat
        Refreshing events for choice
        Refreshing events for data
        Refreshing events for feedback
        Refreshing events for lesson
        Refreshing completion events for page for course 39
        Refreshing events for quiz
        Refreshing events for scorm
        Refreshing events for workshop
        

      6. Go to calendar db and make sure there assign events now
      7. Reverify point 8 above for this course. (There seems to be a bug that events from all course not just the current course are displayed, if you can reproduce it, please create a 3.3 regression blocker)
      8. Reverify the expected completion event was created again.

      Test 3

      1. Restore the attached course.
      2. Check db and make sure only one new event is created.

      Test 4

      1. Backup and restore a 3.2 backup with calendar events to a 3.3/3.4 site and make sure there are no notices during restore related to this patch.
      Show
      Test 1 Create a course Create a manual course event for the month of June Create an assign activity and set a "due date" for month of June Create multiple groups in the course (Say A and B) Set group override for a user for a group (say A) for July Enrol 2 users in each group A and B)(Students A1, A2 and B1, B2) For one of the student of group (A1) set user override for the month of Aug Verify you see the following events - As A1 Manual event in June Assign event in Aug As A2 Manual event in June Assign event in July As B1 Manual event in June Assign event in June Enable completion in course Create a page activity and set "Expect to be completed on " to a date in November Back up the course. Download the backup file and rename it with tgz extension Open the archive and go to activities/assign/calendar.xml Make sure there are no events in the backup file. Test 2 Restore this course. Make sure no assign events are created in the new course, check db to be sure. Check db table task_adhoc and make sure there is task \core\task\refresh_mod_calendar_events_task in the list Run cron You should see something similar (not exact) in your cron logs Refreshing events for assign Refreshing events for chat Refreshing events for choice Refreshing events for data Refreshing events for feedback Refreshing events for lesson Refreshing completion events for page for course 39 Refreshing events for quiz Refreshing events for scorm Refreshing events for workshop Go to calendar db and make sure there assign events now Reverify point 8 above for this course. (There seems to be a bug that events from all course not just the current course are displayed, if you can reproduce it, please create a 3.3 regression blocker) Reverify the expected completion event was created again. Test 3 Restore the attached course. Check db and make sure only one new event is created. Test 4 Backup and restore a 3.2 backup with calendar events to a 3.3/3.4 site and make sure there are no notices during restore related to this patch.
    • Affected Branches:
      MOODLE_33_STABLE
    • Fixed Branches:
      MOODLE_33_STABLE
    • Pull Master Branch:
      MDL-58906-master
    • Sprint:
      3.4 Sprint 1, 3.4 Sprint 2, 3.4 Sprint 3

      Description

      The current calendar event backup and restore code attempts to copy the actual records from the event table and insert them directly into the restored table however this is a very fragile process because the table schema can (and has) change.

      A better approach may be to ignore restoring activity module events in this step and instead create another restore step that simply calls the <plugin>_refresh_event for all of the modules which will allow them to create the appropriate events based on the activities and overrides.

      It also means that backups from older version of Moodle that are restored into 3.3 will receive correctly be flagged as action events to show in the dashboard.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  11/Sep/17