diff --git a/lib/enrollib.php b/lib/enrollib.php index f3035575f71..359209dab80 100644 --- a/lib/enrollib.php +++ b/lib/enrollib.php @@ -1419,8 +1419,8 @@ function get_enrolled_join(context $context, $useridcolumn, $onlyactive = false, "{$prefix}e1.courseid = :{$prefix}_e1_courseid", ); if ($enrolid) { - $enrolconditions[] = "{$prefix}e1.id = :{$prefix}e1.enrolid"; - $params[$prefix . 'e1.enrolid'] = $enrolid; + $enrolconditions[] = "{$prefix}e1.id = :{$prefix}e1_enrolid"; + $params[$prefix . 'e1_enrolid'] = $enrolid; } $enrolconditionssql = implode(" AND ", $enrolconditions); $joins[] = "JOIN {enrol} {$prefix}e1 ON ($enrolconditionssql)"; diff --git a/user/tests/behat/filter_participants.feature b/user/tests/behat/filter_participants.feature index de0180065d4..ad35b36bc0e 100644 --- a/user/tests/behat/filter_participants.feature +++ b/user/tests/behat/filter_participants.feature @@ -82,6 +82,26 @@ Feature: Course participants can be filtered And I should not see "Student 2" in the "participants" "table" And I should not see "Student 4" in the "participants" "table" And I should not see "Teacher 1" in the "participants" "table" + # Add more filters. + And I open the autocomplete suggestions list + And I click on "Enrolment methods: Manual enrolments" item in the autocomplete list + And I open the autocomplete suggestions list + And I click on "Group: Group 2" item in the autocomplete list + And I should see "Student 3" in the "participants" "table" + But I should not see "Teacher 1" 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 4" in the "participants" "table" + # Deselect the active status filter. + And I click on "Status: Active" "text" in the ".form-autocomplete-selection" "css_element" + # Apply Status: Inactive filter. + And I open the autocomplete suggestions list + And I click on "Status: Inactive" item in the autocomplete list + Then I should see "Student 2" in the "participants" "table" + But I should not see "Student 4" in the "participants" "table" + And I should not see "Student 1" 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: Filter by keyword