Skip to content

Commit

Permalink
MDL-67410 Enrolments: Casting the perpage parameter to INT
Browse files Browse the repository at this point in the history
On the course's Participants page, when manually enrolling users
the AJAX call might get excesively slow, due to the treatment
of the perpage parameter as a string, which gets concatenated with the
number 1 (perpage: parseInt(perpage) + 1) instead of performing a
numerical addition.

If there are for example 1500+ users on the site, the method
core_enrol_get_potential_users will be executed with a value of 15001
for the perpage parameter, rendering painfully slow.
  • Loading branch information
felicemcc committed Dec 12, 2019
1 parent 6aacd8d commit 4a4a734
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion enrol/manual/amd/build/form-potential-user-selector.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions enrol/manual/amd/src/form-potential-user-selector.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/str'], function($, Ajax,
if (typeof enrolid === "undefined") {
enrolid = '';
}
var perpage = $(selector).attr('perpage');
if (typeof perpage === "undefined") {
var perpage = parseInt($(selector).attr('perpage'));
if (isNaN(perpage)) {
perpage = 100;
}

Expand Down

0 comments on commit 4a4a734

Please sign in to comment.