From 68da3e490715935fd1660ad91e8f0a0cb16e7191 Mon Sep 17 00:00:00 2001 From: natdeanlewissoftwire Date: Tue, 6 Feb 2024 11:53:18 +0000 Subject: [PATCH] feat: add sales guidance methods --- .../forms/bulk_upload_lettings/guidance.rb | 4 ++-- .../forms/bulk_upload_sales/guidance.rb | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/app/models/forms/bulk_upload_lettings/guidance.rb b/app/models/forms/bulk_upload_lettings/guidance.rb index 2f1c8f530..6b8e230ff 100644 --- a/app/models/forms/bulk_upload_lettings/guidance.rb +++ b/app/models/forms/bulk_upload_lettings/guidance.rb @@ -39,8 +39,8 @@ module Forms Forms::BulkUploadSales::PrepareYourFile.new(year:).specification_path end - def download_text(lettings_or_sales, file, new_or_legacy=nil) - "Download the #{lettings_or_sales} bulk upload #{file} (#{year_combo_full})#{new_or_legacy_text(new_or_legacy) if year == 2023 and new_or_legacy.present?}" + def download_text(lettings_or_sales, file, new_or_legacy = nil) + "Download the #{lettings_or_sales} bulk upload #{file} (#{year_combo_full})#{new_or_legacy_text(new_or_legacy) if (year == 2023) && new_or_legacy.present?}" end def year_combo diff --git a/app/models/forms/bulk_upload_sales/guidance.rb b/app/models/forms/bulk_upload_sales/guidance.rb index 44987cd87..225db978b 100644 --- a/app/models/forms/bulk_upload_sales/guidance.rb +++ b/app/models/forms/bulk_upload_sales/guidance.rb @@ -38,6 +38,25 @@ module Forms def sales_specification_path Forms::BulkUploadSales::PrepareYourFile.new(year:).specification_path end + + def download_text(lettings_or_sales, file, new_or_legacy = nil) + "Download the #{lettings_or_sales} bulk upload #{file} (#{year_combo_full})#{new_or_legacy_text(new_or_legacy) if (year == 2023) && new_or_legacy.present?}" + end + + def year_combo + "#{year}/#{year - 2000 + 1}" + end + + def year_combo_full + "#{year} to #{year + 1}" + end + + def new_or_legacy_text(new_or_legacy) + case new_or_legacy + when "new" then " – New question ordering" + when "legacy" then " – Legacy version" + end + end end end end