Browse Source

CLDC-3661 Update year format (#2713)

* Update year combo format

* lint

* Update tests and validations

* update model tests

* Update bu list year format

* Update test
pull/2733/head v0.4.82
kosiakkatrina 5 months ago committed by GitHub
parent
commit
469211ce65
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      app/components/bulk_upload_summary_component.html.erb
  2. 2
      app/helpers/filters_helper.rb
  3. 2
      app/helpers/review_helper.rb
  4. 2
      app/helpers/tasklist_helper.rb
  5. 2
      app/models/bulk_upload.rb
  6. 2
      app/models/forms/bulk_upload_lettings/checking_file.rb
  7. 2
      app/models/forms/bulk_upload_lettings/needstype.rb
  8. 2
      app/models/forms/bulk_upload_lettings/prepare_your_file.rb
  9. 2
      app/models/forms/bulk_upload_lettings/upload_your_file.rb
  10. 2
      app/models/forms/bulk_upload_lettings/year.rb
  11. 2
      app/models/forms/bulk_upload_sales/checking_file.rb
  12. 2
      app/models/forms/bulk_upload_sales/prepare_your_file.rb
  13. 2
      app/models/forms/bulk_upload_sales/upload_your_file.rb
  14. 2
      app/models/forms/bulk_upload_sales/year.rb
  15. 10
      app/models/validations/sales/setup_validations.rb
  16. 10
      app/models/validations/setup_validations.rb
  17. 2
      app/views/bulk_upload_lettings_logs/forms/prepare_your_file_2023.html.erb
  18. 2
      app/views/bulk_upload_lettings_logs/forms/prepare_your_file_2024.html.erb
  19. 2
      app/views/bulk_upload_lettings_results/show.html.erb
  20. 2
      app/views/bulk_upload_lettings_results/summary.html.erb
  21. 2
      app/views/bulk_upload_lettings_resume/chosen.html.erb
  22. 2
      app/views/bulk_upload_lettings_resume/completed.html.erb
  23. 2
      app/views/bulk_upload_lettings_resume/confirm.html.erb
  24. 2
      app/views/bulk_upload_lettings_resume/deletion_report.html.erb
  25. 2
      app/views/bulk_upload_lettings_resume/fix_choice.html.erb
  26. 2
      app/views/bulk_upload_lettings_soft_validations_check/chosen.html.erb
  27. 2
      app/views/bulk_upload_lettings_soft_validations_check/confirm.html.erb
  28. 2
      app/views/bulk_upload_lettings_soft_validations_check/confirm_soft_errors.html.erb
  29. 2
      app/views/bulk_upload_sales_results/show.html.erb
  30. 2
      app/views/bulk_upload_sales_results/summary.html.erb
  31. 2
      app/views/bulk_upload_sales_resume/chosen.html.erb
  32. 2
      app/views/bulk_upload_sales_resume/completed.html.erb
  33. 2
      app/views/bulk_upload_sales_resume/confirm.html.erb
  34. 2
      app/views/bulk_upload_sales_resume/deletion_report.html.erb
  35. 2
      app/views/bulk_upload_sales_resume/fix_choice.html.erb
  36. 2
      app/views/bulk_upload_sales_soft_validations_check/chosen.html.erb
  37. 2
      app/views/bulk_upload_sales_soft_validations_check/confirm.html.erb
  38. 2
      app/views/bulk_upload_sales_soft_validations_check/confirm_soft_errors.html.erb
  39. 4
      config/locales/en.yml
  40. 4
      config/locales/validations/sales/setup.en.yml
  41. 2
      spec/components/bulk_upload_summary_component_spec.rb
  42. 11
      spec/features/bulk_upload_lettings_logs_spec.rb
  43. 6
      spec/features/bulk_upload_sales_logs_spec.rb
  44. 2
      spec/features/sales_log_spec.rb
  45. 12
      spec/helpers/filters_helper_spec.rb
  46. 8
      spec/helpers/tasklist_helper_spec.rb
  47. 4
      spec/models/bulk_upload_spec.rb
  48. 6
      spec/models/forms/bulk_upload_lettings/year_spec.rb
  49. 6
      spec/models/forms/bulk_upload_sales/year_spec.rb
  50. 16
      spec/models/validations/sales/setup_validations_spec.rb
  51. 30
      spec/models/validations/setup_validations_spec.rb
  52. 4
      spec/requests/bulk_upload_lettings_results_controller_spec.rb
  53. 8
      spec/requests/bulk_upload_lettings_resume_controller_spec.rb
  54. 2
      spec/requests/bulk_upload_lettings_soft_validations_check_controller_spec.rb
  55. 2
      spec/requests/bulk_upload_sales_results_controller_spec.rb
  56. 8
      spec/requests/bulk_upload_sales_resume_controller_spec.rb
  57. 2
      spec/requests/bulk_upload_sales_soft_validations_check_controller_spec.rb
  58. 2
      spec/requests/lettings_logs_controller_spec.rb
  59. 2
      spec/requests/sales_logs_controller_spec.rb

2
app/components/bulk_upload_summary_component.html.erb

@ -4,7 +4,7 @@
<header class="app-log-summary__header"> <header class="app-log-summary__header">
<h2 class="govuk-heading-m govuk-!-font-weight-regular govuk-!-margin-bottom-0 text-normal-break "> <h2 class="govuk-heading-m govuk-!-font-weight-regular govuk-!-margin-bottom-0 text-normal-break ">
<span class="govuk-!-margin-right-1"><%= bulk_upload.filename %></span> <span class="govuk-!-margin-right-1"><%= bulk_upload.filename %></span>
<span class="app-metadata app-log-summary__details" style="white-space: nowrap;"><%= bulk_upload.year %>/<%= bulk_upload.year + 1 %></span> <span class="app-metadata app-log-summary__details" style="white-space: nowrap;"><%= bulk_upload.year %> to <%= bulk_upload.year + 1 %></span>
</h2> </h2>
</header> </header>
<div class="govuk-!-margin-bottom-2"> <div class="govuk-!-margin-bottom-2">

2
app/helpers/filters_helper.rb

@ -287,7 +287,7 @@ private
end end
def year_combo(year) def year_combo(year)
"#{year}/#{year - 2000 + 1}" "#{year} to #{year + 1}"
end end
def formatted_years_filter(session_filters) def formatted_years_filter(session_filters)

2
app/helpers/review_helper.rb

@ -6,7 +6,7 @@ module ReviewHelper
"You can review and make changes to this log until #{log.form.submission_deadline.to_formatted_s(:govuk_date)}.".html_safe "You can review and make changes to this log until #{log.form.submission_deadline.to_formatted_s(:govuk_date)}.".html_safe
else else
start_year = log.startdate ? collection_start_year_for_date(log.startdate) : log.form.start_date.year start_year = log.startdate ? collection_start_year_for_date(log.startdate) : log.form.start_date.year
"This log is from the #{start_year}/#{start_year + 1} collection window, which is now closed." "This log is from the #{start_year} to #{start_year + 1} collection window, which is now closed."
end end
end end

2
app/helpers/tasklist_helper.rb

@ -55,7 +55,7 @@ module TasklistHelper
else else
start_year = log.startdate ? collection_start_year_for_date(log.startdate) : log.form.start_date.year start_year = log.startdate ? collection_start_year_for_date(log.startdate) : log.form.start_date.year
"This log is from the #{start_year}/#{start_year + 1} collection window, which is now closed." "This log is from the #{start_year} to #{start_year + 1} collection window, which is now closed."
end end
end end

2
app/models/bulk_upload.rb

@ -59,7 +59,7 @@ class BulkUpload < ApplicationRecord
end end
def year_combo def year_combo
"#{year}/#{year - 2000 + 1}" "#{year} to #{year + 1}"
end end
def end_year def end_year

2
app/models/forms/bulk_upload_lettings/checking_file.rb

@ -21,7 +21,7 @@ module Forms
end end
def year_combo def year_combo
"#{year}/#{year + 1 - 2000}" "#{year} to #{year + 1}"
end end
def save! def save!

2
app/models/forms/bulk_upload_lettings/needstype.rb

@ -28,7 +28,7 @@ module Forms
end end
def year_combo def year_combo
"#{year}/#{year + 1 - 2000}" "#{year} to #{year + 1}"
end end
def save! def save!

2
app/models/forms/bulk_upload_lettings/prepare_your_file.rb

@ -41,7 +41,7 @@ module Forms
end end
def year_combo def year_combo
"#{year}/#{year + 1 - 2000}" "#{year} to #{year + 1}"
end end
def save! def save!

2
app/models/forms/bulk_upload_lettings/upload_your_file.rb

@ -25,7 +25,7 @@ module Forms
end end
def year_combo def year_combo
"#{year}/#{year + 1 - 2000}" "#{year} to #{year + 1}"
end end
def next_path def next_path

2
app/models/forms/bulk_upload_lettings/year.rb

@ -16,7 +16,7 @@ module Forms
def options def options
possible_years.map do |year| possible_years.map do |year|
OpenStruct.new(id: year, name: "#{year}/#{year + 1}") OpenStruct.new(id: year, name: "#{year} to #{year + 1}")
end end
end end

2
app/models/forms/bulk_upload_sales/checking_file.rb

@ -21,7 +21,7 @@ module Forms
end end
def year_combo def year_combo
"#{year}/#{year + 1 - 2000}" "#{year} to #{year + 1}"
end end
def save! def save!

2
app/models/forms/bulk_upload_sales/prepare_your_file.rb

@ -40,7 +40,7 @@ module Forms
end end
def year_combo def year_combo
"#{year}/#{year + 1 - 2000}" "#{year} to #{year + 1}"
end end
def save! def save!

2
app/models/forms/bulk_upload_sales/upload_your_file.rb

@ -24,7 +24,7 @@ module Forms
end end
def year_combo def year_combo
"#{year}/#{year + 1 - 2000}" "#{year} to #{year + 1}"
end end
def next_path def next_path

2
app/models/forms/bulk_upload_sales/year.rb

@ -16,7 +16,7 @@ module Forms
def options def options
possible_years.map do |year| possible_years.map do |year|
OpenStruct.new(id: year, name: "#{year}/#{year + 1}") OpenStruct.new(id: year, name: "#{year} to #{year + 1}")
end end
end end

10
app/models/validations/sales/setup_validations.rb

@ -80,18 +80,18 @@ private
if FormHandler.instance.sales_in_crossover_period? if FormHandler.instance.sales_in_crossover_period?
I18n.t( I18n.t(
"validations.sales.setup.saledate.must_be_within.previous_and_current_collection_year", "validations.sales.setup.saledate.must_be_within.previous_and_current_collection_year",
previous_start_year_short: previous_collection_start_date.strftime("%y"), previous_start_year_short: previous_collection_start_date.strftime("%Y"),
previous_end_year_short: previous_collection_end_date.strftime("%y"), previous_end_year_short: previous_collection_end_date.strftime("%Y"),
previous_start_year_long: previous_collection_start_date.strftime("#{previous_collection_start_date.day.ordinalize} %B %Y"), previous_start_year_long: previous_collection_start_date.strftime("#{previous_collection_start_date.day.ordinalize} %B %Y"),
current_end_year_short: current_collection_end_date.strftime("%y"), current_end_year_short: current_collection_end_date.strftime("%Y"),
current_end_year_long: current_collection_end_date.strftime("#{current_collection_end_date.day.ordinalize} %B %Y"), current_end_year_long: current_collection_end_date.strftime("#{current_collection_end_date.day.ordinalize} %B %Y"),
) )
else else
I18n.t( I18n.t(
"validations.sales.setup.saledate.must_be_within.current_collection_year", "validations.sales.setup.saledate.must_be_within.current_collection_year",
current_start_year_short: current_collection_start_date.strftime("%y"), current_start_year_short: current_collection_start_date.strftime("%Y"),
current_start_year_long: current_collection_start_date.strftime("#{current_collection_start_date.day.ordinalize} %B %Y"), current_start_year_long: current_collection_start_date.strftime("#{current_collection_start_date.day.ordinalize} %B %Y"),
current_end_year_short: current_collection_end_date.strftime("%y"), current_end_year_short: current_collection_end_date.strftime("%Y"),
current_end_year_long: current_collection_end_date.strftime("#{current_collection_end_date.day.ordinalize} %B %Y"), current_end_year_long: current_collection_end_date.strftime("#{current_collection_end_date.day.ordinalize} %B %Y"),
) )
end end

10
app/models/validations/setup_validations.rb

@ -130,17 +130,17 @@ private
if FormHandler.instance.lettings_in_crossover_period? if FormHandler.instance.lettings_in_crossover_period?
I18n.t( I18n.t(
"validations.setup.startdate.previous_and_current_collection_year", "validations.setup.startdate.previous_and_current_collection_year",
previous_start_year_short: previous_collection_start_date.strftime("%y"), previous_start_year_short: previous_collection_start_date.strftime("%Y"),
previous_end_year_short: previous_collection_end_date.strftime("%y"), previous_end_year_short: previous_collection_end_date.strftime("%Y"),
previous_start_year_long: previous_collection_start_date.strftime("#{previous_collection_start_date.day.ordinalize} %B %Y"), previous_start_year_long: previous_collection_start_date.strftime("#{previous_collection_start_date.day.ordinalize} %B %Y"),
current_end_year_short: current_collection_end_date.strftime("%y"), current_end_year_short: current_collection_end_date.strftime("%Y"),
current_end_year_long:, current_end_year_long:,
) )
else else
I18n.t( I18n.t(
"validations.setup.startdate.current_collection_year", "validations.setup.startdate.current_collection_year",
current_start_year_short: current_collection_start_date.strftime("%y"), current_start_year_short: current_collection_start_date.strftime("%Y"),
current_end_year_short: current_collection_end_date.strftime("%y"), current_end_year_short: current_collection_end_date.strftime("%Y"),
current_start_year_long: current_collection_start_date.strftime("#{current_collection_start_date.day.ordinalize} %B %Y"), current_start_year_long: current_collection_start_date.strftime("#{current_collection_start_date.day.ordinalize} %B %Y"),
current_end_year_long:, current_end_year_long:,
) )

2
app/views/bulk_upload_lettings_logs/forms/prepare_your_file_2023.html.erb

@ -31,7 +31,7 @@
<li>If you are using the new template, keep the headers. If you are using the legacy template, you can either keep or remove the headers. If you remove the headers, you should also remove the blank column A.</li> <li>If you are using the new template, keep the headers. If you are using the legacy template, you can either keep or remove the headers. If you remove the headers, you should also remove the blank column A.</li>
</ul> </ul>
<%= govuk_inset_text(text: "You can upload both general needs and supported housing logs in the same file for 2023/24 data.") %> <%= govuk_inset_text(text: "You can upload both general needs and supported housing logs in the same file for 2023 to 2024 data.") %>
<h2 class="govuk-heading-s">Save your file</h2> <h2 class="govuk-heading-s">Save your file</h2>

2
app/views/bulk_upload_lettings_logs/forms/prepare_your_file_2024.html.erb

@ -27,7 +27,7 @@
<li>If you have reordered the headers, keep the headers in the file.</li> <li>If you have reordered the headers, keep the headers in the file.</li>
</ul> </ul>
<%= govuk_inset_text(text: "You can upload both general needs and supported housing logs in the same file for 2024/25 data.") %> <%= govuk_inset_text(text: "You can upload both general needs and supported housing logs in the same file for 2024 to 2025 data.") %>
<h2 class="govuk-heading-s">Save your file</h2> <h2 class="govuk-heading-s">Save your file</h2>

2
app/views/bulk_upload_lettings_results/show.html.erb

@ -6,7 +6,7 @@
<div class="govuk-grid-row"> <div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds"> <div class="govuk-grid-column-two-thirds">
<span class="govuk-caption-l">Bulk upload for lettings (<%= @bulk_upload.year_combo %>)</span> <span class="govuk-caption-l">Upload lettings logs in bulk (<%= @bulk_upload.year_combo %>)</span>
<h1 class="govuk-heading-l">We found <%= pluralize(@bulk_upload.bulk_upload_errors.count, "error") %> in your file</h1> <h1 class="govuk-heading-l">We found <%= pluralize(@bulk_upload.bulk_upload_errors.count, "error") %> in your file</h1>
<div class="govuk-body"> <div class="govuk-body">

2
app/views/bulk_upload_lettings_results/summary.html.erb

@ -2,7 +2,7 @@
<div class="govuk-grid-row"> <div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds"> <div class="govuk-grid-column-two-thirds">
<span class="govuk-caption-l">Bulk upload for lettings (<%= @bulk_upload.year_combo %>)</span> <span class="govuk-caption-l">Upload lettings logs in bulk (<%= @bulk_upload.year_combo %>)</span>
<h1 class="govuk-heading-l">Fix <%= pluralize(@bulk_upload.bulk_upload_errors.count, "error") %> and upload file again</h1> <h1 class="govuk-heading-l">Fix <%= pluralize(@bulk_upload.bulk_upload_errors.count, "error") %> and upload file again</h1>
<p class="govuk-body"> <p class="govuk-body">

2
app/views/bulk_upload_lettings_resume/chosen.html.erb

@ -4,7 +4,7 @@
<div class="govuk-grid-row"> <div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds"> <div class="govuk-grid-column-two-thirds">
<span class="govuk-caption-l">Bulk upload for lettings (<%= @bulk_upload.year_combo %>)</span> <span class="govuk-caption-l">Upload lettings logs in bulk (<%= @bulk_upload.year_combo %>)</span>
<h1 class="govuk-heading-l">You need to fix logs from your bulk upload</h1> <h1 class="govuk-heading-l">You need to fix logs from your bulk upload</h1>
<p class="govuk-body">You have chosen to create logs from your recent bulk upload. To view and complete these logs, return to the list of lettings logs.</p> <p class="govuk-body">You have chosen to create logs from your recent bulk upload. To view and complete these logs, return to the list of lettings logs.</p>

2
app/views/bulk_upload_lettings_resume/completed.html.erb

@ -4,7 +4,7 @@
<div class="govuk-grid-row"> <div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds"> <div class="govuk-grid-column-two-thirds">
<span class="govuk-caption-l">Bulk upload for lettings (<%= @bulk_upload.year_combo %>)</span> <span class="govuk-caption-l">Upload lettings logs in bulk (<%= @bulk_upload.year_combo %>)</span>
<h1 class="govuk-heading-l">These logs are complete</h1> <h1 class="govuk-heading-l">These logs are complete</h1>
<p class="govuk-body">You have created logs from your bulk upload, and the logs are complete. Return to lettings logs to view them.</p> <p class="govuk-body">You have created logs from your bulk upload, and the logs are complete. Return to lettings logs to view them.</p>

2
app/views/bulk_upload_lettings_resume/confirm.html.erb

@ -4,7 +4,7 @@
<div class="govuk-grid-row"> <div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds"> <div class="govuk-grid-column-two-thirds">
<span class="govuk-caption-l">Bulk upload for lettings (<%= @bulk_upload.year_combo %>)</span> <span class="govuk-caption-l">Upload lettings logs in bulk (<%= @bulk_upload.year_combo %>)</span>
<h1 class="govuk-heading-l">Are you sure you want to upload all logs from this bulk upload?</h1> <h1 class="govuk-heading-l">Are you sure you want to upload all logs from this bulk upload?</h1>
<p class="govuk-body"> <p class="govuk-body">

2
app/views/bulk_upload_lettings_resume/deletion_report.html.erb

@ -4,7 +4,7 @@
<div class="govuk-grid-row"> <div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds"> <div class="govuk-grid-column-two-thirds">
<span class="govuk-caption-l">Bulk upload for lettings (<%= @bulk_upload.year_combo %>)</span> <span class="govuk-caption-l">Upload lettings logs in bulk (<%= @bulk_upload.year_combo %>)</span>
<h1 class="govuk-heading-l"><%= answers_to_be_deleted_title_text(@bulk_upload) %></h1> <h1 class="govuk-heading-l"><%= answers_to_be_deleted_title_text(@bulk_upload) %></h1>
<p>The following cells contain data this is incorrect.</p> <p>The following cells contain data this is incorrect.</p>

2
app/views/bulk_upload_lettings_resume/fix_choice.html.erb

@ -3,7 +3,7 @@
<%= form_with model: @form, scope: :form, url: page_bulk_upload_lettings_resume_path(@bulk_upload, page: "fix-choice"), method: :patch do |f| %> <%= form_with model: @form, scope: :form, url: page_bulk_upload_lettings_resume_path(@bulk_upload, page: "fix-choice"), method: :patch do |f| %>
<%= f.govuk_error_summary %> <%= f.govuk_error_summary %>
<span class="govuk-caption-l">Bulk upload for lettings (<%= @bulk_upload.year_combo %>)</span> <span class="govuk-caption-l">Upload lettings logs in bulk (<%= @bulk_upload.year_combo %>)</span>
<h1 class="govuk-heading-l">How would you like to fix the errors?</h1> <h1 class="govuk-heading-l">How would you like to fix the errors?</h1>
<div class="govuk-body-l"> <div class="govuk-body-l">

2
app/views/bulk_upload_lettings_soft_validations_check/chosen.html.erb

@ -4,7 +4,7 @@
<div class="govuk-grid-row"> <div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds"> <div class="govuk-grid-column-two-thirds">
<span class="govuk-caption-l">Bulk upload for lettings (<%= @bulk_upload.year_combo %>)</span> <span class="govuk-caption-l">Upload lettings logs in bulk (<%= @bulk_upload.year_combo %>)</span>
<h1 class="govuk-heading-l">These logs are complete</h1> <h1 class="govuk-heading-l">These logs are complete</h1>
<p class="govuk-body">You have created logs from your bulk upload, and the logs are complete. Return to lettings logs to view them.</p> <p class="govuk-body">You have created logs from your bulk upload, and the logs are complete. Return to lettings logs to view them.</p>

2
app/views/bulk_upload_lettings_soft_validations_check/confirm.html.erb

@ -4,7 +4,7 @@
<div class="govuk-grid-row"> <div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds"> <div class="govuk-grid-column-two-thirds">
<span class="govuk-caption-l">Bulk upload for lettings (<%= @bulk_upload.year_combo %>)</span> <span class="govuk-caption-l">Upload lettings logs in bulk (<%= @bulk_upload.year_combo %>)</span>
<h1 class="govuk-heading-l">You have chosen to upload all logs from this bulk upload.</h1> <h1 class="govuk-heading-l">You have chosen to upload all logs from this bulk upload.</h1>
<p class="govuk-body"><%= logs_and_soft_validations_warning(@bulk_upload) %></p> <p class="govuk-body"><%= logs_and_soft_validations_warning(@bulk_upload) %></p>

2
app/views/bulk_upload_lettings_soft_validations_check/confirm_soft_errors.html.erb

@ -3,7 +3,7 @@
<div class="govuk-grid-column-two-thirds"> <div class="govuk-grid-column-two-thirds">
<%= f.govuk_error_summary %> <%= f.govuk_error_summary %>
<span class="govuk-caption-l">Bulk upload for lettings (<%= @bulk_upload.year_combo %>)</span> <span class="govuk-caption-l">Upload lettings logs in bulk (<%= @bulk_upload.year_combo %>)</span>
<h1 class="govuk-heading-l">Check these <%= pluralize(@bulk_upload.bulk_upload_errors.count, "answer") %> </h1> <h1 class="govuk-heading-l">Check these <%= pluralize(@bulk_upload.bulk_upload_errors.count, "answer") %> </h1>
<p class="govuk-body-l">Some data from your bulk upload might not be right. Check your file for any errors in the fields below.</p> <p class="govuk-body-l">Some data from your bulk upload might not be right. Check your file for any errors in the fields below.</p>

2
app/views/bulk_upload_sales_results/show.html.erb

@ -6,7 +6,7 @@
<div class="govuk-grid-row"> <div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds"> <div class="govuk-grid-column-two-thirds">
<span class="govuk-caption-l">Bulk Upload for sales (<%= @bulk_upload.year_combo %>)</span> <span class="govuk-caption-l">Upload sales logs in bulk (<%= @bulk_upload.year_combo %>)</span>
<h1 class="govuk-heading-l">We found <%= pluralize(@bulk_upload.bulk_upload_errors.count, "error") %> in your file</h1> <h1 class="govuk-heading-l">We found <%= pluralize(@bulk_upload.bulk_upload_errors.count, "error") %> in your file</h1>
<div class="govuk-body"> <div class="govuk-body">

2
app/views/bulk_upload_sales_results/summary.html.erb

@ -2,7 +2,7 @@
<div class="govuk-grid-row"> <div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds"> <div class="govuk-grid-column-two-thirds">
<span class="govuk-caption-l">Bulk upload for sales (<%= @bulk_upload.year_combo %>)</span> <span class="govuk-caption-l">Upload sales logs in bulk (<%= @bulk_upload.year_combo %>)</span>
<h1 class="govuk-heading-l">Fix <%= pluralize(@bulk_upload.bulk_upload_errors.count, "error") %> and upload file again</h1> <h1 class="govuk-heading-l">Fix <%= pluralize(@bulk_upload.bulk_upload_errors.count, "error") %> and upload file again</h1>
<p class="govuk-body"> <p class="govuk-body">

2
app/views/bulk_upload_sales_resume/chosen.html.erb

@ -4,7 +4,7 @@
<div class="govuk-grid-row"> <div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds"> <div class="govuk-grid-column-two-thirds">
<span class="govuk-caption-l">Bulk upload for sales (<%= @bulk_upload.year_combo %>)</span> <span class="govuk-caption-l">Upload sales logs in bulk (<%= @bulk_upload.year_combo %>)</span>
<h1 class="govuk-heading-l">You need to fix logs from your bulk upload</h1> <h1 class="govuk-heading-l">You need to fix logs from your bulk upload</h1>
<p class="govuk-body">You have chosen to create logs from your recent bulk upload. To view and complete these logs, return to the list of sales logs.</p> <p class="govuk-body">You have chosen to create logs from your recent bulk upload. To view and complete these logs, return to the list of sales logs.</p>

2
app/views/bulk_upload_sales_resume/completed.html.erb

@ -4,7 +4,7 @@
<div class="govuk-grid-row"> <div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds"> <div class="govuk-grid-column-two-thirds">
<span class="govuk-caption-l">Bulk upload for sales (<%= @bulk_upload.year_combo %>)</span> <span class="govuk-caption-l">Upload sales logs in bulk (<%= @bulk_upload.year_combo %>)</span>
<h1 class="govuk-heading-l">These logs are complete</h1> <h1 class="govuk-heading-l">These logs are complete</h1>
<p class="govuk-body">You have created logs from your bulk upload, and the logs are complete. Return to sales logs to view them.</p> <p class="govuk-body">You have created logs from your bulk upload, and the logs are complete. Return to sales logs to view them.</p>

2
app/views/bulk_upload_sales_resume/confirm.html.erb

@ -4,7 +4,7 @@
<div class="govuk-grid-row"> <div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds"> <div class="govuk-grid-column-two-thirds">
<span class="govuk-caption-l">Bulk upload for sales (<%= @bulk_upload.year_combo %>)</span> <span class="govuk-caption-l">Upload sales logs in bulk (<%= @bulk_upload.year_combo %>)</span>
<h1 class="govuk-heading-l">Are you sure you want to upload all logs from this bulk upload?</h1> <h1 class="govuk-heading-l">Are you sure you want to upload all logs from this bulk upload?</h1>
<p class="govuk-body"> <p class="govuk-body">

2
app/views/bulk_upload_sales_resume/deletion_report.html.erb

@ -4,7 +4,7 @@
<div class="govuk-grid-row"> <div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds"> <div class="govuk-grid-column-two-thirds">
<span class="govuk-caption-l">Bulk upload for sales (<%= @bulk_upload.year_combo %>)</span> <span class="govuk-caption-l">Upload sales logs in bulk (<%= @bulk_upload.year_combo %>)</span>
<h1 class="govuk-heading-l"><%= answers_to_be_deleted_title_text(@bulk_upload) %></h1> <h1 class="govuk-heading-l"><%= answers_to_be_deleted_title_text(@bulk_upload) %></h1>
<p>The following cells contain data this is incorrect.</p> <p>The following cells contain data this is incorrect.</p>

2
app/views/bulk_upload_sales_resume/fix_choice.html.erb

@ -3,7 +3,7 @@
<%= form_with model: @form, scope: :form, url: page_bulk_upload_sales_resume_path(@bulk_upload, page: "fix-choice"), method: :patch do |f| %> <%= form_with model: @form, scope: :form, url: page_bulk_upload_sales_resume_path(@bulk_upload, page: "fix-choice"), method: :patch do |f| %>
<%= f.govuk_error_summary %> <%= f.govuk_error_summary %>
<span class="govuk-caption-l">Bulk upload for sales (<%= @bulk_upload.year_combo %>)</span> <span class="govuk-caption-l">Upload sales logs in bulk (<%= @bulk_upload.year_combo %>)</span>
<h1 class="govuk-heading-l">How would you like to fix the errors?</h1> <h1 class="govuk-heading-l">How would you like to fix the errors?</h1>
<div class="govuk-body-l"> <div class="govuk-body-l">

2
app/views/bulk_upload_sales_soft_validations_check/chosen.html.erb

@ -4,7 +4,7 @@
<div class="govuk-grid-row"> <div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds"> <div class="govuk-grid-column-two-thirds">
<span class="govuk-caption-l">Bulk upload for sales (<%= @bulk_upload.year_combo %>)</span> <span class="govuk-caption-l">Upload sales logs in bulk (<%= @bulk_upload.year_combo %>)</span>
<h1 class="govuk-heading-l">These logs are complete</h1> <h1 class="govuk-heading-l">These logs are complete</h1>
<p class="govuk-body">You have created logs from your bulk upload, and the logs are complete. Return to sales logs to view them.</p> <p class="govuk-body">You have created logs from your bulk upload, and the logs are complete. Return to sales logs to view them.</p>

2
app/views/bulk_upload_sales_soft_validations_check/confirm.html.erb

@ -4,7 +4,7 @@
<div class="govuk-grid-row"> <div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds"> <div class="govuk-grid-column-two-thirds">
<span class="govuk-caption-l">Bulk upload for sales (<%= @bulk_upload.year_combo %>)</span> <span class="govuk-caption-l">Upload sales logs in bulk (<%= @bulk_upload.year_combo %>)</span>
<h1 class="govuk-heading-l">You have chosen to upload all logs from this bulk upload.</h1> <h1 class="govuk-heading-l">You have chosen to upload all logs from this bulk upload.</h1>
<p class="govuk-body"><%= logs_and_soft_validations_warning(@bulk_upload) %></p> <p class="govuk-body"><%= logs_and_soft_validations_warning(@bulk_upload) %></p>

2
app/views/bulk_upload_sales_soft_validations_check/confirm_soft_errors.html.erb

@ -3,7 +3,7 @@
<div class="govuk-grid-column-two-thirds"> <div class="govuk-grid-column-two-thirds">
<%= f.govuk_error_summary %> <%= f.govuk_error_summary %>
<span class="govuk-caption-l">Bulk upload for sales (<%= @bulk_upload.year_combo %>)</span> <span class="govuk-caption-l">Upload sales logs in bulk (<%= @bulk_upload.year_combo %>)</span>
<h1 class="govuk-heading-l">Check these <%= pluralize(@bulk_upload.bulk_upload_errors.count, "answer") %> </h1> <h1 class="govuk-heading-l">Check these <%= pluralize(@bulk_upload.bulk_upload_errors.count, "answer") %> </h1>
<p class="govuk-body-l">Some data from your bulk upload might not be right. Check your file for any errors in the fields below.</p> <p class="govuk-body-l">Some data from your bulk upload might not be right. Check your file for any errors in the fields below.</p>

4
config/locales/en.yml

@ -290,9 +290,9 @@ en:
startdate: startdate:
current_collection_year: current_collection_year:
"Enter a date within the %{current_start_year_short}/%{current_end_year_short} collection year, which is between %{current_start_year_long} and %{current_end_year_long}." "Enter a date within the %{current_start_year_short} to %{current_end_year_short} collection year, which is between %{current_start_year_long} and %{current_end_year_long}."
previous_and_current_collection_year: previous_and_current_collection_year:
"Enter a date within the %{previous_start_year_short}/%{previous_end_year_short} or %{previous_end_year_short}/%{current_end_year_short} collection years, which is between %{previous_start_year_long} and %{current_end_year_long}." "Enter a date within the %{previous_start_year_short} to %{previous_end_year_short} or %{previous_end_year_short} to %{current_end_year_short} collection years, which is between %{previous_start_year_long} and %{current_end_year_long}."
later_than_14_days_after: "The tenancy start date must not be later than 14 days from today’s date." later_than_14_days_after: "The tenancy start date must not be later than 14 days from today’s date."
before_scheme_end_date: "The tenancy start date must be before the end date for this supported housing scheme." before_scheme_end_date: "The tenancy start date must be before the end date for this supported housing scheme."
after_void_date: "Enter a tenancy start date that is after the void date." after_void_date: "Enter a tenancy start date that is after the void date."

4
config/locales/validations/sales/setup.en.yml

@ -7,9 +7,9 @@ en:
next_two_weeks: "Sale completion date must not be later than 14 days from today’s date." next_two_weeks: "Sale completion date must not be later than 14 days from today’s date."
must_be_within: must_be_within:
current_collection_year: current_collection_year:
"Enter a date within the %{current_start_year_short}/%{current_end_year_short} collection year, which is between %{current_start_year_long} and %{current_end_year_long}." "Enter a date within the %{current_start_year_short} to %{current_end_year_short} collection year, which is between %{current_start_year_long} and %{current_end_year_long}."
previous_and_current_collection_year: previous_and_current_collection_year:
"Enter a date within the %{previous_start_year_short}/%{previous_end_year_short} or %{previous_end_year_short}/%{current_end_year_short} collection years, which is between %{previous_start_year_long} and %{current_end_year_long}." "Enter a date within the %{previous_start_year_short} to %{previous_end_year_short} or %{previous_end_year_short} to %{current_end_year_short} collection years, which is between %{previous_start_year_long} and %{current_end_year_long}."
invalid: invalid:
merged_organisations: merged_organisations:
"Enter a date when the owning organisation was active. %{owning_organisation} became inactive on %{merge_date} and was replaced by %{absorbing_organisation}." "Enter a date when the owning organisation was active. %{owning_organisation} became inactive on %{merge_date} and was replaced by %{absorbing_organisation}."

2
spec/components/bulk_upload_summary_component_spec.rb

@ -12,7 +12,7 @@ RSpec.describe BulkUploadSummaryComponent, type: :component do
it "shows the collection year" do it "shows the collection year" do
result = render_inline(described_class.new(bulk_upload:)) result = render_inline(described_class.new(bulk_upload:))
expect(result).to have_content("2024/2025") expect(result).to have_content("2024 to 2025")
end end
it "includes a download file link" do it "includes a download file link" do

11
spec/features/bulk_upload_lettings_logs_spec.rb

@ -5,8 +5,7 @@ RSpec.describe "Bulk upload lettings log" do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:current_year) { current_collection_start_year } let(:current_year) { current_collection_start_year }
let(:current_formatted_year) { "#{current_year}/#{current_year + 1}" } let(:current_formatted_year) { "#{current_year} to #{current_year + 1}" }
let(:current_formatted_short_year) { "#{current_year}/#{current_year - 2000 + 1}" }
let(:stub_file_upload) do let(:stub_file_upload) do
vcap_services = { "aws-s3-bucket" => {} } vcap_services = { "aws-s3-bucket" => {} }
@ -47,12 +46,12 @@ RSpec.describe "Bulk upload lettings log" do
expect(page.find_field("form-year-#{current_year}-field")).to be_checked expect(page.find_field("form-year-#{current_year}-field")).to be_checked
click_button("Continue") click_button("Continue")
expect(page).to have_content("Upload lettings logs in bulk (#{current_formatted_short_year})") expect(page).to have_content("Upload lettings logs in bulk (#{current_formatted_year})")
click_button("Continue") click_button("Continue")
expect(page).not_to have_content("What is the needs type?") expect(page).not_to have_content("What is the needs type?")
expect(page).to have_content("Upload lettings logs in bulk (#{current_formatted_short_year})") expect(page).to have_content("Upload lettings logs in bulk (#{current_formatted_year})")
expect(page).to have_content("Upload your file") expect(page).to have_content("Upload your file")
click_button("Upload") click_button("Upload")
@ -88,7 +87,7 @@ RSpec.describe "Bulk upload lettings log" do
expect(page).to have_link("Upload lettings logs in bulk") expect(page).to have_link("Upload lettings logs in bulk")
click_link("Upload lettings logs in bulk") click_link("Upload lettings logs in bulk")
expect(page).to have_content("Upload lettings logs in bulk (#{current_formatted_short_year})") expect(page).to have_content("Upload lettings logs in bulk (#{current_formatted_year})")
click_button("Continue") click_button("Continue")
expect(page).to have_content("Upload your file") expect(page).to have_content("Upload your file")
@ -107,7 +106,7 @@ RSpec.describe "Bulk upload lettings log" do
expect(page).to have_content("Prepare your file") expect(page).to have_content("Prepare your file")
click_button("Continue") click_button("Continue")
expect(page).to have_content("Upload lettings logs in bulk (#{current_formatted_short_year})") expect(page).to have_content("Upload lettings logs in bulk (#{current_formatted_year})")
expect(page).to have_content("Upload your file") expect(page).to have_content("Upload your file")
click_button("Upload") click_button("Upload")

