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

gradebook MDL-25769 fixed some problems identified by peer review

parent 387815db
......@@ -167,7 +167,8 @@ function get_unenrolled_users_in_import($importcode, $courseid) {
list($gradebookrolessql, $gradebookrolesparams) = $DB->get_in_or_equal(explode(',', $CFG->gradebookroles), SQL_PARAMS_NAMED, 'grbr0');
//enrolled users
list($enrolledsql, $enrolledparams) = get_enrolled_sql($this->context);
$context = get_context_instance(CONTEXT_COURSE, $courseid);
list($enrolledsql, $enrolledparams) = get_enrolled_sql($context);
$sql = "SELECT giv.id, u.firstname, u.lastname, u.idnumber AS useridnumber,
COALESCE(gi.idnumber, gin.itemname) AS gradeidnumber
......@@ -175,7 +176,7 @@ function get_unenrolled_users_in_import($importcode, $courseid) {
{grade_import_values} giv
JOIN {user} u ON giv.userid = u.id
LEFT JOIN {grade_items} gi ON gi.id = giv.itemid
LEFT JOIN {grade_import_newitem} gin ON gin.id = giv.newgradeitem
LEFT JOIN {grade_import_newitem} gin ON gin.id = giv.newgradeitem
LEFT JOIN ($enrolledsql) je ON je.id = u.id
LEFT JOIN {role_assignments} ra ON (giv.userid = ra.userid AND
ra.roleid $gradebookrolessql AND
......@@ -183,9 +184,10 @@ function get_unenrolled_users_in_import($importcode, $courseid) {
WHERE giv.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;
return $DB->get_records_sql($sql, array_merge($gradebookrolesparams, $enrolledparams));
return $DB->get_records_sql($sql, $params);
}
/**
......
......@@ -1311,7 +1311,6 @@ class grade_report_grader extends grade_report {
// MDL-10875 Empty grades must be evaluated as grademin, NOT always 0
// This query returns a count of ungraded grades (NULL finalgrade OR no matching record in grade_grades table)
$params = array_merge(array('courseid'=>$this->courseid), $params);
$SQL = "SELECT gi.id, COUNT(u.id) AS count
FROM {grade_items} gi
CROSS JOIN {user} u
......
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