|
|
@ -329,9 +329,9 @@ class Scheme < ApplicationRecord |
|
|
|
|
|
|
|
|
|
|
|
def status_at(date) |
|
|
|
def status_at(date) |
|
|
|
return :deleted if discarded_at.present? |
|
|
|
return :deleted if discarded_at.present? |
|
|
|
return :incomplete unless confirmed && locations.confirmed.any? |
|
|
|
|
|
|
|
return :deactivated if owning_organisation.status_at(date) == :deactivated || owning_organisation.status_at(date) == :merged || |
|
|
|
return :deactivated if owning_organisation.status_at(date) == :deactivated || owning_organisation.status_at(date) == :merged || |
|
|
|
(open_deactivation&.deactivation_date.present? && date >= open_deactivation.deactivation_date) |
|
|
|
(open_deactivation&.deactivation_date.present? && date >= open_deactivation.deactivation_date) |
|
|
|
|
|
|
|
return :incomplete unless confirmed && locations.confirmed.any? |
|
|
|
return :deactivating_soon if open_deactivation&.deactivation_date.present? && date < open_deactivation.deactivation_date |
|
|
|
return :deactivating_soon if open_deactivation&.deactivation_date.present? && date < open_deactivation.deactivation_date |
|
|
|
return :reactivating_soon if last_deactivation_before(date)&.reactivation_date.present? && date < last_deactivation_before(date).reactivation_date |
|
|
|
return :reactivating_soon if last_deactivation_before(date)&.reactivation_date.present? && date < last_deactivation_before(date).reactivation_date |
|
|
|
return :activating_soon if startdate.present? && date < startdate |
|
|
|
return :activating_soon if startdate.present? && date < startdate |
|
|
|