6
spec/features/bulk_upload_sales_logs_spec.rb

@ -38,7 +38,7 @@ RSpec.describe "Bulk upload sales log" do
click_button("Continue") click_button("Continue")
expect(page).to have_content("You must select a collection period to upload for") expect(page).to have_content("You must select a collection period to upload for")
choose("2023/2024") choose("2023 to 2024")
click_button("Continue") click_button("Continue")
click_link("Back") click_link("Back")
@ -46,7 +46,7 @@ RSpec.describe "Bulk upload sales log" do
expect(page.find_field("form-year-2023-field")).to be_checked expect(page.find_field("form-year-2023-field")).to be_checked
click_button("Continue") click_button("Continue")
expect(page).to have_content("Upload sales logs in bulk (2023/24)") expect(page).to have_content("Upload sales logs in bulk (2023 to 2024)")
click_button("Continue") click_button("Continue")
expect(page).to have_content("Upload your file") expect(page).to have_content("Upload your file")
@ -88,7 +88,7 @@ RSpec.describe "Bulk upload sales log" do
expect(page).to have_link("Upload sales logs in bulk") expect(page).to have_link("Upload sales logs in bulk")
click_link("Upload sales logs in bulk") click_link("Upload sales logs in bulk")
expect(page).to have_content("Upload sales logs in bulk (2023/24)") expect(page).to have_content("Upload sales logs in bulk (2023 to 2024)")
click_button("Continue") click_button("Continue")
expect(page).to have_content("Upload your file") expect(page).to have_content("Upload your file")

