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

Lazy load context in calendar_event

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.4
    • Fix Version/s: 3.5
    • Component/s: Calendar
    • Labels:
    • Testing Instructions:
      Hide

      Test

      1. Log in as admin
      2. Create a course
      3. Create a user (s1) and enrol them in the course
      4. View the course
      5. Click the “Calendar” link in the nav drawer (to view the course calendar)
      6. Create a new course event for that course
      7. CONFIRM that the event is created and shows up in the calendar
      8. Try editing it to add a description, deleting it, re-creating it
      9. CONFIRM that you are able to complete each action above
      10. Log in as s1
      11. View the calendar
      12. CONFIRM that you can see the course event
      13. Click on the event to bring up the event summary
      14. CONFIRM that you aren’t able to edit the event
      15. Close the modal and create a new user event
      16. CONFIRM that the event is created
      17. Try editing it to add a description, deleting it, re-creating it
      18. CONFIRM that you are able to complete each action above
      Show
      Test Log in as admin Create a course Create a user (s1) and enrol them in the course View the course Click the “Calendar” link in the nav drawer (to view the course calendar) Create a new course event for that course CONFIRM that the event is created and shows up in the calendar Try editing it to add a description, deleting it, re-creating it CONFIRM that you are able to complete each action above Log in as s1 View the calendar CONFIRM that you can see the course event Click on the event to bring up the event summary CONFIRM that you aren’t able to edit the event Close the modal and create a new user event CONFIRM that the event is created Try editing it to add a description, deleting it, re-creating it CONFIRM that you are able to complete each action above
    • Affected Branches:
      MOODLE_34_STABLE
    • Fixed Branches:
      MOODLE_35_STABLE
    • Pull Master Branch:
      MDL-60964-master

      Description

      The calendar_event class load the context in the constructor if one isn't provided in the constructor args. This is unnecessary and potentially causes a DB hit for no reason.

      Instead the class should just load the context when it's actually needed. It's fairly simple in this case because we've overridden the magic getter function.

        Attachments

          Activity

            People

            Assignee:
            ryanwyllie Ryan Wyllie
            Reporter:
            ryanwyllie Ryan Wyllie
            Peer reviewer:
            Mihail Geshoski
            Integrator:
            Damyon Wiese
            Tester:
            Damyon Wiese
            Participants:
            Component watchers:
            Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              17/May/18