Extract common method to query when entropy is cleaned
We were always quering auto_close_at https://37s.fizzy.37signals.com/collections/2/cards/743
This commit is contained in:
@@ -26,11 +26,19 @@ module Card::Entropy
|
||||
end
|
||||
|
||||
def subject_to_entropy?
|
||||
doing? || (auto_closing? && considering?)
|
||||
auto_reconsidering? || auto_closing?
|
||||
end
|
||||
|
||||
def auto_reconsidering?
|
||||
doing? && last_active_at
|
||||
end
|
||||
|
||||
def auto_closing?
|
||||
considering? && collection.auto_closing? && last_active_at
|
||||
end
|
||||
|
||||
def auto_close_at
|
||||
last_active_at + auto_close_period if auto_closing? && last_active_at
|
||||
last_active_at + auto_close_period if auto_closing?
|
||||
end
|
||||
|
||||
def days_until_close
|
||||
@@ -38,10 +46,14 @@ module Card::Entropy
|
||||
end
|
||||
|
||||
def auto_reconsider_at
|
||||
last_active_at + AUTO_RECONSIDER_PERIOD if last_active_at
|
||||
last_active_at + AUTO_RECONSIDER_PERIOD if auto_reconsidering?
|
||||
end
|
||||
|
||||
def days_until_reconsider
|
||||
(auto_reconsider_at.to_date - Date.current).to_i if auto_reconsider_at
|
||||
end
|
||||
|
||||
def entropy_cleaned_at
|
||||
auto_close_at || auto_reconsider_at
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user