2
spec/features/sales_log_spec.rb

@ -191,7 +191,7 @@ RSpec.describe "Sales Log Features" do
context "when one year filter is selected" do context "when one year filter is selected" do
before do before do
check("2024") check("2024 to 2025")
click_button("Apply filters") click_button("Apply filters")
end end

12
spec/helpers/filters_helper_spec.rb

@ -491,7 +491,7 @@ RSpec.describe FiltersHelper do
it "has the correct options" do it "has the correct options" do
expect(collection_year_options).to eq( expect(collection_year_options).to eq(
{ {
"2023" => "2023/24", "2022" => "2022/23", "2021" => "2021/22" "2023" => "2023 to 2024", "2022" => "2022 to 2023", "2021" => "2021 to 2022"
}, },
) )
end end
@ -505,7 +505,7 @@ RSpec.describe FiltersHelper do
it "has the correct options" do it "has the correct options" do
expect(collection_year_options).to eq( expect(collection_year_options).to eq(
{ {
"2023" => "2023/24", "2022" => "2022/23" "2023" => "2023 to 2024", "2022" => "2022 to 2023"
}, },
) )
end end
@ -520,7 +520,7 @@ RSpec.describe FiltersHelper do
it "has the correct options" do it "has the correct options" do
expect(collection_year_options).to eq( expect(collection_year_options).to eq(
{ {
"2024" => "2024/25", "2023" => "2023/24", "2022" => "2022/23" "2024" => "2024 to 2025", "2023" => "2023 to 2024", "2022" => "2022 to 2023"
}, },
) )
end end
@ -541,7 +541,7 @@ RSpec.describe FiltersHelper do
it "has the correct options" do it "has the correct options" do
expect(collection_year_radio_options).to eq( expect(collection_year_radio_options).to eq(
{ {
"2023" => { label: "2023/24" }, "2022" => { label: "2022/23" }, "2021" => { label: "2021/22" } "2023" => { label: "2023 to 2024" }, "2022" => { label: "2022 to 2023" }, "2021" => { label: "2021 to 2022" }
}, },
) )
end end
@ -555,7 +555,7 @@ RSpec.describe FiltersHelper do
it "has the correct options" do it "has the correct options" do
expect(collection_year_radio_options).to eq( expect(collection_year_radio_options).to eq(
{ {
"2023" => { label: "2023/24" }, "2022" => { label: "2022/23" } "2023" => { label: "2023 to 2024" }, "2022" => { label: "2022 to 2023" }
}, },
) )
end end
@ -570,7 +570,7 @@ RSpec.describe FiltersHelper do
it "has the correct options" do it "has the correct options" do
expect(collection_year_radio_options).to eq( expect(collection_year_radio_options).to eq(
{ {
"2024" => { label: "2024/25" }, "2023" => { label: "2023/24" }, "2022" => { label: "2022/23" } "2024" => { label: "2024 to 2025" }, "2023" => { label: "2023 to 2024" }, "2022" => { label: "2022 to 2023" }
}, },
) )
end end

