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

course_enrolment_manager method should not always do a count_records and a get_records

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

       

      For the Enrol users popup when clicking on Enrol users button on Participants page, the functionality should not have changed at all. The existing the new Unit Test of Enroll should provide reasonable coverage.

       

      For the Search popup when clicking on Assign roles button on Other users page:

      1. Login as admin
      2. Change theme to Clean theme (Because Boost theme do not use this any more)
      3. Open your browser's dev tools and in the network tab (chrome and firefox have this)
      4. Create 1 user.
      5. Go to Other user page of Course (Ex: enrol/otherusers.php?id=[courseid]
      6. Click on Assign roles button
      7. Verify that the popup will show 1 user found
      8. Verify in the browser's dev tools that moreuser value in the response data is false and totalusers value does not exist in the response data
      9. Create 20 users more.
      10. Click on Assign roles button
      11. Verify that the popup will show 21 users found
      12. Verify in the browser's dev tools that moreuser value in the response data is false
      13. Create 10 users more.
      14. Click on Assign roles button
      15. Verify that the popup will show More than 25 users found (With 25 is the default paging number)
      16. Verify in the browser's dev tools that moreuser value in the response data is true
      Show
        For the Enrol users popup when clicking on Enrol users button on Participants page, the functionality should not have changed at all. The existing the new Unit Test of Enroll should provide reasonable coverage.   For the Search popup when clicking on Assign roles button on Other users page: Login as admin Change theme to Clean theme (Because Boost theme do not use this any more) Open your browser's dev tools and in the network tab (chrome and firefox have this) Create 1 user. Go to Other user page of Course (Ex: enrol/otherusers.php?id= [courseid] Click on Assign roles button Verify that the popup will show 1 user found Verify in the browser's dev tools that moreuser value in the response data is false and totalusers value does not exist in the response data Create 20 users more. Click on Assign roles button Verify that the popup will show 21 users found Verify in the browser's dev tools that moreuser value in the response data is false Create 10 users more. Click on Assign roles button Verify that the popup will show More than 25 users found (With 25 is the default paging number) Verify in the browser's dev tools that moreuser value in the response data is true
    • Affected Branches:
      MOODLE_34_STABLE, MOODLE_35_STABLE, MOODLE_36_STABLE
    • Fixed Branches:
      MOODLE_37_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-63938-master

      Description

      Some of the queires in course_enrolment_manager can be extemely slow. E.g. as reported at MDL-56059, get_potential_users can do a count_records that takes 7 seconds followed by a get_records that does 5 seconds (and then the count is not displayed in the Enrol users pop-up). This is a horrible waste.

      The API needs to be changed so that the count_records is only done if really needed.

      (If count_records is not done, then we could increase $limitnum by 1, and check if the last row is included, to know if there is more data, and return that instead of an exact count.)

        Attachments

        1. 1 user.png
          1 user.png
          470 kB
        2. 21 users.png
          21 users.png
          595 kB
        3. more than 25 users.png
          more than 25 users.png
          499 kB
        4. Screen Shot 2018-11-23 at 4.23.59 PM.png
          Screen Shot 2018-11-23 at 4.23.59 PM.png
          94 kB

          Activity

            People

            • Assignee:
              HuongNV Huong Nguyen
              Reporter:
              timhunt Tim Hunt
              Peer reviewer:
              Tim Hunt
              Integrator:
              Eloy Lafuente (stronk7)
              Tester:
              Bas Brands
              Participants:
              Component watchers:
              Amaia Anabitarte, Bas Brands, Carlos Escobedo, Sara Arjona (@sarjona), Víctor Déniz Falcón, Amaia Anabitarte, Bas Brands, Carlos Escobedo, Sara Arjona (@sarjona), Víctor Déniz Falcón
            • Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                20/May/19