Moodle
  1. Moodle
  2. MDL-12313

All 4 calls to calendar_sql_where() function are followed by identical code which should therefore be within the function

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Trivial Trivial
    • Resolution: Fixed
    • Affects Version/s: 2.0
    • Fix Version/s: 1.9, 2.0
    • Component/s: Calendar
    • Labels:
      None
    • Affected Branches:
      MOODLE_20_STABLE
    • Fixed Branches:
      MOODLE_19_STABLE, MOODLE_20_STABLE

      Description

      There are only 4 calls to the calendar_sql_where() function and each call is followed by identical code to select calendar events. This is not good practice and the accompanying patch embodies the calendar event selection within the renamed (calendar_get_events()) function, always returning an array (even if empty) of events.

      Furthermore, there are issues with regards to selecting calendar events on installations with large numbers of users, groups and/or courses which will require changes to the way events are selected anyway, so it makes sense for this code to just be in one place.

        Gliffy Diagrams

          Activity

          Hide
          Derek Woolhead added a comment -

          Patch attached to be reviewed by Sam Marshall

          Show
          Derek Woolhead added a comment - Patch attached to be reviewed by Sam Marshall
          Hide
          Sam Marshall added a comment -

          Looks good to me.

          Show
          Sam Marshall added a comment - Looks good to me.
          Hide
          Martin Dougiamas added a comment -

          Yep, great, thanks!

          Show
          Martin Dougiamas added a comment - Yep, great, thanks!
          Hide
          Derek Woolhead added a comment -

          Patch applied to both 1.9 and 2.0 as requested

          Show
          Derek Woolhead added a comment - Patch applied to both 1.9 and 2.0 as requested
          Hide
          Andrew Davis added a comment -

          nice work. closing.

          Show
          Andrew Davis added a comment - nice work. closing.

            People

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

              Dates

              • Created:
                Updated:
                Resolved: