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

get_my_courses does not properly obey the limit parameter

    Details

    • Affected Branches:
      MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_19_STABLE

      Description

      get_my_courses always returns 2 more courses than specified in $limit (if available).

      This is because of the way that it applied the limit.

      It does it using a counter as it steps through the courses. In this process, there are two off by one error.

      I have attached a diff that simplifies it somewhat (to read), and removes the two off by one errors.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

              Hide
              emerrill Eric Merrill added a comment -

              get_user_courses_bycap appears to suffer by the same off by 2 problem. Attaching patch for accesslib.

              Show
              emerrill Eric Merrill added a comment - get_user_courses_bycap appears to suffer by the same off by 2 problem. Attaching patch for accesslib.
              Hide
              dougiamas Martin Dougiamas added a comment -

              Good catch! +1 from me! Thanks!

              Show
              dougiamas Martin Dougiamas added a comment - Good catch! +1 from me! Thanks!
              Hide
              emerrill Eric Merrill added a comment -

              I have committed the changes to get_user_courses_bycap and get_my_courses to 19_STABLE and HEAD - Resolving ticket.

              Show
              emerrill Eric Merrill added a comment - I have committed the changes to get_user_courses_bycap and get_my_courses to 19_STABLE and HEAD - Resolving ticket.
              Hide
              andyjdavis Andrew Davis added a comment -

              Looks good. Closing.

              Show
              andyjdavis Andrew Davis added a comment - Looks good. Closing.

                People

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

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Fix Release Date:
                    21/Oct/09