Skip to content

Commit

Permalink
rating MDL-24648 altered the query thats executed when something requ…
Browse files Browse the repository at this point in the history
…ests grades for all students. Now only returns a row for users that actually have a grade.
  • Loading branch information
Andrew Davis committed Oct 13, 2010
1 parent f574d37 commit 34ceda8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions rating/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -503,12 +503,14 @@ public function get_user_grades($options) {
$singleuserwhere = "AND i.{$itemtableusercolumn} = :userid1";
}

//note: r.contextid will be null for users who haven't been rated yet
//MDL-24648 The where line used to be "WHERE (r.contextid is null or r.contextid=:contextid)"
//r.contextid will be null for users who haven't been rated yet
//no longer including users who haven't been rated to reduce memory requirements
$sql = "SELECT u.id as id, u.id AS userid, $aggregationstring(r.rating) AS rawgrade
FROM {user} u
LEFT JOIN {{$itemtable}} i ON u.id=i.{$itemtableusercolumn}
LEFT JOIN {rating} r ON r.itemid=i.id
WHERE (r.contextid is null or r.contextid=:contextid)
WHERE r.contextid=:contextid
$singleuserwhere
GROUP BY u.id";

Expand Down

0 comments on commit 34ceda8

Please sign in to comment.