Parametrize method instead of hanving methods hanging around

If we need more complex calculations for those we can extract again
This commit is contained in:
Jorge Manrubia
2025-06-05 15:23:15 +02:00
parent b9ec71ff84
commit e70827b2ca
+1 -9
View File
@@ -27,7 +27,7 @@ class Card::ActivitySpike::Detector
end
end
def multiple_people_commented?
def multiple_people_commented?(minimum_comments: 3, minimum_participants: 2)
card.comments
.where("created_at >= ?", recent_period.seconds.ago)
.group(:card_id)
@@ -40,14 +40,6 @@ class Card::ActivitySpike::Detector
card.entropy.auto_clean_period * 0.33
end
def minimum_participants
2
end
def minimum_comments
3
end
def card_was_just_assigned?
card.assigned? && card_was_just?(:assigned)
end