|
|
|
@ -103,10 +103,18 @@ class FormHandler
|
|
|
|
|
in_crossover_period? ? previous_collection_start_date : current_collection_start_date |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
def start_date_of_earliest_open_for_editing_collection_period |
|
|
|
|
in_edit_crossover_period? ? previous_collection_start_date : current_collection_start_date |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
def in_crossover_period?(now: Time.zone.now) |
|
|
|
|
lettings_in_crossover_period?(now:) || sales_in_crossover_period?(now:) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
def in_edit_crossover_period?(now: Time.zone.now) |
|
|
|
|
lettings_in_edit_crossover_period?(now:) || sales_in_edit_crossover_period?(now:) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
def lettings_in_crossover_period?(now: Time.zone.now) |
|
|
|
|
forms = lettings_forms.values |
|
|
|
|
forms.count { |form| now.between?(form.start_date, form.new_logs_end_date) } > 1 |
|
|
|
@ -145,6 +153,14 @@ class FormHandler
|
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
def earliest_open_for_editing_collection_start_date(now: Time.zone.now) |
|
|
|
|
if in_edit_crossover_period?(now:) |
|
|
|
|
collection_start_date(now) - 1.year |
|
|
|
|
else |
|
|
|
|
collection_start_date(now) |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
private |
|
|
|
|
|
|
|
|
|
def get_all_forms |
|
|
|
|