Skip to content

Commit

Permalink
MDL-62983 core_user: Hold multiple filters when clicking any link
Browse files Browse the repository at this point in the history
  • Loading branch information
usqfowlerj authored and sarjona committed Aug 1, 2018
1 parent 6e8235c commit 89e27d9
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
4 changes: 2 additions & 2 deletions user/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,8 @@
echo '<div class="userlist">';

// Add filters to the baseurl after creating unified_filter to avoid losing them.
foreach ($filtersapplied as $filter) {
$baseurl->param('unified-filters[]', $filter);
foreach (array_unique($filtersapplied) as $filterix => $filter) {
$baseurl->param('unified-filters[' . $filterix . ']', $filter);
}
$participanttable = new \core_user\participants_table($course->id, $groupid, $lastaccess, $roleid, $enrolid, $status,
$searchkeywords, $bulkoperations, $selectall);
Expand Down
21 changes: 19 additions & 2 deletions user/tests/behat/filter_participants_showall.feature
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Feature: Course participants can be filtered to display all the users
And the following "course enrolments" exist:
| user | course | role | status | timeend |
| student1 | C1 | student | 0 | |
| student2 | C1 | student | 1 | |
| student2 | C1 | student | 0 | |
| student3 | C1 | student | 0 | |
| student4 | C1 | student | 0 | |
| student5 | C1 | student | 0 | |
Expand All @@ -61,7 +61,7 @@ Feature: Course participants can be filtered to display all the users
| student21 | C1 | student | 0 | |
| student22 | C1 | student | 0 | |
| student23 | C1 | student | 0 | |
| student24 | C1 | student | 0 | |
| student24 | C1 | student | 1 | |
| student1 | C2 | student | 0 | |
| student2 | C2 | student | 0 | |
| student3 | C2 | student | 0 | |
Expand All @@ -88,3 +88,20 @@ Feature: Course participants can be filtered to display all the users
Then I should see "Role: Student"
And I should see "Number of participants: 24" in the "//div[@class='userlist']" "xpath_element"
And I should see "Show 20 per page"

@javascript
Scenario: Apply more than one filter and show all users
Given I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to course participants
When I open the autocomplete suggestions list
And I click on "Role: Student" item in the autocomplete list
And I open the autocomplete suggestions list
And I click on "Status: Active" item in the autocomplete list
And I click on "Show all 23" "link"
Then I should see "Role: Student"
And I should see "Status: Active"
And I should see "Number of participants: 23" in the "//div[@class='userlist']" "xpath_element"
And I should see "Student 1"
And I should not see "Student 24"
And I should see "Show 20 per page"

0 comments on commit 89e27d9

Please sign in to comment.