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

Backup/restore of lesson activity doesn't correctly restore calendar events

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.3
    • Fix Version/s: 3.2.4, 3.3
    • Component/s: Lesson
    • Labels:
    • Testing Instructions:
      Hide

      Setup

      1. Create a course
      2. Enrol two users (s1, s2)
      3. Create two groups (g1, g2)
      4. Add user s2 to both groups (g1 and g2)
      5. Create an assignment activity (Test assign 1)
      6. Add a group override for g1 and extend the due date by 1 day
      7. Add a group override for g2 and extend the due date by 1 day (same as above)
      8. Move the override for g2 to the top of the list (making it a higher priority)
      9. Add a user override for s1 and extend the due date by 2 days
      10. Create a second assignment activity (Test assign 2)
      11. Repeat the same user and group override steps as for Test assign 1
      12. Create a lesson activity with a deadline set (under “availability”)
      13. Add a group override for g1 and extend the deadline by 1 day
      14. Add a user override for s1 and extend the deadline by 2 days
      15. Create a quiz activity with a close date set (under “timing” section)
      16. Add a group override for g2 and extend the close date by 1 day
      17. Add a user override for s2 and extend the close date by 2 days
      18. Backup the course
        1. In the “Schema settings” step make sure the user data is all checked
        2. In the “Confirmation and review” step change the “filename” to include “with-user-data”
      19. Backup the course again
        1. In the “Schema settings” step make sure the user data is not checked for the section with the activities you created above
        2. In the “Confirmation and review” step change the “filename” to include “without-user-data”

      Test 1 - Restore from backup with user data and include user data

      1. Restore the “with-user-data” backup
      2. Restore it as a new course in the “Destination” step
      3. In the “Schema” step rename the course to indicate it’s this test
      4. Make sure the “User data” is all ticked
      5. After the restore is completed confirm:
        1. The group overrides are restored for each of the activites, including the correct order for in the activities
        2. The user overrides are restored for each of the activities
        3. The calendar events are restored for each of the activities, including overrides. You can see them in the event table. There should be the same number of events as the original course.
        4. Master only - confirm the events have the same value in the type, timesort, and priority columns as the original course

      Test 2 - Restore from backup with user data but ignore user data

      1. Restore the “with-user-data” backup
      2. Restore it as a new course in the “Destination” step
      3. In the “Schema” step rename the course to indicate it’s this test
      4. Make sure the “User data” is not ticked for the activities
      5. After the restore is completed confirm:
        1. The group overrides are restored for each of the activites, including the correct order for in the activities
        2. The user overrides are not restored for each of the activities (because user data wasn’t included)
        3. The calendar events are restored for each of the activities, excluding user overrides. You can see them in the event table. There should be the same number of events as the original course minus the 4 user override events.
        4. Master only - confirm the events have the same value in the type, timesort, and priority columns as the original course

      Test 3 - Restore from backup without user data

      1. Restore the “without-user-data” backup
      2. Restore it as a new course in the “Destination” step
      3. In the “Schema” step rename the course to indicate it’s this test
      4. Make sure the “User data” is not ticked for the activities
      5. After the restore is completed confirm:
        1. The group overrides are restored for each of the activites, including the correct order for in the activities
        2. The user overrides are not restored for each of the activities (because user data wasn’t included)
        3. The calendar events are restored for each of the activities, excluding user overrides. You can see them in the event table. There should be the same number of events as the original course minus the 4 user override events.
        4. Master only - confirm the events have the same value in the type, timesort, and priority columns as the original course

      Test 4 - Restore into the same course

      1. View the original course
      2. Restore the "with-user-data" backup
      3. Restore it into this course in the "Destination step" and select "Merge the backup course into this course"
      4. Leave the rest of the values as they are and complete the restore
      5. View the course that you restored into and confirm that all of the activities were essentially duplicated (new instances with the same name etc)
      6. View the event table and confirm that all of the events for the original course's activities have been duplicated for the new activities. The values should all be the same except for the instance column which will be the id of the new duplicated activities.
      Show
      Setup Create a course Enrol two users (s1, s2) Create two groups (g1, g2) Add user s2 to both groups (g1 and g2) Create an assignment activity (Test assign 1) Add a group override for g1 and extend the due date by 1 day Add a group override for g2 and extend the due date by 1 day (same as above) Move the override for g2 to the top of the list (making it a higher priority) Add a user override for s1 and extend the due date by 2 days Create a second assignment activity (Test assign 2) Repeat the same user and group override steps as for Test assign 1 Create a lesson activity with a deadline set (under “availability”) Add a group override for g1 and extend the deadline by 1 day Add a user override for s1 and extend the deadline by 2 days Create a quiz activity with a close date set (under “timing” section) Add a group override for g2 and extend the close date by 1 day Add a user override for s2 and extend the close date by 2 days Backup the course In the “Schema settings” step make sure the user data is all checked In the “Confirmation and review” step change the “filename” to include “with-user-data” Backup the course again In the “Schema settings” step make sure the user data is not checked for the section with the activities you created above In the “Confirmation and review” step change the “filename” to include “without-user-data” Test 1 - Restore from backup with user data and include user data Restore the “with-user-data” backup Restore it as a new course in the “Destination” step In the “Schema” step rename the course to indicate it’s this test Make sure the “User data” is all ticked After the restore is completed confirm: The group overrides are restored for each of the activites, including the correct order for in the activities The user overrides are restored for each of the activities The calendar events are restored for each of the activities, including overrides. You can see them in the event table. There should be the same number of events as the original course. Master only - confirm the events have the same value in the type , timesort , and priority columns as the original course Test 2 - Restore from backup with user data but ignore user data Restore the “with-user-data” backup Restore it as a new course in the “Destination” step In the “Schema” step rename the course to indicate it’s this test Make sure the “User data” is not ticked for the activities After the restore is completed confirm: The group overrides are restored for each of the activites, including the correct order for in the activities The user overrides are not restored for each of the activities (because user data wasn’t included) The calendar events are restored for each of the activities, excluding user overrides. You can see them in the event table. There should be the same number of events as the original course minus the 4 user override events. Master only - confirm the events have the same value in the type , timesort , and priority columns as the original course Test 3 - Restore from backup without user data Restore the “without-user-data” backup Restore it as a new course in the “Destination” step In the “Schema” step rename the course to indicate it’s this test Make sure the “User data” is not ticked for the activities After the restore is completed confirm: The group overrides are restored for each of the activites, including the correct order for in the activities The user overrides are not restored for each of the activities (because user data wasn’t included) The calendar events are restored for each of the activities, excluding user overrides. You can see them in the event table. There should be the same number of events as the original course minus the 4 user override events. Master only - confirm the events have the same value in the type , timesort , and priority columns as the original course Test 4 - Restore into the same course View the original course Restore the "with-user-data" backup Restore it into this course in the "Destination step" and select "Merge the backup course into this course" Leave the rest of the values as they are and complete the restore View the course that you restored into and confirm that all of the activities were essentially duplicated (new instances with the same name etc) View the event table and confirm that all of the events for the original course's activities have been duplicated for the new activities. The values should all be the same except for the instance column which will be the id of the new duplicated activities.
    • Affected Branches:
      MOODLE_33_STABLE
    • Fixed Branches:
      MOODLE_32_STABLE, MOODLE_33_STABLE
    • Pull Master Branch:
      MDL-58822-master

      Description

      When backing up and restoring a course with a lesson activity the calendar events are not restored correctly.

      There are two problems:

      1. The type column doesn't appear to be getting preserved, so action events (type: 1) are being restored as regular events (type: 0)
      2. The calendar events for user overrides are not being restored (however the actual user overrides in lesson_overrides are being restored).

      To replicate:

      1. Create a course
      2. Enrol a user in that course
      3. Create a lesson activity with a due date
      4. Add a user override for the enrolled user and extend the due date
      5. Backup the course (including all of the user data)
      6. Restore the backup into a new course (include the user data)
      7. Log in as the user and view your dashboard and see that only the event for the original lesson is visible
      8. Log in as admin and go to the restored lesson and see that the user override has been restored
      9. View the database and see that in the event table the original lesson event has been duplicated for the restored activity however it's type column is set to 0 instead of 1
      10. Notice that there isn't a duplicated record for the user override (however the original one still exists)

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  15/May/17