Skip to content
Browse files

Merge branch 'MDL-27703_user_report_sql_21' of git://github.com/andyj…

…davis/moodle into MOODLE_21_STABLE
  • Loading branch information...
2 parents 4236448 + 1542c91 commit da86b5661510817cee46531871e3d6aaa10709ff @nebgor nebgor committed Nov 22, 2011
Showing with 2 additions and 3 deletions.
  1. +2 −3 grade/report/user/lib.php
View
5 grade/report/user/lib.php
@@ -650,7 +650,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
@@ -659,10 +659,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 da86b56

Please sign in to comment.
Something went wrong with that request. Please try again.