Now that’s a lot of queries …
Reproduced and checked locally, UserSerializer is making tons of SQL queries on the fly when serializing user_badge.granted_by.
I think UserSerializer is an overkill for the badges page, and BasicUserSerializer should do?
class DetailedUserBadgeSerializer < BasicUserBadgeSerializer
- has_one :granted_by
+ has_one :granted_by, serializer: BasicUserSerializer
This cut down the number of queries from 81 to 8 locally for me.
Not too familiar with the badge-related pages, will dig a bit deeper to make sure this has no other side effects before submitting a PR.