Dynamic bubble timers

This commit is contained in:
Jorge Manrubia
2025-06-05 16:11:48 +02:00
parent 0cb5b9ecd6
commit 2e60fcdf98
3 changed files with 6 additions and 4 deletions
+2 -2
View File
@@ -5,7 +5,7 @@ module EntropyHelper
def entropy_bubble_options_for(card)
{
daysBeforeReminder: Card::Entropic::ENTROPY_REMINDER_BEFORE.in_days.to_i,
daysBeforeReminder: card.entropy.days_before_reminder,
closesAt: card.entropy.auto_clean_at.iso8601,
action: card_entropy_action(card)
}
@@ -14,7 +14,7 @@ module EntropyHelper
def stalled_bubble_options_for(card)
if card.last_activity_spike_at
{
stalledAfterDays: Card::Stallable::STALLED_AFTER_LAST_SPIKE_PERIOD.in_days.to_i,
stalledAfterDays: card.entropy.days_before_reminder,
lastActivitySpikeAt: card.last_activity_spike_at.iso8601
}
end
-2
View File
@@ -1,8 +1,6 @@
module Card::Entropic
extend ActiveSupport::Concern
ENTROPY_REMINDER_BEFORE = 7.days
included do
scope :entropic_by, ->(period_name) do
left_outer_joins(collection: :entropy_configuration)
+4
View File
@@ -21,4 +21,8 @@ class Card::Entropy
def auto_clean_at
card.last_active_at + auto_clean_period
end
def days_before_reminder
(auto_clean_period * 0.25).round
end
end