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.
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.