Commit f2491a11 authored by andyjdavis's avatar andyjdavis Committed by Sam Hemelryk
Browse files

gradebook MDL-25769 switched a query over to use named params

parent 2dc5e584
......@@ -181,11 +181,11 @@ function get_unenrolled_users_in_import($importcode, $courseid) {
LEFT JOIN {role_assignments} ra ON (giv.userid = ra.userid AND
ra.roleid $gradebookrolessql AND
ra.contextid $relatedctxcondition)
WHERE giv.importcode = ?
WHERE giv.importcode = :importcode
AND (ra.id IS NULL OR je.id IS NULL)
ORDER BY gradeidnumber, u.lastname, u.firstname";
$params = array_merge($gradebookrolesparams, $enrolledparams);
$params[] = $importcode;
$params['importcode'] = $importcode;
return $DB->get_records_sql($sql, $params);
}
......
......@@ -349,17 +349,17 @@ class grade_report_grader extends grade_report {
$sort = "MAX(g.finalgrade) $this->sortorder";
$sql = "SELECT $userfields
FROM {user} u
JOIN ($enrolledsql) je ON je.id = u.id
JOIN {role_assignments} ra ON ra.userid = u.id
$this->groupsql
LEFT JOIN {grade_grades} g ON (g.userid = u.id AND g.itemid = :gitemid)
WHERE ra.roleid $gradebookrolessql
AND u.deleted = 0
AND ra.contextid ".get_related_contexts_string($this->context)."
$this->groupwheresql
GROUP BY $userfields
ORDER BY $sort";
FROM {user} u
JOIN ($enrolledsql) je ON je.id = u.id
JOIN {role_assignments} ra ON ra.userid = u.id
$this->groupsql
LEFT JOIN {grade_grades} g ON (g.userid = u.id AND g.itemid = :gitemid)
WHERE ra.roleid $gradebookrolessql
AND u.deleted = 0
AND ra.contextid ".get_related_contexts_string($this->context)."
$this->groupwheresql
GROUP BY $userfields
ORDER BY $sort";
} else {
switch($this->sortitemid) {
......@@ -375,15 +375,15 @@ class grade_report_grader extends grade_report {
$params = array_merge($gradebookrolesparams, $this->groupwheresql_params, $enrolledparams);
$sql = "SELECT DISTINCT $userfields
FROM {user} u
JOIN ($enrolledsql) je ON je.id = u.id
JOIN {role_assignments} ra ON u.id = ra.userid
$this->groupsql
WHERE ra.roleid $gradebookrolessql
AND u.deleted = 0
AND ra.contextid ".get_related_contexts_string($this->context)."
$this->groupwheresql
ORDER BY $sort";
FROM {user} u
JOIN ($enrolledsql) je ON je.id = u.id
JOIN {role_assignments} ra ON u.id = ra.userid
$this->groupsql
WHERE ra.roleid $gradebookrolessql
AND u.deleted = 0
AND ra.contextid ".get_related_contexts_string($this->context)."
$this->groupwheresql
ORDER BY $sort";
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment