Dynamic bubble timers
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user