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

'get_course_students' in 'deprecatedlib.php' is not returning user correctly

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.9.3
    • Fix Version/s: 1.9.4
    • Component/s: Libraries
    • Labels:
      None
    • Affected Branches:
      MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_19_STABLE

      Description

      The 'get_course_students' function in 'deprecatedlib.php' is returning records by 'LEFT JOINING' the 'user_lastaccess' table on the 'userid' only. This has the effect of returning one record for each occurrence of a user in any course, and not just the one requested. The effect is not noticed except on paged output, because the records are indexed by the userid. On pages output however, the page counts are all off.

      The 'LEFT JOIN' needs to include the courseid as a condition. It needs to be part of the join in case there isn't a lastaccess record for a valid user.

        Gliffy Diagrams

          Activity

          Hide
          mchurch Mike Churchward added a comment -

          Added the 'courseid' as a condition to the 'LEFT OUTER JOIN'.

          Show
          mchurch Mike Churchward added a comment - Added the 'courseid' as a condition to the 'LEFT OUTER JOIN'.
          Hide
          timhunt Tim Hunt added a comment -

          Updating assignee, so it is clear that Mike fixed this.

          Also, the fix version must be 1.9.4, since 1.9.3 was released in the past, and will not include this fix.

          Show
          timhunt Tim Hunt added a comment - Updating assignee, so it is clear that Mike fixed this. Also, the fix version must be 1.9.4, since 1.9.3 was released in the past, and will not include this fix.
          Hide
          timhunt Tim Hunt added a comment -

          Fix looks good to me.

          Note it is correct that this was not merged to HEAD, because that function has been revmoved from Moodle 2.0. However, Mike, it would have been a good idea to add a note to that effect here.

          Also, you forgot to update the merged tag - I did that for you.

          Show
          timhunt Tim Hunt added a comment - Fix looks good to me. Note it is correct that this was not merged to HEAD, because that function has been revmoved from Moodle 2.0. However, Mike, it would have been a good idea to add a note to that effect here. Also, you forgot to update the merged tag - I did that for you.
          Hide
          mchurch Mike Churchward added a comment -

          Sorry about not mentioning that it didn't need to be in 2.0. How do I update the 'merged' tag?

          Show
          mchurch Mike Churchward added a comment - Sorry about not mentioning that it didn't need to be in 2.0. How do I update the 'merged' tag?
          Show
          timhunt Tim Hunt added a comment - I think it is in http://docs.moodle.org/en/CVS_for_Developers#Merging_fixes . See also http://docs.moodle.org/en/Development:Unmerged_files

            People

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

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                28/Jan/09