Skip to content

Commit

Permalink
Merge branch 'MDL-27703_user_report_sql' of git://github.com/andyjdav…
Browse files Browse the repository at this point in the history
…is/moodle
  • Loading branch information
Aparup Banerjee committed Nov 22, 2011
2 parents b28de4b + d3e3034 commit 6aabd59
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions grade/report/user/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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";
Expand Down

0 comments on commit 6aabd59

Please sign in to comment.