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

Course restore excluding groups still restores quiz overrides resulting in extra calendar events

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide
      1. Create a course (let's call it "original").
      2. Create at least one group in the course (no need to add user)
      3. Create an empty quiz with time open and time close
      4. Create group override(s) for this quiz with a different time open or time close
      5. Create an empty lesson with time available and deadline
      6. Create group override(s) for this lesson with a different time available or deadline
      7. Back up the "original" course, make sure "not including group and grouping"
      8. Restore the course to  a new course. Expected Results:
        1. There is no lesson_overrides record with groupid = 0 and userid is null
          • SELECT * FROM mdl_lesson_overrides WHERE groupid = 0 AND userid IS NULL;
        2. There is no quiz_overrides record with groupid = 0 and userid is null
          • SELECT * FROM mdl_quiz_overrides WHERE groupid = 0 AND userid IS NULL;
      9. Back up the "original" course again, make sure it is "including group and grouping"
      10. Restore the course to  a new course without "including group and grouping".  Expected Result:
        1. There is no lesson_overrides record with groupid not null and userid is null
          • SELECT * FROM mdl_lesson_overrides WHERE groupid >= 0 AND userid IS NULL;
        2. There is no quiz_overrides record with groupid not null and userid is null
          • SELECT * FROM mdl_quiz_overrides WHERE groupid >= 0 AND userid IS NULL;
      Show
      Create a course (let's call it "original"). Create at least one group in the course (no need to add user) Create an empty quiz with time open and time close Create group override(s) for this quiz with a different time open or time close Create an empty lesson with time available and deadline Create group override(s) for this lesson with a different time available or deadline Back up the "original" course, make sure "not including group and grouping" Restore the course to  a new course. Expected Results: There is no lesson_overrides record with groupid = 0 and userid is null SELECT * FROM mdl_lesson_overrides WHERE groupid = 0 AND userid IS NULL; There is no quiz_overrides record with groupid = 0 and userid is null SELECT * FROM mdl_quiz_overrides WHERE groupid = 0 AND userid IS NULL; Back up the "original" course again, make sure it is "including group and grouping" Restore the course to  a new course without "including group and grouping".  Expected Result: There is no lesson_overrides record with groupid not null and userid is null SELECT * FROM mdl_lesson_overrides WHERE groupid >= 0 AND userid IS NULL; There is no quiz_overrides record with groupid not null and userid is null SELECT * FROM mdl_quiz_overrides WHERE groupid >= 0 AND userid IS NULL;
    • Affected Branches:
      MOODLE_36_STABLE, MOODLE_37_STABLE, MOODLE_38_STABLE
    • Fixed Branches:
      MOODLE_36_STABLE, MOODLE_37_STABLE
    • Pull 3.6 Branch:
      MDL-65555_MOODLE_36_STABLE
    • Pull 3.7 Branch:
      MDL-65555_MOODLE_37_STABLE
    • Pull Master Branch:
       MDL-65555-Master

      Description

      DESCRIPTION
      A group override is applied to a quiz overriding the default quiz open and close dates. The course is backed up without including groups and then restored into a new course. In the new course the quiz override is restored into the mdl_quiz_overrides table with a groupid of 0. This leads to the create of calendar events in the new course reflecting both the default open and close dates for the quiz but also the open and close dates from the quiz override. These calendar events are also set with groupid of 0 meaning all of these calendar events are visible to all students causing confusion as to the actual dates of availability for the quiz.

      STEPS TO REPLICATE
      1. Create a new course.
      2. Create a group in the course.
      3. Create a quiz in the course. Set and open and close date for the quiz.
      4. Add a group override to the quiz for the group created in step 2. Set the quiz open and close dates a week later than the quiz defaults.
      5. Add the calendar block to the course, if not already available. Observe that events for only the default quiz and open and close dates are display (so long as you are not a member of the group).
      6. Observe in the database that there are four calendar events, two for the quiz defaults and two for the group override.
      select id, from_unixtime(timestart) timestart, name, courseid, groupid, userid, modulename, instance from mdl_event
      where courseid = <enter courseid>
      order by instance, groupid, type;
      original_course_calendar_events.png
      7. Create a backup of the course. Do NOT select "Include groups and groupings" in the backup settings.
      8. Go to Site administration > Courses > Restore course. Restore the backup created above into a new course.
      9. Immediately after the restore the new course will contain only a single calendar event for the default quiz open time. There will be an instance of the adhoc task \core\task\refresh_mod_calendar_events_task created in mdl_task_adhoc set to run against the new course.
      10. Once the adhoc task has run (should run next time admin cron runs) run the query above entering the courseid of the new course. Observe that there are now two quiz open events with different dates both for groupid = 0 and two quiz close events with different dates both for groupid = 0. new_course_calendar_events.png
      11. The adhoc task probably not really at fault as this query shows that the restored quiz contains an override for groupid = 0.
      select q.name as quiz_name, qo.* from mdl_quiz_overrides qo
      inner join mdl_quiz q on q.id = qo.quiz
      where q.course = <enter courseid of new course>;
      new_course_quiz_overrides.png
      12. Navigate to the calendar block in the new course.

      OBSERVED BEHAVIOR:
      Four calendar events are displayed for the quiz. Two quiz opens events on different dates and two quiz closes events on different dates.

      EXPECTED BEHAVIOR:
      The calendar displays only two events which match the open and close dates observed in the quiz settings.

      REPLICATION LOCATIONS
      3.5.3 and 3.6.3

      ADDITIONAL INVESTIGATION NOTES
      If using the Snap theme which displays the quiz close date course page, the presence of the extra calendar events in the new course could results in the incorrect close date being displayed. The close date associated with the group override in the original course may display rather than the default quiz date.

      USER IMPACT
      Students are confused about actual dates of availability on quizzes. The extra calendar events cannot be deleted in the user interface.

        Attachments

        1. image-2019-07-17-10-41-45-995.png
          105 kB
          Janelle Barcega
        2. new_course_calendar_events.png
          9 kB
          Brian Winstead
        3. new_course_quiz_overrides.png
          4 kB
          Brian Winstead
        4. original_course_calendar_events.png
          9 kB
          Brian Winstead

          Issue Links

            Activity

              People

              • Votes:
                2 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  9/Sep/19

                  Time Tracking

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 1 hour, 45 minutes
                  1h 45m