rating MDL-24648 altered the query thats executed when something requests grades...
authorAndrew Davis <andrew@affinitysoftware.net>
Wed, 13 Oct 2010 09:05:54 +0000 (09:05 +0000)
committerAndrew Davis <andrew@affinitysoftware.net>
Wed, 13 Oct 2010 09:05:54 +0000 (09:05 +0000)
rating/lib.php

index 6c7acff..b53abf2 100644 (file)
@@ -503,12 +503,14 @@ class rating_manager {
             $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";