-
Bug
-
Resolution: Fixed
-
Blocker
-
3.3.2, 3.4
-
MOODLE_33_STABLE, MOODLE_34_STABLE
-
MOODLE_33_STABLE
-
MDL-60352-master -
- Run unit tests
So this has just arrived due to a change in the existing indexes I suspect.
The repeat_event_collection does not consider the original event to be part of the collection.
Additionally, when fetching the events, it skips the first event, and does not sort them.
Considering the following situation:
Original: id 13, repeatid 13
|
Repeat 1: id 8, repeatid 13
|
Repeat 2: id 10, repeatid 13
|
Repeat 3: id 12, repeatid 13
|
If sorted as above, then the current query:
SELECT * FROM event WHERE repeatid = 13 LIMIT 100 START 1
|
Will return:
- Repeat 1
- Repeat 2
- Repeat 3
We apply a default start value of 1, which removes the first record
Now assume that we sort by id, we'll instead get:
- Repeat 2
- Repeat 3
- Original
We could sort by timestort, but that's probably not ideal.
I think we have two options:
- actively exclude WHERE id = ? and sort by id ASC
- actively exclude WHERE id = ? and sort by COALESCE(timesort, timestart) ASC
Since the actual order does not matter, I vote we go for the cheapest order (id).
As a third consideration, we need to decide whether a repeat event collection should actually contain the original event too. I think we'll discuss that in a separate issue due to the change of behaviour.
This currently causes unit test failures on Oracle:
1) core_calendar_repeat_event_collection_testcase::test_values_collection
|
Undefined index: event name
|
|
/var/www/html/moodle/calendar/tests/repeat_event_collection_test.php:118
|
/var/www/html/moodle/lib/phpunit/classes/advanced_testcase.php:80
|
|