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

Calendar does not use courseid when retrieving course modules, significant performance decrease

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.3
    • Fix Version/s: 3.3
    • Component/s: Calendar, Performance
    • Labels:
    • Testing Instructions:
      Hide
      1. Create several modules visible in the calendar and on the dashboard. Example: assignment with due date, feedback with timeclose, etc
      2. Make one of the modules not available for student (restrict access)
      3. Login as student and view the "upcoming events" block, calendar, dashboard, make sure all events are displayed without errors, the events related to unavailable modules are not displayed
      4. Export calendar and make sure only visible events were exported
      5. Bonus: enable 'logall' (see also MDL-58689), view dashboard as a student and check the number of new queries from db table mdl_log_queries (there are several AJAX requests involved so you can't rely on the performance info in the bottom of the page)
      6. Revert the commit and do the same - the number of queries should be bigger
      Show
      Create several modules visible in the calendar and on the dashboard. Example: assignment with due date, feedback with timeclose, etc Make one of the modules not available for student (restrict access) Login as student and view the "upcoming events" block, calendar, dashboard, make sure all events are displayed without errors, the events related to unavailable modules are not displayed Export calendar and make sure only visible events were exported Bonus: enable 'logall' (see also MDL-58689 ), view dashboard as a student and check the number of new queries from db table mdl_log_queries (there are several AJAX requests involved so you can't rely on the performance info in the bottom of the page) Revert the commit and do the same - the number of queries should be bigger
    • Affected Branches:
      MOODLE_33_STABLE
    • Fixed Branches:
      MOODLE_33_STABLE
    • Pull Master Branch:
      wip-MDL-58688-master-c

      Description

      Calendar retrieves modules associated with calendar events using get_coursemodule_from_instance()

      This method always performs a DB query. Considering we have to retrieve course modinfo anyway to check the module availability, this DB query is completely unnecessary.

      We already know courseid (it is stored as part of the event) but we don't use it.

      I assume this was present before 3.3 as well but in 3.3 we added even more overhead

        Attachments

          Activity

            People

            • Assignee:
              marina Marina Glancy
              Reporter:
              marina Marina Glancy
              Peer reviewer:
              cameron1729
              Integrator:
              Dan Poltawski
              Tester:
              Adrian Greeve
              Participants:
              Component watchers:
              Andrew Nicols, Mathew May, Michael Hawkins, Shamim Rezaie, Simey Lameze, Matteo Scaramuccia, Jake Dallimore, Jun Pataleta, Ryan Wyllie
            • Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                15/May/17