MDL-68984 user: Ensure first/last name filtering is always applied

This ensures the firstname and surname filtering is applied in addition
to any other filtering, rather than using the filterset join type.
This commit is contained in:
Michael Hawkins 2020-06-09 12:36:11 +08:00
parent bbb7dfc62e
commit 8ddfc963b9
2 changed files with 24 additions and 2 deletions

View File

@ -265,9 +265,9 @@ class participants_search {
}
}
// Add any supplied additional WHERE clauses.
// Add any supplied additional forced WHERE clauses.
if (!empty($additionalwhere)) {
$wheres[] = $additionalwhere;
$innerwhere .= " AND ({$additionalwhere})";
$params = array_merge($params, $additionalparams);
}

View File

@ -664,3 +664,25 @@ Feature: Course participants can be filtered
And I should not see "Student 2" in the "participants" "table"
And I should not see "Student 3" in the "participants" "table"
And I should not see "Teacher 1" in the "participants" "table"
@javascript
Scenario: Initials filtering is always applied in addition to any other filtering
Given I log in as "teacher1"
And I am on "Course 2" course homepage
And I navigate to course participants
And I should see "Student 1" in the "participants" "table"
And I should see "Student 2" in the "participants" "table"
And I should see "Student 3" in the "participants" "table"
And I should see "Trendy Learnson" in the "participants" "table"
And I should see "Teacher 1" in the "participants" "table"
When I set the field "Match" in the "Filter 1" "fieldset" to "Any"
And I set the field "type" in the "Filter 1" "fieldset" to "Role"
And I click on ".form-autocomplete-downarrow" "css_element" in the "Filter 1" "fieldset"
And I click on "Student" "list_item"
And I click on "Apply filters" "button"
When I click on "T" "link" in the ".firstinitial" "css_element"
Then I should see "Trendy Learnson" in the "participants" "table"
And I should not see "Student 1" in the "participants" "table"
And I should not see "Student 2" in the "participants" "table"
And I should not see "Student 3" in the "participants" "table"
And I should not see "Teacher 1" in the "participants" "table"