8
spec/helpers/tasklist_helper_spec.rb

@ -143,7 +143,7 @@ RSpec.describe TasklistHelper do
end end
it "returns relevant text" do it "returns relevant text" do
expect(review_log_text(sales_log)).to eq("This log is from the 2022/2023 collection window, which is now closed.") expect(review_log_text(sales_log)).to eq("This log is from the 2022 to 2023 collection window, which is now closed.")
end end
end end
@ -156,7 +156,7 @@ RSpec.describe TasklistHelper do
end end
it "returns relevant text" do it "returns relevant text" do
expect(review_log_text(sales_log)).to eq("This log is from the 2021/2022 collection window, which is now closed.") expect(review_log_text(sales_log)).to eq("This log is from the 2021 to 2022 collection window, which is now closed.")
end end
end end
end end
@ -186,7 +186,7 @@ RSpec.describe TasklistHelper do
end end
it "returns relevant text" do it "returns relevant text" do
expect(review_log_text(lettings_log)).to eq("This log is from the 2022/2023 collection window, which is now closed.") expect(review_log_text(lettings_log)).to eq("This log is from the 2022 to 2023 collection window, which is now closed.")
end end
end end
@ -199,7 +199,7 @@ RSpec.describe TasklistHelper do
end end
it "returns relevant text" do it "returns relevant text" do
expect(review_log_text(lettings_log)).to eq("This log is from the 2021/2022 collection window, which is now closed.") expect(review_log_text(lettings_log)).to eq("This log is from the 2021 to 2022 collection window, which is now closed.")
end end
end end
end end

