mirror of
https://github.com/moodle/moodle.git
synced 2025-01-17 21:49:15 +01:00
Merge branch 'MDL-64325-main' of https://github.com/kevpercy/moodle
This commit is contained in:
commit
1db19bc5bf
@ -511,28 +511,23 @@ class grade_category extends grade_object {
|
||||
}
|
||||
}
|
||||
|
||||
$grade_inst = new grade_grade();
|
||||
$fields = 'g.'.implode(',g.', $grade_inst->required_fields);
|
||||
$gradeinst = new grade_grade();
|
||||
$fields = implode(',', $gradeinst->required_fields);
|
||||
|
||||
// where to look for final grades - include grade of this item too, we will store the results there
|
||||
$gis = array_merge($depends_on, array($this->grade_item->id));
|
||||
list($usql, $params) = $DB->get_in_or_equal($gis);
|
||||
|
||||
if ($userid) {
|
||||
$usersql = "AND g.userid=?";
|
||||
$usersql = "AND userid=?";
|
||||
$params[] = $userid;
|
||||
|
||||
} else {
|
||||
$usersql = "";
|
||||
}
|
||||
|
||||
$sql = "SELECT $fields
|
||||
FROM {grade_grades} g, {grade_items} gi
|
||||
WHERE gi.id = g.itemid AND gi.id $usql $usersql
|
||||
ORDER BY g.userid";
|
||||
|
||||
// group the results by userid and aggregate the grades for this user
|
||||
$rs = $DB->get_recordset_sql($sql, $params);
|
||||
$rs = $DB->get_recordset_select('grade_grades', "itemid $usql $usersql", $params, 'userid', $fields);
|
||||
if ($rs->valid()) {
|
||||
$prevuser = 0;
|
||||
$grade_values = array();
|
||||
|
@ -2211,25 +2211,21 @@ class grade_item extends grade_object {
|
||||
list($usql, $params) = $DB->get_in_or_equal($gis);
|
||||
|
||||
if ($userid) {
|
||||
$usersql = "AND g.userid=?";
|
||||
$usersql = "AND userid=?";
|
||||
$params[] = $userid;
|
||||
} else {
|
||||
$usersql = "";
|
||||
}
|
||||
|
||||
$grade_inst = new grade_grade();
|
||||
$fields = 'g.'.implode(',g.', $grade_inst->required_fields);
|
||||
$gradeinst = new grade_grade();
|
||||
$fields = implode(',', $gradeinst->required_fields);
|
||||
|
||||
$params[] = $this->courseid;
|
||||
$sql = "SELECT $fields
|
||||
FROM {grade_grades} g, {grade_items} gi
|
||||
WHERE gi.id = g.itemid AND gi.id $usql $usersql AND gi.courseid=?
|
||||
ORDER BY g.userid";
|
||||
|
||||
$return = true;
|
||||
|
||||
// group the grades by userid and use formula on the group
|
||||
$rs = $DB->get_recordset_sql($sql, $params);
|
||||
$rs = $DB->get_recordset_select('grade_grades', "itemid $usql $usersql", $params, 'userid', $fields);
|
||||
if ($rs->valid()) {
|
||||
$prevuser = 0;
|
||||
$grade_records = array();
|
||||
|
Loading…
x
Reference in New Issue
Block a user