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

Assignment - Getting users courses generate extra load-time in the user-picker

    XMLWordPrintable

    Details

    • Database:
      MySQL
    • Testing Instructions:
      Hide
      Automated tests
      1. Run the following unit tests :

        vendor/bin/phpunit user/tests/userlib_test.php
        vendor/bin/phpunit mod/assign/tests/externallib_test.php
        

        • Confirm that there are no errors nor failures.
      2. Run behat tests with @mod_assign tag
        • Confirm that there are no errors nor failures.
      Manual test
      Setup
      1. Login as an admin
      2. Check all the fields available of the showuseridentity configuration and save (Site administration > Users > Permissions > User policies)
      3. Create at least 20 student accounts.
      4. Create at least 3 courses.
      5. Enrol the students to all of the courses.
      6. Set at least one of the courses as hidden.
      7. Create an assignment in any of the visible courses.
      Before the patch
      1. Login as a teacher.
      2. Go to the assignment's grading interface
      3. Open your browser's developer panel and open the Network tab.
      4. Expand the assignment grader's user selector field by clicking on the down arrow.
      5. On the developer panel, click on the network resource that was loaded (e.g. service.php?sesskey=[SESSKEY].
      6. Click on the Timing tab.
      7. Take note of the time it took for the request to complete.
      After the patch
      1. Apply the patch
      2. Purge all caches
      3. Reload the assignment grading page.
      4. Expand the assignment grader's user selector field by clicking on the down arrow.
        • Confirm that the user selector is displaying correctly with the appropriate user identity fields being displayed whenever applicable.
      5. Check again the timing information for the request in the Developer panel.
        • Confirm that the time it took for the request to complete is faster than the previous time before the patch.
      6. Still on the Developer panel, click on the Response tab for the request.
      7. Check the response data.
        • Confirm that the response data does not include a enrolledcourses field.
      Show
      Automated tests Run the following unit tests : vendor/bin/phpunit user/tests/userlib_test.php vendor/bin/phpunit mod/assign/tests/externallib_test.php Confirm that there are no errors nor failures. Run behat tests with @mod_assign tag Confirm that there are no errors nor failures. Manual test Setup Login as an admin Check all the fields available of the showuseridentity configuration and save (Site administration > Users > Permissions > User policies) Create at least 20 student accounts. Create at least 3 courses. Enrol the students to all of the courses. Set at least one of the courses as hidden. Create an assignment in any of the visible courses. Before the patch Login as a teacher. Go to the assignment's grading interface Open your browser's developer panel and open the Network tab. Expand the assignment grader's user selector field by clicking on the down arrow. On the developer panel, click on the network resource that was loaded (e.g. service.php?sesskey=[SESSKEY] . Click on the Timing tab. Take note of the time it took for the request to complete. After the patch Apply the patch Purge all caches Reload the assignment grading page. Expand the assignment grader's user selector field by clicking on the down arrow. Confirm that the user selector is displaying correctly with the appropriate user identity fields being displayed whenever applicable. Check again the timing information for the request in the Developer panel. Confirm that the time it took for the request to complete is faster than the previous time before the patch. Still on the Developer panel, click on the Response tab for the request. Check the response data. Confirm that the response data does not include a enrolledcourses field.
    • Affected Branches:
      MOODLE_31_STABLE
    • Fixed Branches:
      MOODLE_31_STABLE
    • Pull Master Branch:
      MDL-55630-master

      Description

      I know the issue with the extremely long loading time was fixed with MDL-55284, but there is still a problem remaining with the search bar in the new assignment UI.

      I've tested with 90 users. Basically, you click on the black down arrow in the search user-picker (see screenshot). What ensues is a medium/long wait (around 20 seconds) because it tries to compute all the names previously loaded. Furthermore, when typing in the search menu, it seems it has trouble computing the suggested users. Sometimes, it even shows non-related names to my search entry.

      Update : After some debugging in our instance, I found out that the function that slowed the process is enrol_get_users_courses, called by user_get_user_details . If I remove the call to this function, the service runs under a second. We have a pretty big Moodle instance with a lot of courses and enrolments (Tables stats: course = 53 815, enrol = 210 165, user_enrolments = 2 191 458).

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                3 Vote for this issue
                Watchers:
                9 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  14/Nov/16