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

Timeline block "sort by courses" sometimes fetches incorrect or no results for time periods



    • 0
    • HQ Team International Sprint 7, HQ Team International Sprint 8, HQ Team International Sprint 9, HQ Team International Sprin 10


      There are two bugs related to fetching information into the timeline block:

      First bug - first loading block with "all" set

      When first switching to the "sort by courses" view of the timeline block when "All" time is selected (either manually switching the view, or at load time where the block remembers that is the last view),  the block shows no results, even if some actions are required.

      Switching the time period to something else (eg  7days), then back to "All" fixes the issue.

      This appears to be an issue with the time periods being sent to the core_calendar_get_action_events_by_timesort web service. In the buggy scenarios, the timesortfrom and timesortto params sent are the same timestamp, so the web service does not find anything within that zero second timeframe. Switching away and back to "All" gets around this, because it correctly omits the timesortto value.

      The solution here would be to either fix the buggy calls so they don't send a timesortto where relevant, and/or we should update the webservice so that if the timesortto and timesortfrom are equal, we ignore the "to" value.

      We should also create a behat test to confirm the fix is working.

      Second bug

      When switching the ordering (by date or by course), there is an unexpected behaviour where the results shown for each ordering "remember" that ordering's previous timeframe, and revert to it even when the time dropdown has been changed when in the other ordering. For example:

      1. Block loads ordered by date, with the "all" timeframe. All action events are several months in the future.
      2. Switch to order by course, set the timeframe to 7 days (which has no results).
      3. Switch back to order by date, set the timeframe to "6 months" (which has some results).
      4. Again switch to order by course. The timeframe dropdown will show "6 months", but no events are shown, as the data being fetched is for the "7 days" timeframe, not the expected "6 months timeframe.

      The expected behaviour would be that whatever is set in the dropdowns is what is fetched/displayed. The fix for this is to ensure that when switching the order option, the currently selected timeframe is adhered to.

      Bonus bug

      There is an addition in the mustache template which means that if the "6 months" timeframe is set when the block is first loaded (from the previous time it was opened), that value will be highlighted (in addition to the topmost value), which isn't the case for any other values. Although it seems to me like the "current" value should be the one highlighted and not the top one, there is an existing issue raised for that to be fixed across Moodle, so I will not include any other fix related to that in this issue, it can be looked into after the related issue has been resolved (in case it fixes is in this block also). There were also some difficulties with the order by dropdown breaking when I attempted to apply similar changes, so safest to get the other bug fixes landed and revisit this in more detail later.


        1. MDL-72275_master.png
          124 kB
        2. MDL-72275_v3.10.png
          126 kB
        3. MDL-72275_v3.11.png
          128 kB

        Issue Links



              michaelh Michael Hawkins
              michaelh Michael Hawkins
              Simey Lameze Simey Lameze
              Adrian Greeve Adrian Greeve
              Angelia Dela Cruz Angelia Dela Cruz
              Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Sujith Haridasan, Andrew Lyons, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze, Juan Leyva, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Sara Arjona (@sarjona)
              0 Vote for this issue
              5 Start watching this issue



                Time Tracking

                  Original Estimate - Not Specified
                  Not Specified
                  Remaining Estimate - 0 minutes
                  Time Spent - 3 days, 6 hours, 37 minutes
                  3d 6h 37m