Use `distinct` and `count` to generate query in `ReactionValidator` limit check

pull/32920/head
Matt Jankowski 2024-11-15 16:01:14 -05:00
parent 44d92fa4f6
commit 5dda61ff08
1 changed files with 1 additions and 1 deletions

View File

@ -23,6 +23,6 @@ class ReactionValidator < ActiveModel::Validator
end
def limit_reached?(reaction)
reaction.announcement.announcement_reactions.where.not(name: reaction.name).count('distinct name') >= LIMIT
reaction.announcement.announcement_reactions.where.not(name: reaction.name).distinct.count(:name) >= LIMIT
end
end