4
spec/models/bulk_upload_spec.rb

@ -39,8 +39,8 @@ RSpec.describe BulkUpload, type: :model do
describe "year_combo" do describe "year_combo" do
[ [
{ year: 2023, expected_value: "2023/24" }, { year: 2023, expected_value: "2023 to 2024" },
{ year: 2024, expected_value: "2024/25" }, { year: 2024, expected_value: "2024 to 2025" },
].each do |test_case| ].each do |test_case|
context "when the bulk upload year is #{test_case[:year]}" do context "when the bulk upload year is #{test_case[:year]}" do
let(:bulk_upload) { build(:bulk_upload, year: test_case[:year]) } let(:bulk_upload) { build(:bulk_upload, year: test_case[:year]) }

6
spec/models/forms/bulk_upload_lettings/year_spec.rb

@ -17,7 +17,7 @@ RSpec.describe Forms::BulkUploadLettings::Year do
it "returns current and previous years" do it "returns current and previous years" do
expect(form.options.map(&:id)).to eql([2024, 2023]) expect(form.options.map(&:id)).to eql([2024, 2023])
expect(form.options.map(&:name)).to eql(%w[2024/2025 2023/2024]) expect(form.options.map(&:name)).to eql(["2024 to 2025", "2023 to 2024"])
end end
end end
@ -28,7 +28,7 @@ RSpec.describe Forms::BulkUploadLettings::Year do
it "returns the current year" do it "returns the current year" do
expect(form.options.map(&:id)).to eql([2024]) expect(form.options.map(&:id)).to eql([2024])
expect(form.options.map(&:name)).to eql(%w[2024/2025]) expect(form.options.map(&:name)).to eql(["2024 to 2025"])
end end
end end
@ -40,7 +40,7 @@ RSpec.describe Forms::BulkUploadLettings::Year do
it "returns current and next years" do it "returns current and next years" do
expect(form.options.map(&:id)).to eql([2024, 2025]) expect(form.options.map(&:id)).to eql([2024, 2025])
expect(form.options.map(&:name)).to eql(%w[2024/2025 2025/2026]) expect(form.options.map(&:name)).to eql(["2024 to 2025", "2025 to 2026"])
end end
end end
end end

