9124310f28
At the moment we cannot see weather a user left a project due to their membership expiring of if they themselves opted to leave the project. This adds a new event type that allows us to make this differentiation. Note that is not really feasable to go back and reliably fix up the previous events. As a result the events for previous expire removals will remain the same however events of this nature going forward will be correctly represented.
19 lines
323 B
Ruby
19 lines
323 B
Ruby
module Expirable
|
|
extend ActiveSupport::Concern
|
|
|
|
included do
|
|
scope :expired, -> { where('expires_at <= ?', Time.current) }
|
|
end
|
|
|
|
def expired?
|
|
expires? && expires_at <= Time.current
|
|
end
|
|
|
|
def expires?
|
|
expires_at.present?
|
|
end
|
|
|
|
def expires_soon?
|
|
expires? && expires_at < 7.days.from_now
|
|
end
|
|
end
|