|
|
|
@ -51,9 +51,10 @@ module LocationsHelper |
|
|
|
active_periods.find {|x| x.to.nil?}.to = deactivation.deactivation_date |
|
|
|
active_periods.find {|x| x.to.nil?}.to = deactivation.deactivation_date |
|
|
|
active_periods << ActivePeriod.new(deactivation.reactivation_date, nil) |
|
|
|
active_periods << ActivePeriod.new(deactivation.reactivation_date, nil) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
filtered_active_periods = active_periods.select {|period| period.to.nil? || (period.from.present? && period.from <= period.to)} |
|
|
|
availability = "" |
|
|
|
availability = "" |
|
|
|
active_periods.each do |period| |
|
|
|
filtered_active_periods.each do |period| |
|
|
|
if period.from.present? |
|
|
|
if period.from.present? |
|
|
|
availability << "\nActive from #{period.from.to_formatted_s(:govuk_date)}" |
|
|
|
availability << "\nActive from #{period.from.to_formatted_s(:govuk_date)}" |
|
|
|
availability << " to #{(period.to - 1.day).to_formatted_s(:govuk_date)}\nDeactivated on #{period.to.to_formatted_s(:govuk_date)}" if period.to.present? |
|
|
|
availability << " to #{(period.to - 1.day).to_formatted_s(:govuk_date)}\nDeactivated on #{period.to.to_formatted_s(:govuk_date)}" if period.to.present? |
|
|
|
|