mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 06:18:28 +01:00
MDL-69190 grade: fix slow query.
This commit is contained in:
parent
1ab9522055
commit
b70d584b67
@ -1531,9 +1531,7 @@ class grade_report_grader extends grade_report {
|
|||||||
// This query returns a count of ungraded grades (NULL finalgrade OR no matching record in grade_grades table)
|
// This query returns a count of ungraded grades (NULL finalgrade OR no matching record in grade_grades table)
|
||||||
$sql = "SELECT gi.id, COUNT(DISTINCT u.id) AS count
|
$sql = "SELECT gi.id, COUNT(DISTINCT u.id) AS count
|
||||||
FROM {grade_items} gi
|
FROM {grade_items} gi
|
||||||
CROSS JOIN {user} u
|
CROSS JOIN ($enrolledsql) u
|
||||||
JOIN ($enrolledsql) je
|
|
||||||
ON je.id = u.id
|
|
||||||
JOIN {role_assignments} ra
|
JOIN {role_assignments} ra
|
||||||
ON ra.userid = u.id
|
ON ra.userid = u.id
|
||||||
LEFT OUTER JOIN {grade_grades} g
|
LEFT OUTER JOIN {grade_grades} g
|
||||||
@ -1542,7 +1540,6 @@ class grade_report_grader extends grade_report {
|
|||||||
WHERE gi.courseid = :courseid
|
WHERE gi.courseid = :courseid
|
||||||
AND ra.roleid $gradebookrolessql
|
AND ra.roleid $gradebookrolessql
|
||||||
AND ra.contextid $relatedctxsql
|
AND ra.contextid $relatedctxsql
|
||||||
AND u.deleted = 0
|
|
||||||
AND g.id IS NULL
|
AND g.id IS NULL
|
||||||
$groupwheresql
|
$groupwheresql
|
||||||
GROUP BY gi.id";
|
GROUP BY gi.id";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user