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

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 2.3
    • Fix Version/s: STABLE backlog
    • Component/s: Gradebook
    • Labels:
    • Affected Branches:
      MOODLE_23_STABLE

      Description

      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?

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated: