MDL-80091 assign grade: select the first user when changing filter

(if the previously selected user is no longer in the filtered list)
This commit is contained in:
Andrew Gosali
2025-03-18 15:19:56 +07:00
parent b3931cdb95
commit 8029fb707a
4 changed files with 18 additions and 4 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+2 -2
View File
@@ -267,8 +267,8 @@ define(['jquery', 'core/notification', 'core/str', 'core/form-autocomplete',
}
});
if (this._filteredUsers.length && foundIndex !== null) {
this._selectUserById(this._filteredUsers[foundIndex].id);
if (this._filteredUsers.length) {
this._selectUserById(this._filteredUsers[foundIndex ?? 0].id);
} else {
this._selectNoUser();
}
@@ -27,6 +27,7 @@ Feature: In an assignment, teachers can change filters in the grading app
| course | C1 |
| name | Test assignment name & |
| description | Submit your online text |
| submissiondrafts | 0 |
| assignsubmission_onlinetext_enabled | 1 |
| assignsubmission_file_enabled | 0 |
| markingworkflow | 1 |
@@ -79,3 +80,16 @@ Feature: In an assignment, teachers can change filters in the grading app
And I click on "Advanced" "button" in the ".tertiary-navigation" "css_element"
And the field "Marker" matches value "Marker 1"
And the field "Marking state" matches value "In marking"
@javascript
Scenario: Applying filters in the grading app loads and displays the correct students
Given the following "mod_assign > submissions" exist:
| assign | user | onlinetext |
| Test assignment name & | student1 | I'm the student first submission |
When I am on the "Test assignment name &" "assign activity" page logged in as teacher1
And I go to "Student 1" "Test assignment name &" activity advanced grading page
And I click on "Change filters" "link"
And I set the field "Filter" to "notsubmitted"
Then I should see "student2"
And I set the field "Filter" to "requiregrading"
And I should see "student1"