Browse Source

feat: revert bulk upload from other PR to main

CLDC-3147-update-pregnancy-for-24-25
natdeanlewissoftwire 10 months ago
parent
commit
be759ff3f7
  1. 19
      app/models/forms/bulk_upload_lettings/guidance.rb
  2. 2
      app/models/forms/bulk_upload_lettings/prepare_your_file.rb
  3. 19
      app/models/forms/bulk_upload_sales/guidance.rb
  4. 2
      app/models/forms/bulk_upload_sales/prepare_your_file.rb
  5. 16
      app/views/bulk_upload_shared/guidance.html.erb
  6. 2
      spec/requests/bulk_upload_lettings_logs_controller_spec.rb
  7. 2
      spec/requests/bulk_upload_sales_logs_controller_spec.rb

19
app/models/forms/bulk_upload_lettings/guidance.rb

@ -38,25 +38,6 @@ 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

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

@ -34,8 +34,6 @@ module Forms
case year
when 2023
"/files/bulk-upload-lettings-legacy-template-2023-24.xlsx"
when 2024
"/files/bulk-upload-lettings-legacy-template-2024-25.xlsx"
end
end

19
app/models/forms/bulk_upload_sales/guidance.rb

@ -38,25 +38,6 @@ 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

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

@ -32,8 +32,6 @@ module Forms
case year
when 2023
"/files/bulk-upload-sales-legacy-template-2023-24.xlsx"
when 2024
"/files/bulk-upload-sales-legacy-template-2024-25.xlsx"
end
end

16
app/views/bulk_upload_shared/guidance.html.erb

@ -48,23 +48,23 @@
<p class="govuk-body">You must include the headers in your file when you upload, unless your data matches the exact order of the legacy template. If you choose to remove the headers, you must also remove the blank column A.</p>
<p class="govuk-body"><strong>New template</strong>: In this template, the questions are in the same order as the 2023/24 paper form and web form. Use this template if your organisation is new to bulk upload or if your housing management system matches the new column ordering.</p>
<p class="govuk-body"><%= govuk_link_to @form.download_text("lettings", "template", "new"), @form.lettings_template_path %></p>
<p class="govuk-body"><%= govuk_link_to @form.download_text("sales", "template", "new"), @form.sales_template_path %></p>
<p class="govuk-body"><%= govuk_link_to "Download the lettings bulk upload template (2023 to 2024) – New question ordering", @form.lettings_template_path %></p>
<p class="govuk-body"><%= govuk_link_to "Download the sales bulk upload template (2023 to 2024) – New question ordering", @form.sales_template_path %></p>
<p class="govuk-body"><strong>Legacy template</strong>: In this template, the questions are in the same order as the 2022/23 template, with new questions added on to the end. Use this template if you have not updated your system to match the new template yet.</p>
<p class="govuk-body"><%= govuk_link_to @form.download_text("lettings", "template", "legacy"), @form.lettings_legacy_template_path %></p>
<p class="govuk-body"><%= govuk_link_to @form.download_text("sales", "template", "legacy"), @form.sales_legacy_template_path %></p>
<p class="govuk-body"><%= govuk_link_to "Download the lettings bulk upload template (2023 to 2024) - Legacy version", @form.lettings_legacy_template_path %></p>
<p class="govuk-body"><%= govuk_link_to "Download the sales bulk upload template (2023 to 2024) – Legacy version", @form.sales_legacy_template_path %></p>
<% else %>
<p class="govuk-body"><%= govuk_link_to @form.download_text("lettings", "template"), @form.lettings_template_path %></p>
<p class="govuk-body"><%= govuk_link_to @form.download_text("sales", "template"), @form.sales_template_path %></p>
<p class="govuk-body"><%= govuk_link_to "Download the lettings bulk upload template (2024 to 2025)", @form.lettings_template_path %></p>
<p class="govuk-body"><%= govuk_link_to "Download the sales bulk upload template (2024 to 2025)", @form.sales_template_path %></p>
<% end %>
<% end %>
<%= accordion.with_section(heading_text: "Using the bulk upload specification") do %>
<p class="govuk-body">The bulk upload specification contains the same information as the template headers, as well as more details about the accepted responses for each question. For multiple-choice questions, we use number or letter codes to represent each option, and the specification shows what answer each code represents.</p>
<p class="govuk-body">There is a separate specification for lettings and sales:</p>
<p class="govuk-body"><%= govuk_link_to @form.download_text("lettings", "specification"), @form.lettings_specification_path, target: "_blank" %></p>
<p class="govuk-body"><%= govuk_link_to @form.download_text("sales", "specification"), @form.sales_specification_path, target: "_blank" %></p>
<p class="govuk-body"><%= govuk_link_to "Download the lettings bulk upload specification (#{@form.year} to #{@form.year + 1})", @form.lettings_specification_path, target: "_blank" %></p>
<p class="govuk-body"><%= govuk_link_to "Download the sales bulk upload specification (#{@form.year} to #{@form.year + 1})", @form.sales_specification_path, target: "_blank" %></p>
<p class="govuk-body">If your upload fails because there are errors in the data, you can use the specification to help correct the errors. Having your file, the error report, and the specification open at the same time will make it easy to cross-reference field numbers and check accepted responses.</p>
<% end %>

2
spec/requests/bulk_upload_lettings_logs_controller_spec.rb

@ -45,6 +45,8 @@ RSpec.describe BulkUploadLettingsLogsController, type: :request do
describe "GET /lettings-logs/bulk-upload-logs/guidance" do
context "when not in crossover period" do
let(:expected_year) { FormHandler.instance.forms["current_lettings"].start_date.year }
it "shows guidance page with correct title" do
Timecop.freeze(2022, 1, 1) do
get "/lettings-logs/bulk-upload-logs/guidance?form%5Byear%5D=2022", params: {}

2
spec/requests/bulk_upload_sales_logs_controller_spec.rb

@ -45,6 +45,8 @@ RSpec.describe BulkUploadSalesLogsController, type: :request do
describe "GET /sales-logs/bulk-upload-logs/guidance" do
context "when not in crossover period" do
let(:expected_year) { FormHandler.instance.forms["current_sales"].start_date.year }
it "shows guidance page with correct title" do
Timecop.freeze(2022, 1, 1) do
get "/sales-logs/bulk-upload-logs/guidance?form%5Byear%5D=2022", params: {}

Loading…
Cancel
Save