From 771f8df1536dfeb309d1364b9890ae362b34d021 Mon Sep 17 00:00:00 2001 From: Damyon Wiese Date: Wed, 20 Jul 2016 13:47:00 +0800 Subject: [PATCH] MDL-55284 assign: Add missing webservice param 'onlyids' Mod assign list_participants webservice is supposed to accept a param to limit the returned data to only show user ids and not the full user details. It is missing and so the full user records are fetched every time. This has a major impact on the performance of the new assignment grading interface. --- mod/assign/externallib.php | 6 ++++-- mod/assign/tests/externallib_test.php | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/mod/assign/externallib.php b/mod/assign/externallib.php index 9bdc7cc63d9..4f542436692 100644 --- a/mod/assign/externallib.php +++ b/mod/assign/externallib.php @@ -2610,11 +2610,12 @@ class mod_assign_external extends external_api { * @param string $filter search string to filter the results. * @param int $skip Number of records to skip * @param int $limit Maximum number of records to return + * @param bool $onlyids Only return user ids. * @return array of warnings and status result * @since Moodle 3.1 * @throws moodle_exception */ - public static function list_participants($assignid, $groupid, $filter, $skip, $limit) { + public static function list_participants($assignid, $groupid, $filter, $skip, $limit, $onlyids) { global $DB, $CFG; require_once($CFG->dirroot . "/mod/assign/locallib.php"); require_once($CFG->dirroot . "/user/lib.php"); @@ -2625,7 +2626,8 @@ class mod_assign_external extends external_api { 'groupid' => $groupid, 'filter' => $filter, 'skip' => $skip, - 'limit' => $limit + 'limit' => $limit, + 'onlyids' => $onlyids )); $warnings = array(); diff --git a/mod/assign/tests/externallib_test.php b/mod/assign/tests/externallib_test.php index 22cd5616fac..2f53d9286ef 100644 --- a/mod/assign/tests/externallib_test.php +++ b/mod/assign/tests/externallib_test.php @@ -2299,7 +2299,7 @@ class mod_assign_external_testcase extends externallib_advanced_testcase { $DB->update_record('user', $student); $this->setUser($teacher); - $participants = mod_assign_external::list_participants($assignment->id, 0, '', 0, 0); + $participants = mod_assign_external::list_participants($assignment->id, 0, '', 0, 0, false); $this->assertCount(1, $participants); // Asser that we have a valid response data.