Browse Source

Prevent picking tenancy dates before location start date

pull/2510/head
Manny Dinssa 2 years ago committed by Manny Dinssa
parent
commit
40c2746151
  1. 2
      app/models/location.rb

2
app/models/location.rb

@ -157,7 +157,7 @@ class Location < ApplicationRecord
return :incomplete unless confirmed
return :deactivated if scheme.owning_organisation.status_at(date) == :deactivated ||
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 :deactivating_soon if open_deactivation&.deactivation_date.present? && date < open_deactivation.deactivation_date && (startdate.blank? || date >= startdate)
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

Loading…
Cancel
Save