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

mod assign's SQL in get_user_grades_for_gradebook() pulls too many users

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Won't Do
    • Icon: Minor Minor
    • None
    • 2.3
    • Gradebook
    • MOODLE_23_STABLE

      in mod/assign/locallib.php
      in the method get_user_grades_for_gradebook()
      the function can be fed a $userid of 0 for all users. This SQL will then select all users in the entire system instead of all users associated with just this course assignment.

       SELECT u.id as userid
      	, s.timemodified as datesubmitted
      	, g.grade as rawgrade
      	, g.timemodified as dategraded
      	, g.grader as usermodified
      FROM mdl_user u
      LEFT JOIN mdl_assign_submission s 
      	ON u.id = s.userid and s.assignment = :assignid
      LEFT JOIN mdl_assign_grades g 
      	ON u.id = g.userid and g.assignment = :assignid
      WHERE u.id != 0

      As an improvement I get a list of enrolled users in the course and append "AND u.id IN (#,#,#,#,etc...)" after "u.id != 0".

      However I think this could be pointless because of the fix from http://tracker.moodle.org/browse/MDL-36061. Once MDL-36061 is merged I don't see how someone could get to get_user_grades_for_gradebook() intentionally with a $userid=0. Which I think would make this an improvement for something that no longer happens.

      Any thoughts?

            Unassigned Unassigned
            swit Matthew G. Switlik
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.