Merge branch 'MDL-74770-400' of https://github.com/paulholden/moodle into MOODLE_400_STABLE

This commit is contained in:
Jun Pataleta
2022-09-01 11:32:08 +08:00
3 changed files with 18 additions and 15 deletions
+1 -1
View File
@@ -32,7 +32,7 @@ $courseid = required_param('id', PARAM_INT); // course id
$page = optional_param('page', 0, PARAM_INT); // active page
$edit = optional_param('edit', -1, PARAM_BOOL); // sticky editting mode
$sortitemid = optional_param('sortitemid', 0, PARAM_ALPHANUM); // sort by which grade item
$sortitemid = optional_param('sortitemid', 0, PARAM_ALPHANUMEXT);
$action = optional_param('action', 0, PARAM_ALPHAEXT);
$move = optional_param('move', 0, PARAM_INT);
$type = optional_param('type', 0, PARAM_ALPHA);
+11 -14
View File
@@ -442,20 +442,17 @@ class grade_report_grader extends grade_report {
$sort = "g.finalgrade $this->sortorder, u.idnumber, u.lastname, u.firstname, u.email";
} else {
$sortjoin = '';
switch($this->sortitemid) {
case 'lastname':
$sort = "u.lastname $this->sortorder, u.firstname $this->sortorder, u.idnumber, u.email";
break;
case 'firstname':
$sort = "u.firstname $this->sortorder, u.lastname $this->sortorder, u.idnumber, u.email";
break;
case 'email':
$sort = "u.email $this->sortorder, u.firstname, u.lastname, u.idnumber";
break;
case 'idnumber':
default:
$sort = "u.idnumber $this->sortorder, u.firstname, u.lastname, u.email";
break;
// The default sort will be that provided by the site for users, unless a valid user field is requested,
// the value of which takes precedence.
[$sort] = users_order_by_sql('u', null, $this->context, $userfieldssql->mappings);
if (array_key_exists($this->sortitemid, $userfieldssql->mappings)) {
// Ensure user sort field doesn't duplicate one of the default sort fields.
$usersortfield = $userfieldssql->mappings[$this->sortitemid];
$defaultsortfields = array_diff(explode(', ', $sort), [$usersortfield]);
$sort = "{$usersortfield} {$this->sortorder}, " . implode(', ', $defaultsortfields);
}
$params = array_merge($gradebookrolesparams, $this->userwheresql_params, $this->groupwheresql_params, $enrolledparams, $relatedctxparams);
@@ -264,3 +264,9 @@ Feature: Using the AJAX grading feature of Grader report to update grades and fe
When I navigate to "View > Grader report" in the course gradebook
Then I should see "litle yellow frog" in the "student1" "table_row"
And I should see "prince frog" in the "student2" "table_row"
# Sort by the custom profile field.
And I click on "Favourite frog" "link" in the "gradereport-grader-table" "table"
And "student1" "table_row" should appear before "student2" "table_row"
# Now sort by descending.
And I click on "Favourite frog" "link" in the "gradereport-grader-table" "table"
And "student2" "table_row" should appear before "student1" "table_row"