MDL-66549 grades: Double arrow sort order should be ascending first

This commit is contained in:
arjun-kallapur 2019-09-03 11:50:28 -07:00 committed by Ilya Tregubov
parent 5ea3545115
commit a5ab9e466e
2 changed files with 4 additions and 16 deletions

View file

@ -369,19 +369,11 @@ class grade_report_grader extends grade_report {
if ($this->sortitemid) { if ($this->sortitemid) {
if (!isset($SESSION->gradeuserreport->sort)) { if (!isset($SESSION->gradeuserreport->sort)) {
if ($this->sortitemid == 'firstname' || $this->sortitemid == 'lastname') { $this->sortorder = $SESSION->gradeuserreport->sort = 'ASC';
$this->sortorder = $SESSION->gradeuserreport->sort = 'ASC';
} else {
$this->sortorder = $SESSION->gradeuserreport->sort = 'DESC';
}
} else { } else {
// this is the first sort, i.e. by last name // this is the first sort, i.e. by last name
if (!isset($SESSION->gradeuserreport->sortitemid)) { if (!isset($SESSION->gradeuserreport->sortitemid)) {
if ($this->sortitemid == 'firstname' || $this->sortitemid == 'lastname') { $this->sortorder = $SESSION->gradeuserreport->sort = 'ASC';
$this->sortorder = $SESSION->gradeuserreport->sort = 'ASC';
} else {
$this->sortorder = $SESSION->gradeuserreport->sort = 'DESC';
}
} else if ($SESSION->gradeuserreport->sortitemid == $this->sortitemid) { } else if ($SESSION->gradeuserreport->sortitemid == $this->sortitemid) {
// same as last sort // same as last sort
if ($SESSION->gradeuserreport->sort == 'ASC') { if ($SESSION->gradeuserreport->sort == 'ASC') {
@ -390,11 +382,7 @@ class grade_report_grader extends grade_report {
$this->sortorder = $SESSION->gradeuserreport->sort = 'ASC'; $this->sortorder = $SESSION->gradeuserreport->sort = 'ASC';
} }
} else { } else {
if ($this->sortitemid == 'firstname' || $this->sortitemid == 'lastname') { $this->sortorder = $SESSION->gradeuserreport->sort = 'ASC';
$this->sortorder = $SESSION->gradeuserreport->sort = 'ASC';
} else {
$this->sortorder = $SESSION->gradeuserreport->sort = 'DESC';
}
} }
} }
$SESSION->gradeuserreport->sortitemid = $this->sortitemid; $SESSION->gradeuserreport->sortitemid = $this->sortitemid;

View file

@ -417,7 +417,7 @@ abstract class grade_report {
protected function get_sort_arrow($direction='move', $sortlink=null) { protected function get_sort_arrow($direction='move', $sortlink=null) {
global $OUTPUT; global $OUTPUT;
$pix = array('up' => 't/sort_desc', 'down' => 't/sort_asc', 'move' => 't/sort'); $pix = array('up' => 't/sort_desc', 'down' => 't/sort_asc', 'move' => 't/sort');
$matrix = array('up' => 'desc', 'down' => 'asc', 'move' => 'desc'); $matrix = array('up' => 'desc', 'down' => 'asc', 'move' => 'asc');
$strsort = $this->get_lang_string('sort' . $matrix[$direction]); $strsort = $this->get_lang_string('sort' . $matrix[$direction]);
$arrow = $OUTPUT->pix_icon($pix[$direction], '', '', ['class' => 'sorticon']); $arrow = $OUTPUT->pix_icon($pix[$direction], '', '', ['class' => 'sorticon']);