Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-67410

Ajax call to enroll potential users is too slow

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      Pre-requisites:

      • I go to the user policies on the admin section: admin/settings.php?section=userpolicies
      • I look for "maxusersperpage" setting and remember that number.

      * For this test instruction we're going to assume maxusersperpage=100 (that's the default).

       

      Before applying the patch

      1. I go to any course with some users enrolled
      2. I go to the Participants section
      3. I click on Enrol users
      4. I introduce only 2 letters (e.g: "ma")
      5. I open the browser's console/inspector (F12 or Ctrl+Shift+I)
      6. I go to the network tab
      7. I see a line like: "/service.php?sesskey=ujTV1jyPKh&info=core_enrol_get_potential_users"
      8. I right click on that line and copy it as CURL
      9. I inspect the copied code, I see the parameter "perpage" has a value of "1001". (the number 1 has been concatenated).

      After applying the patch
      #I go to any course with some users enrolled

      1. I go to the Participants section
      2. I click on Enrol users
      3. I introduce only 2 letters (e.g: "ma")
      4. I open the browser's console/inspector (F12 or Ctrl+Shift+I)
      5. I go to the network tab
      6. I see a line like: "/service.php?sesskey=ujTV1jyPKh&info=core_enrol_get_potential_users"
      7. I right click on that line and copy it as CURL
      8. I inspect the copied code, I see the parameter "perpage" has now a value of "101". (the number 1 has been added to the maximum value instead of being concatenated).
      Show
      Pre-requisites: I go to the user policies on the admin section: admin/settings.php?section=userpolicies I look for "maxusersperpage" setting and remember that number. * For this test instruction we're going to assume maxusersperpage=100 (that's the default).   Before applying the patch I go to any course with some users enrolled I go to the Participants section I click on Enrol users I introduce only 2 letters (e.g: "ma") I open the browser's console/inspector (F12 or Ctrl+Shift+I) I go to the network tab I see a line like: "/service.php?sesskey=ujTV1jyPKh&info=core_enrol_get_potential_users" I right click on that line and copy it as CURL I inspect the copied code, I see the parameter "perpage" has a value of "1001". (the number 1 has been concatenated). After applying the patch #I go to any course with some users enrolled I go to the Participants section I click on Enrol users I introduce only 2 letters (e.g: "ma") I open the browser's console/inspector (F12 or Ctrl+Shift+I) I go to the network tab I see a line like: "/service.php?sesskey=ujTV1jyPKh&info=core_enrol_get_potential_users" I right click on that line and copy it as CURL I inspect the copied code, I see the parameter "perpage" has now a value of "101". (the number 1 has been added to the maximum value instead of being concatenated).
    • Workaround:
      Hide

      The proposed solution is to parse the number as an integer when performing the addition. A patch will be posted for that.

      Show
      The proposed solution is to parse the number as an integer when performing the addition. A patch will be posted for that.
    • Difficulty:
      Easy
    • Affected Branches:
      MOODLE_36_STABLE, MOODLE_37_STABLE, MOODLE_38_STABLE, MOODLE_39_STABLE
    • Fixed Branches:
      MOODLE_37_STABLE, MOODLE_38_STABLE
    • Pull 3.7 Branch:
    • Pull 3.8 Branch:
       MDL-67410-38
    • Pull Master Branch:
       MDL-67410-master

      Description

      Basically the manual enrollment in any course takes too much time, having to enroll many users is a painful task.

      We have found that when the quantity of users handled by the autosuggestion search made with AJAX is over 1500 users, the parameter called "perpage" on the call is treated as a string, therefore, It could have a value 15001 resulting from a "+" operation  of the "1500" string and the number 1. That big number makes the selection extremely slow.

       

        Attachments

          Activity

            People

            Assignee:
            felicemcc Felice Candilio
            Reporter:
            felicemcc Felice Candilio
            Peer reviewer:
            Sara Arjona (@sarjona)
            Integrator:
            Eloy Lafuente (stronk7)
            Tester:
            Janelle Barcega
            Participants:
            Component watchers:
            Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Víctor Déniz Falcón
            Votes:
            6 Vote for this issue
            Watchers:
            7 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              13/Jan/20

                Time Tracking

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 hour, 31 minutes
                1h 31m