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

User overrides and group overrides are duplicated with the default event

XMLWordPrintable

    • MOODLE_32_STABLE
    • MOODLE_33_STABLE
    • MDL-55956-master-5
    • Hide
      Part 1 - Before the patch
      Setup
      1. Create a course C1, enrol students s1, s2, s3, s4 and s5.
      2. Create 2 groups in the course g1 and g2 with the following members:
        Group Members
        g1 s1, s2, s3
        g2 s1, s4
      3. Login as a teacher enrolled in C1.
      4. Create an assignment with a due date.
      5. Create a quiz with open and close dates.
      6. Create a lesson with "Available from" and "Deadline" dates.
      7. Go to the calendar and create a site event that repeats weekly for at least 2 times in the same month as the above activities' dates.
      8. Still on the calendar, select "C1" under the "Detailed month view for:" select box.
      9. Click the "New event" button and create a course event. Name it as "Sample course event".
      10. After creating the course event, click again the "New event" button and create a group event for g1. Name it as "Sample group event for g1".
      11. Create another group event, but this time for g2. Name it as "Sample group event for g2".
      Part 2 - Setup activities with overrides without the patch
      Setup overrides - Assignment
      1. Go to the assignment. Open the settings menu and select "User overrides.
      2. Click "Add user override".
      3. Override the due date for s2 with a date 1 day later than the original.
      4. Click "Save"
      5. Go back to the assignment and open the settings menu again and select "Group overrides"
      6. Click "Group user override".
      7. Override the due date for g1 with a date 2 days later than the original.
      8. Click "Save and enter another overide"
      9. Override the due date for g2 with a date 3 days later than the original.
      10. Move down the override for g1 to give it a higher priority than the override for g2.
      Setup overrides - Quiz
      1. Go to the quiz. Open the settings menu and select "User overrides.
      2. Click "Add user override".
      3. Override the open and close dates for s2 with a date 1 day later than the original.
      4. Click "Save"
      5. Go back to the quiz and open the settings menu again and select "Group overrides"
      6. Click "Group user override".
      7. Override the open and close dates for g1 with a date 2 days later than the original.
      8. Click "Save and enter another overide"
      9. Override the open and close dates for g2 with a date 3 days later than the original.
      Setup overrides - Lesson
      1. Go to the lesson. Open the settings menu and select "User overrides.
      2. Click "Add user override".
      3. Override the "Available from" and "Deadline" dates for s2 with a date 1 day later than the original.
      4. Click "Save"
      5. Go back to the lesson and open the settings menu again and select "Group overrides"
      6. Click "Group user override".
      7. Override the "Available from" and "Deadline" dates for g1 with a date 2 days later than the original.
      8. Click "Save and enter another overide"
      9. Override the "Available from" and "Deadline" dates for g2 with a date 3 days later than the original.
      Part 3 - Upgrade your moodle site with the patch
      1. After upgrading, run the cron

        php admin/cli/cron.php
        

        • Confirm that cron works okay. (It might fail with the lesson module if MDL-58123 has not yet been integrated by the time this issue is tested.)
      Part 4 - Test
      Test: User belonging to two groups
      1. Login as s1 and open the Calendar.
        • Confirm that you see the repeating site events.
        • Confirm that you see the course event "Sample course event".
        • Confirm that you see the group events "Sample group event for g1" and "Sample group event for g2".
      2. Check the calendar events for the assignment.
        • Confirm that you only see a single due date for the assignment.
        • Confirm that this due date matches the due date for g1's group override.
      3. Check the calendar events for the quiz.
        • Confirm that you only see a single date for the quiz's open and close dates.
        • Confirm that the open date matches the open date for g1's group override.
        • Confirm that the close date matches the close date for g2's group override.
      4. Check the calendar events for the lesson.
        • Confirm that you only see a single date for the lesson's "Lesson opens" and "Lesson closes" dates.
        • Confirm that the "Lesson opens" date matches the "Available from" date for g1's group override.
        • Confirm that the "Lesson closes" date matches the "Deadline" date for g2's group override.
      5. On the "Events key" block, click "Hide global events".
        • Confirm that you don't see the repeating site events.
      6. Click "Hide course events".
        • Confirm that you don't see the course event "Sample course event".
      7. Click "Hide group events".
        • Confirm that you don't see the group events "Sample group event for g1" and "Sample group event for g2".
        • Confirm that you don't see the dates for the assignment, lesson and quiz activities.
      Test: User given a user override
      1. Login as s2 and open the Calendar.
        • Confirm that you see the repeating site events.
        • Confirm that you see the course event "Sample course event".
        • Confirm that you see the group event "Sample group event for g1", but not "Sample group event for g2".
      2. Check the calendar events for the assignment.
        • Confirm that you only see a single due date for the assignment.
        • Confirm that this due date matches the user override due date for s2.
      3. Check the calendar events for the quiz.
        • Confirm that you only see a single date for the quiz's open and close dates.
        • Confirm that the open date matches the user override open date for s2.
        • Confirm that the close date matches the user override close date for s2.
      4. Check the calendar events for the lesson.
        • Confirm that you only see a single date for the lesson's "Lesson opens" and "Lesson closes" dates.
        • Confirm that the "Lesson opens" date matches the user override "Available from" date for s2.
        • Confirm that the "Lesson closes" date matches the user override "Deadline" date for s2.
      5. On the "Events key" block, click "Hide global events".
        • Confirm that you don't see the repeating site events.
      6. Click "Hide course events".
        • Confirm that you don't see the course event "Sample course event".
      7. Click "Hide group events".
        • Confirm that the "Sample group event for g1" gets hidden.
      8. Click "Hide user events".
        • Confirm that you don't see the dates for the assignment, lesson and quiz activities.
      Test: User belonging to a single group (g1)
      1. Login as s3 and open the Calendar.
        • Confirm that you see the repeating site events.
        • Confirm that you see the course event "Sample course event".
        • Confirm that you see the group event "Sample group event for g1", but not "Sample group event for g2".
      2. Check the calendar events for the assignment.
        • Confirm that this due date matches the due date for g1's group override.
      3. Check the calendar events for the quiz.
        • Confirm that you only see a single date for the quiz's open and close dates.
        • Confirm that the open date matches the open date for g1's group override.
        • Confirm that the close date matches the close date for g1's group override.
      4. Check the calendar events for the lesson.
        • Confirm that you only see a single date for the lesson's "Lesson opens" and "Lesson closes" dates.
        • Confirm that the "Lesson opens" date matches the "Available from" date for g1's group override.
        • Confirm that the "Lesson closes" date matches the "Deadline" date for g1's group override.
      5. On the "Events key" block, click "Hide global events".
        • Confirm that you don't see the repeating site events.
      6. Click "Hide course events".
        • Confirm that you don't see the course event "Sample course event".
      7. Click "Hide group events".
        • Confirm that the "Sample group event for g1" gets hidden.
        • Confirm that you don't see the dates for the assignment, lesson and quiz activities.
      Test: User belonging to a single group (g2)
      1. Login as s4 and open the Calendar.
        • Confirm that you see the repeating site events.
        • Confirm that you see the course event "Sample course event".
        • Confirm that you see the group event "Sample group event for g2", but not "Sample group event for g1".
      2. Check the calendar events for the assignment.
        • Confirm that this due date matches the due date for g2's group override.
      3. Check the calendar events for the quiz.
        • Confirm that you only see a single date for the quiz's open and close dates.
        • Confirm that the open date matches the open date for g2's group override.
        • Confirm that the close date matches the close date for g2's group override.
      4. Check the calendar events for the lesson.
        • Confirm that you only see a single date for the lesson's "Lesson opens" and "Lesson closes" dates.
        • Confirm that the "Lesson opens" date matches the "Available from" date for g2's group override.
        • Confirm that the "Lesson closes" date matches the "Deadline" date for g2's group override.
      5. On the "Events key" block, click "Hide global events".
        • Confirm that you don't see the repeating site events.
      6. Click "Hide course events".
        • Confirm that you don't see the course event "Sample course event".
      7. Click "Hide group events".
        • Confirm that the "Sample group event for g2" gets hidden.
        • Confirm that you don't see the dates for the assignment, lesson and quiz activities.
      Test: User not belonging to any groups
      1. Login as s5 and open the Calendar.
        • Confirm that you see the repeating site events.
        • Confirm that you see the course event "Sample course event".
        • Confirm that you see neither the "Sample group event for g2" nor "Sample group event for g1" group events.
      2. Check the calendar events for the assignment.
        • Confirm that this due date matches the assignment's original due date.
      3. Check the calendar events for the quiz.
        • Confirm that you only see a single date for the quiz's open and close dates.
        • Confirm that the open date matches quiz's original open date.
        • Confirm that the close date matches quiz's original close date.
      4. Check the calendar events for the lesson.
        • Confirm that you only see a single date for the lesson's "Lesson opens" and "Lesson closes" dates.
        • Confirm that the "Lesson opens" date matches the lesson's original "Available from" date.
        • Confirm that the "Lesson closes" date matches the lesson's original "Deadline" date.
      5. On the "Events key" block, click "Hide global events".
        • Confirm that you don't see the repeating site events.
      6. Click "Hide course events".
        • Confirm that you don't see the course event "Sample course event".
        • Confirm that you don't see the dates for the assignment, lesson and quiz activities.
      Part 5 - New activities with overrides
      1. With the upgraded code, create new activities with overrides just like in Part 2, but this time, with the patch applied.
      2. Repeat the tests in Part 4 and confirm that everything works as expected.
      Automated tests
      1. Run PHPUnit tests ("vendor/bin/phpunit" or "mdk phpunit -r") and make sure there are no errors nor failures related to calendar events.
      Show
      Part 1 - Before the patch Setup Create a course C1, enrol students s1, s2, s3, s4 and s5. Create 2 groups in the course g1 and g2 with the following members: Group Members g1 s1, s2, s3 g2 s1, s4 Login as a teacher enrolled in C1. Create an assignment with a due date. Create a quiz with open and close dates. Create a lesson with " Available from " and " Deadline " dates. Go to the calendar and create a site event that repeats weekly for at least 2 times in the same month as the above activities' dates. Still on the calendar, select " C1 " under the " Detailed month view for: " select box. Click the " New event " button and create a course event. Name it as " Sample course event ". After creating the course event, click again the " New event " button and create a group event for g1. Name it as " Sample group event for g1 ". Create another group event, but this time for g2. Name it as " Sample group event for g2 ". Part 2 - Setup activities with overrides without the patch Setup overrides - Assignment Go to the assignment. Open the settings menu and select " User overrides . Click " Add user override ". Override the due date for s2 with a date 1 day later than the original. Click " Save " Go back to the assignment and open the settings menu again and select " Group overrides " Click " Group user override ". Override the due date for g1 with a date 2 days later than the original. Click " Save and enter another overide " Override the due date for g2 with a date 3 days later than the original. Move down the override for g1 to give it a higher priority than the override for g2. Setup overrides - Quiz Go to the quiz. Open the settings menu and select " User overrides . Click " Add user override ". Override the open and close dates for s2 with a date 1 day later than the original. Click " Save " Go back to the quiz and open the settings menu again and select " Group overrides " Click " Group user override ". Override the open and close dates for g1 with a date 2 days later than the original. Click " Save and enter another overide " Override the open and close dates for g2 with a date 3 days later than the original. Setup overrides - Lesson Go to the lesson. Open the settings menu and select " User overrides . Click " Add user override ". Override the " Available from " and " Deadline " dates for s2 with a date 1 day later than the original. Click " Save " Go back to the lesson and open the settings menu again and select " Group overrides " Click " Group user override ". Override the " Available from " and " Deadline " dates for g1 with a date 2 days later than the original. Click " Save and enter another overide " Override the " Available from " and " Deadline " dates for g2 with a date 3 days later than the original. Part 3 - Upgrade your moodle site with the patch After upgrading, run the cron php admin/cli/cron.php Confirm that cron works okay. (It might fail with the lesson module if MDL-58123 has not yet been integrated by the time this issue is tested.) Part 4 - Test Test: User belonging to two groups Login as s1 and open the Calendar. Confirm that you see the repeating site events. Confirm that you see the course event " Sample course event ". Confirm that you see the group events " Sample group event for g1 " and " Sample group event for g2 ". Check the calendar events for the assignment. Confirm that you only see a single due date for the assignment. Confirm that this due date matches the due date for g1's group override. Check the calendar events for the quiz. Confirm that you only see a single date for the quiz's open and close dates. Confirm that the open date matches the open date for g1's group override. Confirm that the close date matches the close date for g2's group override. Check the calendar events for the lesson. Confirm that you only see a single date for the lesson's " Lesson opens " and " Lesson closes " dates. Confirm that the " Lesson opens " date matches the " Available from " date for g1's group override. Confirm that the " Lesson closes " date matches the " Deadline " date for g2's group override. On the " Events key " block, click " Hide global events ". Confirm that you don't see the repeating site events. Click " Hide course events ". Confirm that you don't see the course event " Sample course event ". Click " Hide group events ". Confirm that you don't see the group events " Sample group event for g1 " and " Sample group event for g2 ". Confirm that you don't see the dates for the assignment, lesson and quiz activities. Test: User given a user override Login as s2 and open the Calendar. Confirm that you see the repeating site events. Confirm that you see the course event " Sample course event ". Confirm that you see the group event " Sample group event for g1 ", but not " Sample group event for g2 ". Check the calendar events for the assignment. Confirm that you only see a single due date for the assignment. Confirm that this due date matches the user override due date for s2. Check the calendar events for the quiz. Confirm that you only see a single date for the quiz's open and close dates. Confirm that the open date matches the user override open date for s2. Confirm that the close date matches the user override close date for s2. Check the calendar events for the lesson. Confirm that you only see a single date for the lesson's " Lesson opens " and " Lesson closes " dates. Confirm that the " Lesson opens " date matches the user override " Available from " date for s2. Confirm that the " Lesson closes " date matches the user override " Deadline " date for s2. On the " Events key " block, click " Hide global events ". Confirm that you don't see the repeating site events. Click " Hide course events ". Confirm that you don't see the course event " Sample course event ". Click " Hide group events ". Confirm that the " Sample group event for g1 " gets hidden. Click " Hide user events ". Confirm that you don't see the dates for the assignment, lesson and quiz activities. Test: User belonging to a single group (g1) Login as s3 and open the Calendar. Confirm that you see the repeating site events. Confirm that you see the course event " Sample course event ". Confirm that you see the group event " Sample group event for g1 ", but not " Sample group event for g2 ". Check the calendar events for the assignment. Confirm that this due date matches the due date for g1's group override. Check the calendar events for the quiz. Confirm that you only see a single date for the quiz's open and close dates. Confirm that the open date matches the open date for g1's group override. Confirm that the close date matches the close date for g1's group override. Check the calendar events for the lesson. Confirm that you only see a single date for the lesson's " Lesson opens " and " Lesson closes " dates. Confirm that the " Lesson opens " date matches the " Available from " date for g1's group override. Confirm that the " Lesson closes " date matches the " Deadline " date for g1's group override. On the " Events key " block, click " Hide global events ". Confirm that you don't see the repeating site events. Click " Hide course events ". Confirm that you don't see the course event " Sample course event ". Click " Hide group events ". Confirm that the " Sample group event for g1 " gets hidden. Confirm that you don't see the dates for the assignment, lesson and quiz activities. Test: User belonging to a single group (g2) Login as s4 and open the Calendar. Confirm that you see the repeating site events. Confirm that you see the course event " Sample course event ". Confirm that you see the group event " Sample group event for g2 ", but not " Sample group event for g1 ". Check the calendar events for the assignment. Confirm that this due date matches the due date for g2's group override. Check the calendar events for the quiz. Confirm that you only see a single date for the quiz's open and close dates. Confirm that the open date matches the open date for g2's group override. Confirm that the close date matches the close date for g2's group override. Check the calendar events for the lesson. Confirm that you only see a single date for the lesson's " Lesson opens " and " Lesson closes " dates. Confirm that the " Lesson opens " date matches the " Available from " date for g2's group override. Confirm that the " Lesson closes " date matches the " Deadline " date for g2's group override. On the " Events key " block, click " Hide global events ". Confirm that you don't see the repeating site events. Click " Hide course events ". Confirm that you don't see the course event " Sample course event ". Click " Hide group events ". Confirm that the " Sample group event for g2 " gets hidden. Confirm that you don't see the dates for the assignment, lesson and quiz activities. Test: User not belonging to any groups Login as s5 and open the Calendar. Confirm that you see the repeating site events. Confirm that you see the course event " Sample course event ". Confirm that you see neither the " Sample group event for g2 " nor " Sample group event for g1 " group events. Check the calendar events for the assignment. Confirm that this due date matches the assignment's original due date. Check the calendar events for the quiz. Confirm that you only see a single date for the quiz's open and close dates. Confirm that the open date matches quiz's original open date. Confirm that the close date matches quiz's original close date. Check the calendar events for the lesson. Confirm that you only see a single date for the lesson's " Lesson opens " and " Lesson closes " dates. Confirm that the " Lesson opens " date matches the lesson's original " Available from " date. Confirm that the " Lesson closes " date matches the lesson's original " Deadline " date. On the " Events key " block, click " Hide global events ". Confirm that you don't see the repeating site events. Click " Hide course events ". Confirm that you don't see the course event " Sample course event ". Confirm that you don't see the dates for the assignment, lesson and quiz activities. Part 5 - New activities with overrides With the upgraded code, create new activities with overrides just like in Part 2, but this time, with the patch applied. Repeat the tests in Part 4 and confirm that everything works as expected. Automated tests Run PHPUnit tests (" vendor/bin/phpunit " or " mdk phpunit -r ") and make sure there are no errors nor failures related to calendar events.
    • 3.3 Project Team Sprint 3

      If you have a module that creates calendar events, eg quiz lesson and soon to be assign, and you have multiple overrides for groups as well as user overrides, then the user see's all of these events when really they should only see just the ones that apply to them. This is related to but distinct from MDL-55955. I've logged this as a bug, but you could argue it's a feature.

      There are two ways this could be solved, one is a workaround in the various modules which support overrides, which is as soon as any overrides are added it deletes the module event and then creates individual events for every student personalized to them, which is horrible from a code point of view.

      The better approach is to add a 'priority' field to the calendar events, and if a bunch of events are loaded which all have identical modulename, instance, and eventtype, then only the event with the highest priority is shown. It is not enough for the calendar api to try and de-duplicate based on userid / groupid alone because a student can be in multiple groups, and the semantics of which override wins is up to the module. Currently the modules union all the dates together which is imho weird, a better solution is to give each override an explicit order and apply only one. This same order could then be given to the calendar api so it can de-duplicate the events.

      The calendar api would also need to do some extra logic so when searching for an event within a certain range, if it find an event it also needs to check for other events outside that range which have the same (modulename, instance, and eventtype) so it can confirm the first one it found really is the right one.

            jpataleta Jun Pataleta
            brendanheywood Brendan Heywood
            cameron1729 cameron1729
            Andrew Lyons Andrew Lyons
            Ryan Wyllie Ryan Wyllie
            Votes:
            0 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.