Include user relationship when retrieving award_emoji
What does this MR do?
Reduce timings in the grouped_awards methods or in how we're showing grouped awards later on, avoiding N+1 queries to the users table
Are there points in the code the reviewer needs to double check?
I've decide to load only the award attributes we need name
and user_id
that's avoid retrieve only database data that we're going to need and later AR instance doesn't need to populate all their attributes. Would be great if in the includes declaration we can define which attribute we expect for the user objects because the code only needs the user name. If we have something like that maybe could help to speed this up.
This method is used in the following template and there you can see we call award_user_list
which will print out the user name, that's where the N+1 query happens
What are the relevant issue numbers?
Fixes #14320 (closed)
Does this MR meet the acceptance criteria?
-
CHANGELOG entry added [ ] Documentation created/updated[ ] API support added-
Tests [ ] Added for this feature/bug-
All builds are passing
-
Conform by the style guides -
Branch has no merge conflicts with master
(if you do - rebase it please) -
Squashed related commits together