6
spec/models/forms/bulk_upload_sales/year_spec.rb

@ -17,7 +17,7 @@ RSpec.describe Forms::BulkUploadSales::Year do
it "returns current and previous years" do it "returns current and previous years" do
expect(form.options.map(&:id)).to eql([2024, 2023]) expect(form.options.map(&:id)).to eql([2024, 2023])
expect(form.options.map(&:name)).to eql(%w[2024/2025 2023/2024]) expect(form.options.map(&:name)).to eql(["2024 to 2025", "2023 to 2024"])
end end
end end
@ -28,7 +28,7 @@ RSpec.describe Forms::BulkUploadSales::Year do
it "returns the current year" do it "returns the current year" do
expect(form.options.map(&:id)).to eql([2024]) expect(form.options.map(&:id)).to eql([2024])
expect(form.options.map(&:name)).to eql(%w[2024/2025]) expect(form.options.map(&:name)).to eql(["2024 to 2025"])
end end
end end
@ -44,7 +44,7 @@ RSpec.describe Forms::BulkUploadSales::Year do
it "returns current and next years" do it "returns current and next years" do
expect(form.options.map(&:id)).to eql([2024, 2025]) expect(form.options.map(&:id)).to eql([2024, 2025])
expect(form.options.map(&:name)).to eql(%w[2024/2025 2025/2026]) expect(form.options.map(&:name)).to eql(["2024 to 2025", "2025 to 2026"])
end end
end end
end end

16
spec/models/validations/sales/setup_validations_spec.rb

@ -37,7 +37,7 @@ RSpec.describe Validations::Sales::SetupValidations do
it "adds error" do it "adds error" do
setup_validator.validate_saledate_collection_year(record) setup_validator.validate_saledate_collection_year(record)
expect(record.errors[:saledate]).to include(/Enter a date within the \d{2}\/\d{2} collection year, which is between 1st April \d{4} and 31st March \d{4}/) expect(record.errors[:saledate]).to include(/Enter a date within the \d{4} to \d{4} collection year, which is between 1st April \d{4} and 31st March \d{4}/)
end end
end end
@ -47,7 +47,7 @@ RSpec.describe Validations::Sales::SetupValidations do
it "adds error" do it "adds error" do
setup_validator.validate_saledate_collection_year(record) setup_validator.validate_saledate_collection_year(record)
expect(record.errors[:saledate]).to include(/Enter a date within the \d{2}\/\d{2} collection year, which is between 1st April \d{4} and 31st March \d{4}/) expect(record.errors[:saledate]).to include(/Enter a date within the \d{4} to \d{4} collection year, which is between 1st April \d{4} and 31st March \d{4}/)
end end
end end
end end
@ -91,7 +91,7 @@ RSpec.describe Validations::Sales::SetupValidations do
it "adds error" do it "adds error" do
setup_validator.validate_saledate_collection_year(record) setup_validator.validate_saledate_collection_year(record)
expect(record.errors[:saledate]).to include("Enter a date within the 23/24 or 24/25 collection years, which is between 1st April 2023 and 31st March 2025.") expect(record.errors[:saledate]).to include("Enter a date within the 2023 to 2024 or 2024 to 2025 collection years, which is between 1st April 2023 and 31st March 2025.")
end end
end end
@ -105,7 +105,7 @@ RSpec.describe Validations::Sales::SetupValidations do
it "adds error" do it "adds error" do
setup_validator.validate_saledate_collection_year(record) setup_validator.validate_saledate_collection_year(record)
expect(record.errors[:saledate]).to include("Enter a date within the 23/24 or 24/25 collection years, which is between 1st April 2023 and 31st March 2025.") expect(record.errors[:saledate]).to include("Enter a date within the 2023 to 2024 or 2024 to 2025 collection years, which is between 1st April 2023 and 31st March 2025.")
end end
end end
@ -119,7 +119,7 @@ RSpec.describe Validations::Sales::SetupValidations do
it "cannot create new logs for the archived collection year" do it "cannot create new logs for the archived collection year" do
record.saledate = Time.zone.local(2023, 1, 1) record.saledate = Time.zone.local(2023, 1, 1)
setup_validator.validate_saledate_collection_year(record) setup_validator.validate_saledate_collection_year(record)
expect(record.errors["saledate"]).to include(match "Enter a date within the 23/24 or 24/25 collection years, which is between 1st April 2023 and 31st March 2025.") expect(record.errors["saledate"]).to include(match "Enter a date within the 2023 to 2024 or 2024 to 2025 collection years, which is between 1st April 2023 and 31st March 2025.")
end end
it "can edit already created logs for the previous collection year" do it "can edit already created logs for the previous collection year" do
@ -127,7 +127,7 @@ RSpec.describe Validations::Sales::SetupValidations do
record.save!(validate: false) record.save!(validate: false)
record.saledate = Time.zone.local(2024, 1, 1) record.saledate = Time.zone.local(2024, 1, 1)
setup_validator.validate_saledate_collection_year(record) setup_validator.validate_saledate_collection_year(record)
expect(record.errors["saledate"]).not_to include(match "Enter a date within the 24/25 collection year, which is between 1st April 2024 and 31st March 2025.") expect(record.errors["saledate"]).not_to include(match "Enter a date within the 2024 to 2025 collection year, which is between 1st April 2024 and 31st March 2025.")
end end
end end
@ -142,7 +142,7 @@ RSpec.describe Validations::Sales::SetupValidations do
record.update!(saledate: nil) record.update!(saledate: nil)
record.saledate = Time.zone.local(2023, 1, 1) record.saledate = Time.zone.local(2023, 1, 1)
setup_validator.validate_saledate_collection_year(record) setup_validator.validate_saledate_collection_year(record)
expect(record.errors["saledate"]).to include(match "Enter a date within the 23/24 or 24/25 collection years, which is between 1st April 2023 and 31st March 2025.") expect(record.errors["saledate"]).to include(match "Enter a date within the 2023 to 2024 or 2024 to 2025 collection years, which is between 1st April 2023 and 31st March 2025.")
end end
it "cannot edit already created logs for the archived collection year" do it "cannot edit already created logs for the archived collection year" do
@ -150,7 +150,7 @@ RSpec.describe Validations::Sales::SetupValidations do
record.save!(validate: false) record.save!(validate: false)
record.saledate = Time.zone.local(2023, 1, 1) record.saledate = Time.zone.local(2023, 1, 1)
setup_validator.validate_saledate_collection_year(record) setup_validator.validate_saledate_collection_year(record)
expect(record.errors["saledate"]).to include(match "Enter a date within the 23/24 or 24/25 collection years, which is between 1st April 2023 and 31st March 2025.") expect(record.errors["saledate"]).to include(match "Enter a date within the 2023 to 2024 or 2024 to 2025 collection years, which is between 1st April 2023 and 31st March 2025.")
end end
end end
end end

30
spec/models/validations/setup_validations_spec.rb

