Permalink
Browse files

MDL-27703 gradebook: altered an sql query in the user report. join wi…

…th no on clause causes an error in some DBs
  • Loading branch information...
andrew andrew
andrew authored and andrew committed Nov 10, 2011
1 parent 6be90ce commit d3e303470d3af739b935640d200f2b9383d7492b
Showing with 2 additions and 3 deletions.
  1. +2 −3 grade/report/user/lib.php
@@ -651,7 +651,7 @@ function calculate_averages() {
// Then left join with grade_grades and look for rows with null final grade (which includes grade items with no grade_grade)
$sql = "SELECT gi.id, COUNT(u.id) AS count
FROM {grade_items} gi
- JOIN {user} u
+ JOIN {user} u ON u.deleted = 0
JOIN ($enrolledsql) je ON je.id = u.id
JOIN (
SELECT DISTINCT ra.userid
@@ -660,10 +660,9 @@ function calculate_averages() {
AND ra.contextid " . get_related_contexts_string($this->context) . "
) rainner ON rainner.userid = u.id
LEFT JOIN {grade_grades} gg
- ON (gg.itemid = gi.id AND gg.userid = u.id AND gg.finalgrade IS NOT NULL AND gg.hidden = 0)
+ ON (gg.itemid = gi.id AND gg.userid = u.id AND gg.finalgrade IS NOT NULL AND gg.hidden = 0)
$groupsql
WHERE gi.courseid = :courseid
- AND u.deleted = 0
AND gg.finalgrade IS NULL
$groupwheresql
GROUP BY gi.id";

0 comments on commit d3e3034

Please sign in to comment.