From 6c044fd03683b4bb6928bd3c6648b2db44167f24 Mon Sep 17 00:00:00 2001 From: natdeanlewissoftwire <94526761+natdeanlewissoftwire@users.noreply.github.com> Date: Thu, 11 Jan 2024 11:23:38 +0000 Subject: [PATCH 1/6] CLDC-3034 Fix bulk upload error on empty field bug (#2135) * feat: don't add empty assignments in field_mapping_for_errors * feat: use empty arrays * feat: revert previous commit * feat: add previously failing test --- .../lettings/year2023/row_parser.rb | 10 +++++----- config/locales/en.yml | 2 +- .../lettings/year2023/row_parser_spec.rb | 18 ++++++++++++++++++ 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/app/services/bulk_upload/lettings/year2023/row_parser.rb b/app/services/bulk_upload/lettings/year2023/row_parser.rb index c1a19ef93..508ddea90 100644 --- a/app/services/bulk_upload/lettings/year2023/row_parser.rb +++ b/app/services/bulk_upload/lettings/year2023/row_parser.rb @@ -893,10 +893,10 @@ private owning_organisation_id: [:field_1], managing_organisation_id: [:field_2], renewal: [:field_6], - scheme_id: [scheme_field], - scheme: [scheme_field], - location_id: [location_field], - location: [location_field], + scheme_id: (scheme_field.present? ? [scheme_field] : nil), + scheme: (scheme_field.present? ? [scheme_field] : nil), + location_id: (location_field.present? ? [location_field] : nil), + location: (location_field.present? ? [location_field] : nil), created_by: [:field_3], needstype: [:field_4], rent_type: %i[field_5 field_10 field_11], @@ -1040,7 +1040,7 @@ private address_line2: [:field_20], town_or_city: [:field_21], county: [:field_22], - } + }.compact end def attribute_set diff --git a/config/locales/en.yml b/config/locales/en.yml index 0c7d3c58f..ef28a05a3 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -353,7 +353,7 @@ en: financial: tshortfall: outstanding_amount_not_expected: "You cannot answer the outstanding amount question if you don’t have outstanding rent or charges" - more_than_rent: "Enter a value less less than the basic rent amount" + more_than_rent: "Enter a value less than the basic rent amount" must_be_positive: "Enter a value over £0.01 as you told us there is an outstanding amount" hbrentshortfall: outstanding_amount_not_expected: "Answer must be ‘yes’ as you have answered the outstanding amount question" diff --git a/spec/services/bulk_upload/lettings/year2023/row_parser_spec.rb b/spec/services/bulk_upload/lettings/year2023/row_parser_spec.rb index 63531deb5..04044655d 100644 --- a/spec/services/bulk_upload/lettings/year2023/row_parser_spec.rb +++ b/spec/services/bulk_upload/lettings/year2023/row_parser_spec.rb @@ -617,6 +617,24 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do end end + context "when the rent range validation is triggered but the log has no scheme or location id" do + let(:attributes) do + setup_section_params.merge({ field_15: nil, + field_16: nil, + field_17: nil, + field_128: 300, + field_126: 1, + field_32: 1, + field_4: 1, + field_5: "3", + field_25: "E09000008" }) + end + + it "is not a valid row" do + expect(parser).not_to be_valid + end + end + context "when a hidden log already exists in db" do before do parser.log.status = "pending" From d5d86c90b10c5d2cb98c373b861ede2424cc5131 Mon Sep 17 00:00:00 2001 From: natdeanlewissoftwire <94526761+natdeanlewissoftwire@users.noreply.github.com> Date: Thu, 11 Jan 2024 14:34:47 +0000 Subject: [PATCH 2/6] feat: use new slot syntax (#2137) --- app/views/layouts/_footer.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/layouts/_footer.html.erb b/app/views/layouts/_footer.html.erb index cadc13db6..bf455a6cd 100644 --- a/app/views/layouts/_footer.html.erb +++ b/app/views/layouts/_footer.html.erb @@ -1,5 +1,5 @@ <%= govuk_footer do |footer| %> - <%= footer.meta do %> + <%= footer.with_meta do %>
diff --git a/app/views/start/guidance.html.erb b/app/views/start/guidance.html.erb new file mode 100644 index 000000000..127b56b3b --- /dev/null +++ b/app/views/start/guidance.html.erb @@ -0,0 +1,68 @@ +This page includes details of when a CORE log is and is not required, what to do if a tenant or buyer is reluctant to answer questions in a log, and other information about submitting logs using CORE.
+ <%= govuk_accordion do |accordion| %> + <%= accordion.with_section(heading_text: "How to create logs", expanded: true) do %> +There are 2 ways to create logs on CORE.
+You can create logs one at a time by answering questions using the online form. Click the “Create a new log” button on the logs page to create logs this way.
+You can also create many logs at once by uploading a CSV file. This might be faster than creating logs individually if your organisation has its own database and a way to export the data. Click the “Upload logs in bulk” button on the logs page to create logs this way. For more information, <%= govuk_link_to "read the full guidance on bulk upload", bulk_upload_lettings_log_path(id: "guidance", form: { year: current_collection_start_year }) %>.
+Once you have created and completed a log, there is nothing more you need to do to submit the data.
+ <% end %> + + <%= accordion.with_section(heading_text: "What scenarios require a new log?") do %> +For general needs, you should complete a log for each new tenancy intended to last 2 years or more if it is social rent or affordable rent, or of any length if it is intermediate rent.
+For supported housing, you should complete a log for each new letting of any length.
+If a new tenancy agreement is signed, create a new log.
+ <% end %> + + <%= accordion.with_section(heading_text: "Types of lettings you should create logs for") do %> +You’ll need to create a log for:
+You don’t need to create a log for:
+If a tenant or buyer is reluctant to answer questions as part of a log, you should explain that:
+If a tenant or buyer is still unwilling or unable to answer questions, select the ‘Don’t know’ or ‘Tenant/person prefers not to say’ options.
+ <% end %> + <% end %> +Use your account details to sign in.
If you need to set up a new account, speak to your organisation’s CORE data coordinator. If you don’t know who that is, <%= govuk_link_to("contact the helpdesk", GlobalConstants::HELPDESK_URL) %>.
You can <%= govuk_mail_to("dluhc.digital-services@levellingup.gov.uk", "request an account", subject: "CORE: Request a new account") %> if your organisation doesn’t have one.
- - -<%= govuk_link_to guidance_path do %>Guidance for submitting social housing lettings and sales data (CORE)<% end %>
+
We’ve sent a link to reset your password to <%= @email %>.
-You’ll only this receive this link if your email address already exists in our system.
+You’ll only receive this link if your email address already exists in our system.
If you don’t receive the email within 5 minutes, check your spam or junk folders. Try again if you still haven’t received the email.