@ -7,7 +7,7 @@ RSpec.describe Validations::SetupValidations do
let(:record) { build(:lettings_log) } let(:record) { build(:lettings_log) }
describe "tenancy start date" do describe "tenancy start date" do
context "when in 22/23 collection" do context "when in 2022 to 2023 collection" do
context "when in the crossover period" do context "when in the crossover period" do
before do before do
allow(Time).to receive(:now).and_return(Time.zone.local(2022, 4, 1)) allow(Time).to receive(:now).and_return(Time.zone.local(2022, 4, 1))
@ -18,14 +18,14 @@ RSpec.describe Validations::SetupValidations do
record.startdate = Time.zone.local(2021, 1, 1) record.startdate = Time.zone.local(2021, 1, 1)
setup_validator.validate_startdate_setup(record) setup_validator.validate_startdate_setup(record)
setup_validator.validate_merged_organisations_start_date(record) setup_validator.validate_merged_organisations_start_date(record)
expect(record.errors["startdate"]).to include(match "Enter a date within the 21/22 or 22/23 collection years, which is between 1st April 2021 and 31st March 2023") expect(record.errors["startdate"]).to include(match "Enter a date within the 2021 to 2022 or 2022 to 2023 collection years, which is between 1st April 2021 and 31st March 2023")
end end
it "cannot be after the second collection window end date" do it "cannot be after the second collection window end date" do
record.startdate = Time.zone.local(2023, 7, 1, 6) record.startdate = Time.zone.local(2023, 7, 1, 6)
setup_validator.validate_startdate_setup(record) setup_validator.validate_startdate_setup(record)
setup_validator.validate_merged_organisations_start_date(record) setup_validator.validate_merged_organisations_start_date(record)
expect(record.errors["startdate"]).to include(match "Enter a date within the 21/22 or 22/23 collection years, which is between 1st April 2021 and 31st March 2023") expect(record.errors["startdate"]).to include(match "Enter a date within the 2021 to 2022 or 2022 to 2023 collection years, which is between 1st April 2021 and 31st March 2023")
end end
end end
@ -39,19 +39,19 @@ RSpec.describe Validations::SetupValidations do
record.startdate = Time.zone.local(2022, 1, 1) record.startdate = Time.zone.local(2022, 1, 1)
setup_validator.validate_startdate_setup(record) setup_validator.validate_startdate_setup(record)
setup_validator.validate_merged_organisations_start_date(record) setup_validator.validate_merged_organisations_start_date(record)
expect(record.errors["startdate"]).to include(match "Enter a date within the 22/23 collection year, which is between 1st April 2022 and 31st March 2023") expect(record.errors["startdate"]).to include(match "Enter a date within the 2022 to 2023 collection year, which is between 1st April 2022 and 31st March 2023")
end end
it "cannot be after the second collection window end date" do it "cannot be after the second collection window end date" do
record.startdate = Time.zone.local(2023, 7, 1, 6) record.startdate = Time.zone.local(2023, 7, 1, 6)
setup_validator.validate_startdate_setup(record) setup_validator.validate_startdate_setup(record)
setup_validator.validate_merged_organisations_start_date(record) setup_validator.validate_merged_organisations_start_date(record)
expect(record.errors["startdate"]).to include(match "Enter a date within the 22/23 collection year, which is between 1st April 2022 and 31st March 2023") expect(record.errors["startdate"]).to include(match "Enter a date within the 2022 to 2023 collection year, which is between 1st April 2022 and 31st March 2023")
end end
end end
end end
context "when in 23/24 collection" do context "when in 2023 to 2024 collection" do
context "when in the crossover period" do context "when in the crossover period" do
before do before do
allow(Time).to receive(:now).and_return(Time.zone.local(2023, 4, 1)) allow(Time).to receive(:now).and_return(Time.zone.local(2023, 4, 1))
@ -62,14 +62,14 @@ RSpec.describe Validations::SetupValidations do
record.startdate = Time.zone.local(2022, 1, 1) record.startdate = Time.zone.local(2022, 1, 1)
setup_validator.validate_startdate_setup(record) setup_validator.validate_startdate_setup(record)
setup_validator.validate_merged_organisations_start_date(record) setup_validator.validate_merged_organisations_start_date(record)
expect(record.errors["startdate"]).to include(match "Enter a date within the 22/23 or 23/24 collection years, which is between 1st April 2022 and 31st March 2024") expect(record.errors["startdate"]).to include(match "Enter a date within the 2022 to 2023 or 2023 to 2024 collection years, which is between 1st April 2022 and 31st March 2024")
end end
it "cannot be after the second collection window end date" do it "cannot be after the second collection window end date" do
record.startdate = Time.zone.local(2024, 7, 1, 6) record.startdate = Time.zone.local(2024, 7, 1, 6)
setup_validator.validate_startdate_setup(record) setup_validator.validate_startdate_setup(record)
setup_validator.validate_merged_organisations_start_date(record) setup_validator.validate_merged_organisations_start_date(record)
expect(record.errors["startdate"]).to include(match "Enter a date within the 22/23 or 23/24 collection years, which is between 1st April 2022 and 31st March 2024") expect(record.errors["startdate"]).to include(match "Enter a date within the 2022 to 2023 or 2023 to 2024 collection years, which is between 1st April 2022 and 31st March 2024")
end end
end end
@ -83,14 +83,14 @@ RSpec.describe Validations::SetupValidations do
record.startdate = Time.zone.local(2023, 1, 1) record.startdate = Time.zone.local(2023, 1, 1)
setup_validator.validate_startdate_setup(record) setup_validator.validate_startdate_setup(record)
setup_validator.validate_merged_organisations_start_date(record) setup_validator.validate_merged_organisations_start_date(record)
expect(record.errors["startdate"]).to include(match "Enter a date within the 23/24 collection year, which is between 1st April 2023 and 31st March 2024") expect(record.errors["startdate"]).to include(match "Enter a date within the 2023 to 2024 collection year, which is between 1st April 2023 and 31st March 2024")
end end
it "cannot be after the second collection window end date" do it "cannot be after the second collection window end date" do
record.startdate = Time.zone.local(2024, 7, 1, 6) record.startdate = Time.zone.local(2024, 7, 1, 6)
setup_validator.validate_startdate_setup(record) setup_validator.validate_startdate_setup(record)
setup_validator.validate_merged_organisations_start_date(record) setup_validator.validate_merged_organisations_start_date(record)
expect(record.errors["startdate"]).to include(match "Enter a date within the 23/24 collection year, which is between 1st April 2023 and 31st March 2024") expect(record.errors["startdate"]).to include(match "Enter a date within the 2023 to 2024 collection year, which is between 1st April 2023 and 31st March 2024")
end end
end end
@ -104,7 +104,7 @@ RSpec.describe Validations::SetupValidations do
record.startdate = Time.zone.local(2023, 1, 1) record.startdate = Time.zone.local(2023, 1, 1)
setup_validator.validate_startdate_setup(record) setup_validator.validate_startdate_setup(record)
setup_validator.validate_merged_organisations_start_date(record) setup_validator.validate_merged_organisations_start_date(record)
expect(record.errors["startdate"]).to include(match "Enter a date within the 23/24 collection year, which is between 1st April 2023 and 31st March 2024") expect(record.errors["startdate"]).to include(match "Enter a date within the 2023 to 2024 collection year, which is between 1st April 2023 and 31st March 2024")
end end
xit "can edit already created logs for the previous collection year" do xit "can edit already created logs for the previous collection year" do
@ -113,7 +113,7 @@ RSpec.describe Validations::SetupValidations do
record.startdate = Time.zone.local(2023, 1, 1) record.startdate = Time.zone.local(2023, 1, 1)
setup_validator.validate_startdate_setup(record) setup_validator.validate_startdate_setup(record)
setup_validator.validate_merged_organisations_start_date(record) setup_validator.validate_merged_organisations_start_date(record)
expect(record.errors["startdate"]).not_to include(match "Enter a date within the 23/24 collection year, which is between 1st April 2023 and 31st March 2024") expect(record.errors["startdate"]).not_to include(match "Enter a date within the 2023 to 2024 collection year, which is between 1st April 2023 and 31st March 2024")
end end
end end
@ -127,7 +127,7 @@ RSpec.describe Validations::SetupValidations do
record.startdate = Time.zone.local(2023, 1, 1) record.startdate = Time.zone.local(2023, 1, 1)
setup_validator.validate_startdate_setup(record) setup_validator.validate_startdate_setup(record)
setup_validator.validate_merged_organisations_start_date(record) setup_validator.validate_merged_organisations_start_date(record)
expect(record.errors["startdate"]).to include(match "Enter a date within the 23/24 collection year, which is between 1st April 2023 and 31st March 2024") expect(record.errors["startdate"]).to include(match "Enter a date within the 2023 to 2024 collection year, which is between 1st April 2023 and 31st March 2024")
end end
it "cannot edit already created logs for the previous collection year" do it "cannot edit already created logs for the previous collection year" do
@ -136,7 +136,7 @@ RSpec.describe Validations::SetupValidations do
record.startdate = Time.zone.local(2023, 1, 1) record.startdate = Time.zone.local(2023, 1, 1)
setup_validator.validate_startdate_setup(record) setup_validator.validate_startdate_setup(record)
setup_validator.validate_merged_organisations_start_date(record) setup_validator.validate_merged_organisations_start_date(record)
expect(record.errors["startdate"]).to include(match "Enter a date within the 23/24 collection year, which is between 1st April 2023 and 31st March 2024") expect(record.errors["startdate"]).to include(match "Enter a date within the 2023 to 2024 collection year, which is between 1st April 2023 and 31st March 2024")
end end
end end
end end
@ -157,7 +157,7 @@ RSpec.describe Validations::SetupValidations do
record.startdate = Time.zone.local(2024, 4, 1) record.startdate = Time.zone.local(2024, 4, 1)
setup_validator.validate_startdate_setup(record) setup_validator.validate_startdate_setup(record)
expect(record.errors["startdate"].length).to be >= 2 expect(record.errors["startdate"].length).to be >= 2
expect(record.errors["startdate"][0]).to eq("Enter a date within the 23/24 collection year, which is between 1st April 2023 and 31st March 2024.") expect(record.errors["startdate"][0]).to eq("Enter a date within the 2023 to 2024 collection year, which is between 1st April 2023 and 31st March 2024.")
expect(record.errors["startdate"][1]).to eq(I18n.t("validations.setup.startdate.later_than_14_days_after")) expect(record.errors["startdate"][1]).to eq(I18n.t("validations.setup.startdate.later_than_14_days_after"))
end end
end end

4
spec/requests/bulk_upload_lettings_results_controller_spec.rb

