Skip to content

Commit

Permalink
MDL-77029 gradereport_grader: Fix sorting bug
Browse files Browse the repository at this point in the history
When column was sorted in descending order, null values
were shown first.
  • Loading branch information
ilyatregubov committed Mar 28, 2023
1 parent fc9583b commit cb00d26
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion grade/report/grader/lib.php
Expand Up @@ -414,7 +414,13 @@ public function load_users() {
$this->groupwheresql_params, $enrolledparams, $relatedctxparams);

$sortjoin = "LEFT JOIN {grade_grades} g ON g.userid = u.id AND g.itemid = $this->sortitemid";
$sort = "g.finalgrade $this->sortorder, u.idnumber, u.lastname, u.firstname, u.email";

if ($this->sortorder == 'ASC') {
$sort = $DB->sql_order_by_null('g.finalgrade');
} else {
$sort = $DB->sql_order_by_null('g.finalgrade', SORT_DESC);
}
$sort .= ", u.idnumber, u.lastname, u.firstname, u.email";
} else {
$sortjoin = '';

Expand Down

0 comments on commit cb00d26

Please sign in to comment.