Skip to content

Commit

Permalink
FIX: N1 on group flair_url (#185)
Browse files Browse the repository at this point in the history
When loading the gamification plugin, we are also
loading all groups for the site, which can load
an upload based on flair_type for the group.
We need to include the flair_upload record
to avoid N1s
  • Loading branch information
martin-brennan authored Feb 6, 2025
1 parent 82e1c29 commit 1321ece
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions plugin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,13 @@ module ::DiscourseGamification
gamification_recalculate_scores_remaining:
DiscourseGamification::RecalculateScoresRateLimiter.remaining,
gamification_groups:
Group.all.map { |g| BasicGroupSerializer.new(g, root: false, scope: self.scope).as_json },
Group
.includes(:flair_upload)
.all
.map { |group| BasicGroupSerializer.new(group, root: false, scope: self.scope).as_json },
gamification_leaderboards:
DiscourseGamification::GamificationLeaderboard.all.map do |l|
LeaderboardSerializer.new(l, root: false).as_json
DiscourseGamification::GamificationLeaderboard.all.map do |leaderboard|
LeaderboardSerializer.new(leaderboard, root: false).as_json
end,
}
end
Expand Down

0 comments on commit 1321ece

Please sign in to comment.