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.
This commit is contained in:
@@ -2603,11 +2603,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");
|
||||
@@ -2618,7 +2619,8 @@ class mod_assign_external extends external_api {
|
||||
'groupid' => $groupid,
|
||||
'filter' => $filter,
|
||||
'skip' => $skip,
|
||||
'limit' => $limit
|
||||
'limit' => $limit,
|
||||
'onlyids' => $onlyids
|
||||
));
|
||||
$warnings = array();
|
||||
|
||||
|
||||
@@ -2294,7 +2294,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.
|
||||
|
||||
Reference in New Issue
Block a user