From 2e33262960967e8e795a7784e752776218e31715 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=8Dtalo=20Matos?= Date: Fri, 12 Dec 2025 01:40:31 -0300 Subject: [PATCH] Refactor: Use Rails range syntax in ActivitySpike query (#2080) Replace SQL string syntax with Rails range syntax for date filtering in the ActivitySpike::Detector. This improves code readability and follows Rails idioms. Changed from: .where("created_at >= ?", recent_period.seconds.ago) To: .where(created_at: recent_period.seconds.ago..) This modernizes the codebase while maintaining the same functionality. --- app/models/card/activity_spike/detector.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/card/activity_spike/detector.rb b/app/models/card/activity_spike/detector.rb index 1ba44f501..143561c39 100644 --- a/app/models/card/activity_spike/detector.rb +++ b/app/models/card/activity_spike/detector.rb @@ -27,7 +27,7 @@ class Card::ActivitySpike::Detector def multiple_people_commented?(minimum_comments: 3, minimum_participants: 2) card.comments - .where("created_at >= ?", recent_period.seconds.ago) + .where(created_at: recent_period.seconds.ago..) .group(:card_id) .having("COUNT(*) >= ?", minimum_comments) .having("COUNT(DISTINCT creator_id) >= ?", minimum_participants)