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

Change conversation counts into single DB query to improve performance

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.6
    • Fix Version/s: 3.6
    • Component/s: Messages
    • Labels:
    • Testing Instructions:
      Hide
      1. Log in as admin and create a course with 4 students and 2 groups (group 1 and group 2) - place all 4 students in each group.
      2. Enable group messaging for the group via the group edit page.
      3. Now, log in as student 1 and open the messaging pane
      4. Search for student 2 and send them a message
      5. On the conversation view, click the ellipsis menu (...) and select 'Add to favourites'
      6. Search for student 3 and send them a message
      7. Open the second group conversation and add to favourites via the ellipsis menu (...)
      8. Log out.
      9. Log in as student 2 and reply to the message from student 1.
      10. Log out.
      11. Log in as student 3 and reply to the message from student 1.
      12. Log out.
      13. Log in a student 1
      14. Open the messaging pane
      15. Expand all each section and click any conversation with unread counts until there are none left.
      16. Refresh the page and open the messaging pane.
      17. Verify you have the following counts: Favourites: 2, Group messages: 1, Messages: 1
      18. Verify the 'Favourites' section is expanded
      19. Open the favourited conversation with student 2 and remove from favourites.
      20. Open the favourited group conversation (group 2) and remove from favourites.
      21. Refresh the page and open the messaging pane
      22. Verify you have the following counts: Favourites: 0, Group messages: 2, Messages: 2
      23. Verify the 'Group messages' section is expanded
      24. Log out.
      25. Log in as admin user again and go the course
      26. Edit the second group and set 'Group messaging' to 'No'
      27. Go to the admin section of the site and select 'Browse list of users'
      28. Find student 2 and click the trash icon to soft-delete this user.
      29. Confirm the action.
      30. Log out.
      31. Log in as student 1.
      32. Open the messaging pane.
      33. Verify you have the following counts: Favourites: 0, Group messages: 1, Messages: 2
      34. Verify the 'Group messages' section is expanded and you only see one conversation - group 1
      35. Expand the 'Messages' section
      36. Verify you see 2 conversations - one with student 2 and one with student 3.
      37. Click the conversation with student 2.
      38. Verify you see the message from student 2
      39. Verify you are unable to message this user and see a message on the view 'You are unable to message this user'.
      40. From the ellipsis menu (...) select 'Delete conversation'
      41. Refresh the page
      42. Open the messaging pane
      43. Verify you have the following counts: Favourites: 0, Group messages: 1, Messages: 1
      44. Expand the 'Messages' section
      45. Verify you only see 1 conversation - the conversation with student 3.
      Show
      Log in as admin and create a course with 4 students and 2 groups (group 1 and group 2) - place all 4 students in each group. Enable group messaging for the group via the group edit page. Now, log in as student 1 and open the messaging pane Search for student 2 and send them a message On the conversation view, click the ellipsis menu (...) and select 'Add to favourites' Search for student 3 and send them a message Open the second group conversation and add to favourites via the ellipsis menu (...) Log out. Log in as student 2 and reply to the message from student 1. Log out. Log in as student 3 and reply to the message from student 1. Log out. Log in a student 1 Open the messaging pane Expand all each section and click any conversation with unread counts until there are none left. Refresh the page and open the messaging pane. Verify you have the following counts: Favourites: 2, Group messages: 1, Messages: 1 Verify the 'Favourites' section is expanded Open the favourited conversation with student 2 and remove from favourites. Open the favourited group conversation (group 2) and remove from favourites. Refresh the page and open the messaging pane Verify you have the following counts: Favourites: 0, Group messages: 2, Messages: 2 Verify the 'Group messages' section is expanded Log out. Log in as admin user again and go the course Edit the second group and set 'Group messaging' to 'No' Go to the admin section of the site and select 'Browse list of users' Find student 2 and click the trash icon to soft-delete this user. Confirm the action. Log out. Log in as student 1. Open the messaging pane. Verify you have the following counts: Favourites: 0, Group messages: 1, Messages: 2 Verify the 'Group messages' section is expanded and you only see one conversation - group 1 Expand the 'Messages' section Verify you see 2 conversations - one with student 2 and one with student 3. Click the conversation with student 2. Verify you see the message from student 2 Verify you are unable to message this user and see a message on the view 'You are unable to message this user'. From the ellipsis menu (...) select 'Delete conversation' Refresh the page Open the messaging pane Verify you have the following counts: Favourites: 0, Group messages: 1, Messages: 1 Expand the 'Messages' section Verify you only see 1 conversation - the conversation with student 3.
    • Affected Branches:
      MOODLE_36_STABLE
    • Fixed Branches:
      MOODLE_36_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-64057-master

      Description

      At the moment we do 3 separate DB requests to count the number of individual, group, and favourite conversations. This should just be a single DB request in a single function call.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  3/Dec/18

                  Time Tracking

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 30 minutes
                  30m