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

Ajax call to enroll potential users is too slow

    XMLWordPrintable

Details

    • MOODLE_36_STABLE, MOODLE_37_STABLE, MOODLE_38_STABLE, MOODLE_39_STABLE
    • MOODLE_37_STABLE, MOODLE_38_STABLE
    •  MDL-67410-master
    • 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.
    • Easy
    • 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).

    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

            felicemcc Felice Candilio
            felicemcc Felice Candilio
            Sara Arjona (@sarjona) Sara Arjona (@sarjona)
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Janelle Barcega Janelle Barcega
            David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo
            Votes:
            6 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              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