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

Timeline courses view overdue filtering displaying courses that should be skipped

XMLWordPrintable

    • MOODLE_400_STABLE
    • MOODLE_400_STABLE
    • MDL-73613-master
    • Hide

      Should all be covered by behat, feel free to do some additional exploratory testing.

      I updated an existing test so it also covers switching to/from overdue filtering to make sure the change works when transitioning both ways.

      I also created a new file with some tests which ensure that with/without "show more courses" works as intended, and also testing that both switching to overdue and also loading the page fresh are covered (so some tests navigate to the filter, then refresh the page to ensure the same result is achieved in both instances, to make sure the template context is also working as expected).

      Show
      Should all be covered by behat, feel free to do some additional exploratory testing. I updated an existing test so it also covers switching to/from overdue filtering to make sure the change works when transitioning both ways. I also created a new file with some tests which ensure that with/without "show more courses" works as intended, and also testing that both switching to overdue and also loading the page fresh are covered (so some tests navigate to the filter, then refresh the page to ensure the same result is achieved in both instances, to make sure the template context is also working as expected).
    • 0
    • HQ Team International CIH2-216, HQ Team International CIH2-217, HQ Team International CIH2-218

      The bug

      Now the timeline block courses view only displays courses when they contain action events for the current filtering, there is one case which does not display as required: When filtering course view by overdue, specifically when a course only has one or more events due "later today".

      The way that overdue filtering works, is we fetch all events due on the current day, in case their due time has elapsed (eg something due at 9am and it is currently 12pm). In that example, since the event is past its due date/time, that course would be shown as expected, with the event that fell overdue earlier "today" being displayed under it. This is working as expected/intended.

      The bug is that in cases where the due time has not yet elapsed on an event due "today" (eg currently 12pm, event is due at 4pm), the event won't be displayed (as expected, the frontend hides it), but because the course has been fetched, even if there are no other events under that course, the course name will still be displayed.

      Another side effect of this is that the course fetched counts towards those fetched by the web service. For example if we intended to fetch 2 courses with action events that are overdue, a course with events due "later today" will still count towards the 2. This means we cannot simply hide the course from the frontend (like we do the events), because it results in fewer than expected courses being fetched.

      For example if we tried to simply hide the course after fetching it:

      1. If C1 has one overdue, C2 has one due later today, and C3 has one overdue, you would see C1 and then "show more courses" button. Clicking that would load C3. The expected result is that C1 and C3 are immediately loaded (and you see no "show more courses" button).
      2. If C1 and C2 each have one due later today and C3 has one overdue, you would see no courses and the "show more courses" button. The expected result is that C3 is immediately loaded (and you see no button).
      3. If C1 and C2 each have one overdue and C3 has one due later today, you will see C1 and C2 as expected, but will also see the "show more courses" button, which pressing will do nothing (it will attempt to load C3 which has nothing overdue yet to display).
      4. If C1 has one due later today and there are no other courses with events overdue or due later today, the block would load a single course and when it is hidden, the block would show no content (and also not show the "No activities require action" text). This one could theoretically be fixed in the frontend, but fixing this properly in the backend will remove the need.

      Reproducing those examples without any changes will also show the bug in its current state (various scenarios with empty course headings), for example below demonstrates case #2 above:

      Possible solution

      Ideally, when the backend (\core_course\external\get_enrolled_courses_with_action_events_by_timeline_classification) checks that courses have action events (to determine if they should be returned), if the overdue filter is set (which it may be possible to determine from the eventsfrom/eventsto params), we will also check that each course has at least one event whose due date/time have elapsed, otherwise that course should be treated the same as not containing any events.

      It is important to note that the frontend still needs to continue handling some checking of events overdue "today", because for example when the time filter is set to "All", it needs to know whether an event due today is overdue or not.

      Why this happens

      When the timeline block was updated/corrected so that overdue items from the current day were shown as overdue (instead of only items from previous dates), all courses were always displayed in the block. Now that courses are only shown when they contain action events for the current filtering, some of this logic is no longer valid.

            michaelh Michael Hawkins
            michaelh Michael Hawkins
            Simey Lameze Simey Lameze
            Jun Pataleta Jun Pataleta
            CiBoT CiBoT
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 3 days, 2 hours, 35 minutes
                3d 2h 35m

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