Skip to content

Commit

Permalink
MDL-75274 gradereport_grader: Fix sorting of grade items.
Browse files Browse the repository at this point in the history
Seems that baseurl is rewritten causing toggling of ordering
not work
  • Loading branch information
ilyatregubov authored and Chocolate-lightning committed Apr 13, 2023
1 parent cfbb0ea commit 277b551
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 2 deletions.
2 changes: 1 addition & 1 deletion grade/lib.php
Expand Up @@ -2556,7 +2556,7 @@ public function get_cell_action_menu(array $element, string $mode, grade_plugin_

// Sorting item.
if ($baseurl) {
$sortlink = $baseurl;
$sortlink = clone($baseurl);
if (isset($element['object']->id)) {
$sortlink->param('sortitemid', $element['object']->id);
} else if ($element['type'] == 'userfield') {
Expand Down
Expand Up @@ -42,7 +42,7 @@ Feature: We can sort grades/user fields on the grader report
And I log in as "teacher1"

@javascript
Scenario: Sort grades or user fields on grader report
Scenario: Sort grades or user fields on grader report by using cell action menu
When I am on "Course 1" course homepage with editing mode on
And I navigate to "View > Grader report" in the course gradebook
# Default sorting is lastname ascending.
Expand Down Expand Up @@ -77,6 +77,39 @@ Feature: We can sort grades/user fields on the grader report
Then "StudentA 2" "table_row" should appear before "StudentC 3" "table_row"
And "StudentC 3" "table_row" should appear before "StudentD 1" "table_row"
And "StudentD 1" "table_row" should appear before "StudentB 4" "table_row"

@javascript
Scenario: Sort grades or user fields on grader report by using element header
When I am on "Course 1" course homepage with editing mode on
And I navigate to "View > Grader report" in the course gradebook
# Default sorting is lastname ascending.
And "StudentD 1" "table_row" should appear before "StudentA 2" "table_row"
And "StudentA 2" "table_row" should appear before "StudentC 3" "table_row"
And "StudentC 3" "table_row" should appear before "StudentB 4" "table_row"
# Sort by grades in ascending order.
And I click on "Test assignment name 1" "link" in the "region-main" "region"
And I wait until the page is ready
Then "StudentD 1" "table_row" should appear before "StudentB 4" "table_row"
And "StudentB 4" "table_row" should appear before "StudentC 3" "table_row"
And "StudentC 3" "table_row" should appear before "StudentA 2" "table_row"
# Sort by grades in descending order.
And I click on "Test assignment name 1" "link" in the "region-main" "region"
And I wait until the page is ready
Then "StudentA 2" "table_row" should appear before "StudentC 3" "table_row"
And "StudentC 3" "table_row" should appear before "StudentB 4" "table_row"
And "StudentB 4" "table_row" should appear before "StudentD 1" "table_row"
# Sort by email in ascending order.
And I click on "Email address" "link" in the "region-main" "region"
And I wait until the page is ready
Then "StudentB 4" "table_row" should appear before "StudentD 1" "table_row"
And "StudentD 1" "table_row" should appear before "StudentC 3" "table_row"
And "StudentC 3" "table_row" should appear before "StudentA 2" "table_row"
# Sort by email in descending order.
And I click on "Email address" "link" in the "region-main" "region"
And I wait until the page is ready
Then "StudentA 2" "table_row" should appear before "StudentC 3" "table_row"
And "StudentC 3" "table_row" should appear before "StudentD 1" "table_row"
And "StudentD 1" "table_row" should appear before "StudentB 4" "table_row"
# Sort by firstname in ascending order.
And I click on "First name" "link"
And I wait until the page is ready
Expand Down

0 comments on commit 277b551

Please sign in to comment.