@ -16,7 +16,7 @@ RSpec.describe BulkUploadLettingsResultsController, type: :request do
get "/lettings-logs/bulk-upload-results/#{bulk_upload.id}/summary" get "/lettings-logs/bulk-upload-results/#{bulk_upload.id}/summary"
expect(response).to be_successful expect(response).to be_successful
expect(response.body).to include("Bulk upload for lettings (#{bulk_upload.year_combo})") expect(response.body).to include("Upload lettings logs in bulk (#{bulk_upload.year_combo})")
end end
it "renders the bulk upload filename" do it "renders the bulk upload filename" do
@ -90,7 +90,7 @@ RSpec.describe BulkUploadLettingsResultsController, type: :request do
get "/lettings-logs/bulk-upload-results/#{bulk_upload.id}" get "/lettings-logs/bulk-upload-results/#{bulk_upload.id}"
expect(response).to be_successful expect(response).to be_successful
expect(response.body).to include("Bulk upload for lettings (#{bulk_upload.year_combo})") expect(response.body).to include("Upload lettings logs in bulk (#{bulk_upload.year_combo})")
end end
it "renders correct number of errors" do it "renders correct number of errors" do

8
spec/requests/bulk_upload_lettings_resume_controller_spec.rb

@ -60,7 +60,7 @@ RSpec.describe BulkUploadLettingsResumeController, type: :request do
expect(response).to be_successful expect(response).to be_successful
expect(response.body).to include("Bulk upload for lettings") expect(response.body).to include("Upload lettings logs in bulk")
expect(response.body).to include(bulk_upload.year_combo) expect(response.body).to include(bulk_upload.year_combo)
expect(response.body).to include("View the error report") expect(response.body).to include("View the error report")
expect(response.body).to include("How would you like to fix the errors?") expect(response.body).to include("How would you like to fix the errors?")
@ -120,7 +120,7 @@ RSpec.describe BulkUploadLettingsResumeController, type: :request do
expect(response).to be_successful expect(response).to be_successful
expect(response.body).to include("Bulk upload for lettings") expect(response.body).to include("Upload lettings logs in bulk")
expect(response.body).to include("Cancel") expect(response.body).to include("Cancel")
end end
end end
@ -218,7 +218,7 @@ RSpec.describe BulkUploadLettingsResumeController, type: :request do
expect(response).to be_successful expect(response).to be_successful
expect(response.body).to include("Bulk upload for lettings") expect(response.body).to include("Upload lettings logs in bulk")
expect(response.body).to include(bulk_upload.year_combo) expect(response.body).to include(bulk_upload.year_combo)
expect(response.body).to include("These 2 answers will be deleted if you upload the log") expect(response.body).to include("These 2 answers will be deleted if you upload the log")
expect(response.body).to include(bulk_upload.filename) expect(response.body).to include(bulk_upload.filename)
@ -260,7 +260,7 @@ RSpec.describe BulkUploadLettingsResumeController, type: :request do
expect(response).to be_successful expect(response).to be_successful
expect(response.body).to include("Bulk upload for lettings") expect(response.body).to include("Upload lettings logs in bulk")
expect(response.body).to include(bulk_upload.year_combo) expect(response.body).to include(bulk_upload.year_combo)
expect(response.body).to include("These 2 answers will be deleted if you upload the log") expect(response.body).to include("These 2 answers will be deleted if you upload the log")
expect(response.body).to include(bulk_upload.filename) expect(response.body).to include(bulk_upload.filename)

2
spec/requests/bulk_upload_lettings_soft_validations_check_controller_spec.rb

@ -14,7 +14,7 @@ RSpec.describe BulkUploadLettingsSoftValidationsCheckController, type: :request
it "shows the soft validation errors with confirmation question" do it "shows the soft validation errors with confirmation question" do
get "/lettings-logs/bulk-upload-soft-validations-check/#{bulk_upload.id}/confirm-soft-errors" get "/lettings-logs/bulk-upload-soft-validations-check/#{bulk_upload.id}/confirm-soft-errors"
expect(response.body).to include("Bulk upload for lettings") expect(response.body).to include("Upload lettings logs in bulk")
expect(response.body).to include(bulk_upload.year_combo) expect(response.body).to include(bulk_upload.year_combo)
expect(response.body).to include("Check these 2 answers") expect(response.body).to include("Check these 2 answers")
expect(response.body).to include(bulk_upload.filename) expect(response.body).to include(bulk_upload.filename)

2
spec/requests/bulk_upload_sales_results_controller_spec.rb

@ -52,7 +52,7 @@ RSpec.describe BulkUploadSalesResultsController, type: :request do
get "/sales-logs/bulk-upload-results/#{bulk_upload.id}" get "/sales-logs/bulk-upload-results/#{bulk_upload.id}"
expect(response).to be_successful expect(response).to be_successful
expect(response.body).to include("Bulk Upload for sales (#{bulk_upload.year_combo})") expect(response.body).to include("Upload sales logs in bulk (#{bulk_upload.year_combo})")
end end
it "renders correct number of errors" do it "renders correct number of errors" do

8
spec/requests/bulk_upload_sales_resume_controller_spec.rb

@ -60,7 +60,7 @@ RSpec.describe BulkUploadSalesResumeController, type: :request do
expect(response).to be_successful expect(response).to be_successful
expect(response.body).to include("Bulk upload for sales") expect(response.body).to include("Upload sales logs in bulk")
expect(response.body).to include(bulk_upload.year_combo) expect(response.body).to include(bulk_upload.year_combo)
expect(response.body).to include("View the error report") expect(response.body).to include("View the error report")
expect(response.body).to include("How would you like to fix the errors?") expect(response.body).to include("How would you like to fix the errors?")
@ -120,7 +120,7 @@ RSpec.describe BulkUploadSalesResumeController, type: :request do
expect(response).to be_successful expect(response).to be_successful
expect(response.body).to include("Bulk upload for sales") expect(response.body).to include("Upload sales logs in bulk")
expect(response.body).to include("Cancel") expect(response.body).to include("Cancel")
end end
end end
@ -218,7 +218,7 @@ RSpec.describe BulkUploadSalesResumeController, type: :request do
expect(response).to be_successful expect(response).to be_successful
expect(response.body).to include("Bulk upload for sales") expect(response.body).to include("Upload sales logs in bulk")
expect(response.body).to include(bulk_upload.year_combo) expect(response.body).to include(bulk_upload.year_combo)
expect(response.body).to include("These 2 answers will be deleted if you upload the log") expect(response.body).to include("These 2 answers will be deleted if you upload the log")
expect(response.body).to include(bulk_upload.filename) expect(response.body).to include(bulk_upload.filename)
@ -260,7 +260,7 @@ RSpec.describe BulkUploadSalesResumeController, type: :request do
expect(response).to be_successful expect(response).to be_successful
expect(response.body).to include("Bulk upload for sales") expect(response.body).to include("Upload sales logs in bulk")
expect(response.body).to include(bulk_upload.year_combo) expect(response.body).to include(bulk_upload.year_combo)
expect(response.body).to include("These 2 answers will be deleted if you upload the log") expect(response.body).to include("These 2 answers will be deleted if you upload the log")
expect(response.body).to include(bulk_upload.filename) expect(response.body).to include(bulk_upload.filename)

2
spec/requests/bulk_upload_sales_soft_validations_check_controller_spec.rb

@ -14,7 +14,7 @@ RSpec.describe BulkUploadSalesSoftValidationsCheckController, type: :request do
it "shows the soft validation errors with confirmation question" do it "shows the soft validation errors with confirmation question" do
get "/sales-logs/bulk-upload-soft-validations-check/#{bulk_upload.id}/confirm-soft-errors" get "/sales-logs/bulk-upload-soft-validations-check/#{bulk_upload.id}/confirm-soft-errors"
expect(response.body).to include("Bulk upload for sales") expect(response.body).to include("Upload sales logs in bulk")
expect(response.body).to include(bulk_upload.year_combo) expect(response.body).to include(bulk_upload.year_combo)
expect(response.body).to include("Check these 2 answers") expect(response.body).to include("Check these 2 answers")
expect(response.body).to include(bulk_upload.filename) expect(response.body).to include(bulk_upload.filename)

2
spec/requests/lettings_logs_controller_spec.rb

@ -1202,7 +1202,7 @@ RSpec.describe LettingsLogsController, type: :request do
it "displays a closed collection window message for previous collection year logs" do it "displays a closed collection window message for previous collection year logs" do
follow_redirect! follow_redirect!
expect(page).to have_content(/This log is from the \d{4}\/\d{4} collection window, which is now closed\./) expect(page).to have_content(/This log is from the \d{4} to \d{4} collection window, which is now closed\./)
end end
end end

2
spec/requests/sales_logs_controller_spec.rb

@ -954,7 +954,7 @@ RSpec.describe SalesLogsController, type: :request do
expect(completed_sales_log.form.new_logs_end_date).to eq(Time.zone.local(2022, 12, 31)) expect(completed_sales_log.form.new_logs_end_date).to eq(Time.zone.local(2022, 12, 31))
expect(completed_sales_log.status).to eq("completed") expect(completed_sales_log.status).to eq("completed")
follow_redirect! follow_redirect!
expect(page).to have_content("This log is from the 2021/2022 collection window, which is now closed.") expect(page).to have_content("This log is from the 2021 to 2022 collection window, which is now closed.")
end end
end end
end end

Loading…
Cancel
Save