mirror of
https://github.com/moodle/moodle.git
synced 2025-04-20 16:04:25 +02:00
MDL-77902 gradebook: Ensure dyn search works with pagination
This commit is contained in:
parent
0e08d0df60
commit
fbc51cd591
@ -101,7 +101,7 @@ class get_users_in_report extends external_api {
|
||||
$userpicture->size = 0; // Size f2.
|
||||
$user->profileimageurlsmall = $userpicture->get_url($PAGE)->out(false);
|
||||
return $user;
|
||||
}, $report->load_users());
|
||||
}, $report->load_users(true));
|
||||
sort($users);
|
||||
|
||||
return [
|
||||
|
@ -389,8 +389,10 @@ class grade_report_grader extends grade_report {
|
||||
|
||||
/**
|
||||
* pulls out the userids of the users to be display, and sorts them
|
||||
*
|
||||
* @param bool $allusers If we are getting the users within the report, we want them all irrespective of paging.
|
||||
*/
|
||||
public function load_users() {
|
||||
public function load_users(bool $allusers = false) {
|
||||
global $CFG, $DB;
|
||||
|
||||
if (!empty($this->users)) {
|
||||
@ -465,7 +467,7 @@ class grade_report_grader extends grade_report {
|
||||
$this->groupwheresql
|
||||
ORDER BY $sort";
|
||||
// We never work with unlimited result. Limit the number of records by MAX_STUDENTS_PER_PAGE if no other limit is specified.
|
||||
$studentsperpage = $this->get_students_per_page() ?: static::MAX_STUDENTS_PER_PAGE;
|
||||
$studentsperpage = ($this->get_students_per_page() && !$allusers) ? $this->get_students_per_page() : static::MAX_STUDENTS_PER_PAGE;
|
||||
$this->users = $DB->get_records_sql($sql, $params, $studentsperpage * $this->page, $studentsperpage);
|
||||
|
||||
if (empty($this->users)) {
|
||||
|
@ -307,3 +307,19 @@ Feature: Within the grader report, test that we can search for users
|
||||
# Begin the search checking if we are adhering the filters.
|
||||
When I set the field "Search users" to "Turtle"
|
||||
Then "Turtle Manatee" "list_item" should not exist in the ".user-search" "css_element"
|
||||
|
||||
Scenario: As a teacher I can dynamically find users whilst ignoring pagination
|
||||
Given "42" "users" exist with the following data:
|
||||
| username | students[count] |
|
||||
| firstname | Student |
|
||||
| lastname | s[count] |
|
||||
| email | students[count]@example.com |
|
||||
And "42" "course enrolments" exist with the following data:
|
||||
| user | students[count] |
|
||||
| course | C1 |
|
||||
| role |student |
|
||||
And I reload the page
|
||||
And the field "perpage" matches value "20"
|
||||
When I set the field "Search users" to "42"
|
||||
And I wait until "View all results for \"42\"" "link" exists
|
||||
Then "Student s42" "list_item" should exist in the ".user-search" "css_element"
|
||||
|
Loading…
x
Reference in New Issue
Block a user