Browse Source

Update organisation status logic to account for future start dates of the first change

pull/3057/head
Manny Dinssa 2 weeks ago
parent
commit
658208c281
  1. 4
      app/models/organisation.rb

4
app/models/organisation.rb

@ -217,8 +217,8 @@ class Organisation < ApplicationRecord
name: self[:name],
start_date: created_at,
end_date: changes.first&.dig(:start_date)&.yesterday,
status: changes.empty? ? "active" : "inactive",
)
status: changes.empty? || Time.zone.now.to_date < changes.first[:start_date] ? "active" : "inactive",
)
changes
end

Loading…
Cancel
Save