From f9ed29804effd435d96233c33a4e5f34de7674d4 Mon Sep 17 00:00:00 2001 From: Arthur Campbell <51094020+arfacamble@users.noreply.github.com> Date: Thu, 8 Jun 2023 09:16:13 +0100 Subject: [PATCH] push back end date of forms to allow them to continue to be edited for now. Adjust the copy about the date until when logs can be edited to keep it consistent with how things have been up until now (#1688) --- app/helpers/tasklist_helper.rb | 4 ++-- app/models/form.rb | 5 +++-- app/views/form/review.html.erb | 2 +- config/forms/2022_2023.json | 2 +- spec/helpers/tasklist_helper_spec.rb | 2 +- spec/models/form_spec.rb | 2 +- 6 files changed, 9 insertions(+), 8 deletions(-) diff --git a/app/helpers/tasklist_helper.rb b/app/helpers/tasklist_helper.rb index 678ef044f..6250f0489 100644 --- a/app/helpers/tasklist_helper.rb +++ b/app/helpers/tasklist_helper.rb @@ -31,9 +31,9 @@ module TasklistHelper def review_log_text(log) if log.collection_period_open? - link = log.sales? ? review_sales_log_path(id: log, sales_log: true) : review_lettings_log_path(log) + path = log.sales? ? review_sales_log_path(id: log, sales_log: true) : review_lettings_log_path(log) - "You can #{govuk_link_to 'review and make changes to this log', link} until #{log.form.end_date.to_formatted_s(:govuk_date)}.".html_safe + "You can #{govuk_link_to 'review and make changes to this log', path} until #{log.form.display_end_date.to_formatted_s(:govuk_date)}.".html_safe else start_year = log.startdate ? collection_start_year_for_date(log.startdate) : log.form.start_date.year diff --git a/app/models/form.rb b/app/models/form.rb index cc73d2ca6..16c896e4c 100644 --- a/app/models/form.rb +++ b/app/models/form.rb @@ -1,6 +1,6 @@ class Form attr_reader :form_definition, :sections, :subsections, :pages, :questions, - :start_date, :end_date, :type, :name, :setup_definition, + :start_date, :end_date, :display_end_date, :type, :name, :setup_definition, :setup_sections, :form_sections, :unresolved_log_redirect_page_id def initialize(form_path, start_year = "", sections_in_form = [], type = "lettings") @@ -9,7 +9,7 @@ class Form @end_date = if start_year && start_year.to_i > 2022 Time.zone.local(start_year + 1, 6, 9) else - Time.zone.local(start_year + 1, 6, 7) + Time.zone.local(start_year + 1, 8, 7) end @setup_sections = type == "sales" ? [Form::Sales::Sections::Setup.new(nil, nil, self)] : [Form::Lettings::Sections::Setup.new(nil, nil, self)] @form_sections = sections_in_form.map { |sec| sec.new(nil, nil, self) } @@ -40,6 +40,7 @@ class Form @end_date = Time.iso8601(form_definition["end_date"]) @unresolved_log_redirect_page_id = form_definition["unresolved_log_redirect_page_id"] end + @display_end_date = start_year == 2022 ? Time.zone.local(2023, 6, 9) : @end_date @name = "#{start_date.year}_#{end_date.year}_#{type}" end diff --git a/app/views/form/review.html.erb b/app/views/form/review.html.erb index c7af8972b..1e303b027 100644 --- a/app/views/form/review.html.erb +++ b/app/views/form/review.html.erb @@ -12,7 +12,7 @@ <%= content_for(:title) %>
- You can review and make changes to this log until <%= @log.form.end_date.to_formatted_s(:govuk_date) %>. + You can review and make changes to this log until <%= @log.form.display_end_date.to_formatted_s(:govuk_date) %>.
<% @log.form.sections.map do |section| %>