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

repeat_event_collection does not sort and skips first result



    • Type: Bug
    • Status: Closed
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 3.3.2, 3.4
    • Fix Version/s: 3.3.3
    • Component/s: Calendar
    • Labels:


      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:

      1. actively exclude WHERE id = ? and sort by id ASC
      2. 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


          Issue Links



              • Votes:
                0 Vote for this issue
                3 Start watching this issue


                • Created:
                  Fix Release Date: