-
Bug
-
Resolution: Fixed
-
Minor
-
4.0
-
MOODLE_400_STABLE
-
MOODLE_400_STABLE
-
MDL-73613-master -
-
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:
- 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).
- 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).
- 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).
- 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.
- is blocked by
-
MDL-73068 Only display courses in the timeline block if they contain events
-
- Closed
-