Browse Source

CLDC-1825 prepare bulk upload guidance (#1342)

* feat: add inset text and old template (actual link to come)

* feat: add old spec work from CLDC-1788 to avoid future conflicts, typo fix

* feat: add new files and update copy

* feat: add 23/24 spec files and update copy

* feat: specify rack version

* feat: specify rack version

* refactor: lint

* refactor: lint

* feat: fix failing tests

* db: update

* refactor: typos

* feat: update designs and add inset text

* feat: pass year to guidance page

* feat: merge with new behaviour on main
new-year-bulk-fixes
natdeanlewissoftwire 2 years ago committed by GitHub
parent
commit
eb7d73718b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      app/models/forms/bulk_upload_lettings/guidance.rb
  2. 10
      app/models/forms/bulk_upload_lettings/prepare_your_file.rb
  3. 4
      app/models/forms/bulk_upload_sales/guidance.rb
  4. 4
      app/models/forms/bulk_upload_sales/prepare_your_file.rb
  5. 2
      app/models/location.rb
  6. 2
      app/models/organisation.rb
  7. 2
      app/models/scheme.rb
  8. 8
      app/services/bulk_upload/lettings/year2022/row_parser.rb
  9. 8
      app/services/bulk_upload/lettings/year2023/row_parser.rb
  10. 20
      app/views/bulk_upload_lettings_logs/forms/prepare_your_file.html.erb
  11. 17
      app/views/bulk_upload_sales_logs/forms/prepare_your_file.html.erb

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

@ -15,6 +15,10 @@ module Forms
bulk_upload_lettings_log_path(id: "prepare-your-file", form: { year: }) bulk_upload_lettings_log_path(id: "prepare-your-file", form: { year: })
end end
def old_template_path
Forms::BulkUploadLettings::PrepareYourFile.new.old_template_path
end
def template_path def template_path
Forms::BulkUploadLettings::PrepareYourFile.new(year:).template_path Forms::BulkUploadLettings::PrepareYourFile.new(year:).template_path
end end

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

@ -25,6 +25,10 @@ module Forms
bulk_upload_lettings_log_path(id: page_id, form: { year:, needstype: }) bulk_upload_lettings_log_path(id: page_id, form: { year:, needstype: })
end end
def old_template_path
"/files/bulk-upload-lettings-template-2022-23.xlsx"
end
def template_path def template_path
case year case year
when 2022 when 2022
@ -47,6 +51,12 @@ module Forms
"#{year}/#{year + 1 - 2000}" "#{year}/#{year + 1 - 2000}"
end end
def inset_text
if year == 2022
'<p class="govuk-inset-text">For 2022/23 data, you cannot have a CSV file with both general needs logs and supported housing logs. These must be in separate files.</p>'.html_safe
end
end
def save! def save!
true true
end end

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

@ -15,6 +15,10 @@ module Forms
bulk_upload_sales_log_path(id: "prepare-your-file", form: { year: }) bulk_upload_sales_log_path(id: "prepare-your-file", form: { year: })
end end
def old_template_path
Forms::BulkUploadLettings::PrepareYourFile.new.old_template_path
end
def template_path def template_path
Forms::BulkUploadSales::PrepareYourFile.new(year:).template_path Forms::BulkUploadSales::PrepareYourFile.new(year:).template_path
end end

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

@ -23,6 +23,10 @@ module Forms
bulk_upload_sales_log_path(id: "upload-your-file", form: { year: }) bulk_upload_sales_log_path(id: "upload-your-file", form: { year: })
end end
def old_template_path
"/files/bulk-upload-sales-template-2022-23.xlsx"
end
def template_path def template_path
case year case year
when 2022 when 2022

2
app/models/location.rb

@ -53,7 +53,7 @@ class Location < ApplicationRecord
enum type_of_unit: TYPE_OF_UNIT enum type_of_unit: TYPE_OF_UNIT
def self.find_by_id_on_mulitple_fields(id) def self.find_by_id_on_multiple_fields(id)
return if id.nil? return if id.nil?
where(id:).or(where(old_visible_id: id)).first where(id:).or(where(old_visible_id: id)).first

2
app/models/organisation.rb

@ -48,7 +48,7 @@ class Organisation < ApplicationRecord
validates :name, presence: { message: I18n.t("validations.organisation.name_missing") } validates :name, presence: { message: I18n.t("validations.organisation.name_missing") }
validates :provider_type, presence: { message: I18n.t("validations.organisation.provider_type_missing") } validates :provider_type, presence: { message: I18n.t("validations.organisation.provider_type_missing") }
def self.find_by_id_on_mulitple_fields(id) def self.find_by_id_on_multiple_fields(id)
return if id.nil? return if id.nil?
if id.start_with?("ORG") if id.start_with?("ORG")

2
app/models/scheme.rb

@ -110,7 +110,7 @@ class Scheme < ApplicationRecord
enum arrangement_type: ARRANGEMENT_TYPE, _suffix: true enum arrangement_type: ARRANGEMENT_TYPE, _suffix: true
def self.find_by_id_on_mulitple_fields(id) def self.find_by_id_on_multiple_fields(id)
return if id.nil? return if id.nil?
if id.start_with?("S") if id.start_with?("S")

8
app/services/bulk_upload/lettings/year2022/row_parser.rb

@ -419,7 +419,7 @@ private
def location def location
return if scheme.nil? return if scheme.nil?
@location ||= scheme.locations.find_by_id_on_mulitple_fields(field_5) @location ||= scheme.locations.find_by_id_on_multiple_fields(field_5)
end end
def validate_location_exists def validate_location_exists
@ -860,7 +860,7 @@ private
end end
def owning_organisation def owning_organisation
Organisation.find_by_id_on_mulitple_fields(field_111) Organisation.find_by_id_on_multiple_fields(field_111)
end end
def owning_organisation_id def owning_organisation_id
@ -868,7 +868,7 @@ private
end end
def managing_organisation def managing_organisation
Organisation.find_by_id_on_mulitple_fields(field_113) Organisation.find_by_id_on_multiple_fields(field_113)
end end
def managing_organisation_id def managing_organisation_id
@ -1292,6 +1292,6 @@ private
end end
def scheme def scheme
@scheme ||= Scheme.find_by_id_on_mulitple_fields(field_4) @scheme ||= Scheme.find_by_id_on_multiple_fields(field_4)
end end
end end

8
app/services/bulk_upload/lettings/year2023/row_parser.rb

@ -1011,7 +1011,7 @@ private
end end
def owning_organisation def owning_organisation
Organisation.find_by_id_on_mulitple_fields(field_1) Organisation.find_by_id_on_multiple_fields(field_1)
end end
def owning_organisation_id def owning_organisation_id
@ -1019,7 +1019,7 @@ private
end end
def managing_organisation def managing_organisation
Organisation.find_by_id_on_mulitple_fields(field_2) Organisation.find_by_id_on_multiple_fields(field_2)
end end
def managing_organisation_id def managing_organisation_id
@ -1044,13 +1044,13 @@ private
end end
def scheme def scheme
@scheme ||= Scheme.find_by_id_on_mulitple_fields(field_16) @scheme ||= Scheme.find_by_id_on_multiple_fields(field_16)
end end
def location def location
return if scheme.nil? return if scheme.nil?
@location ||= scheme.locations.find_by_id_on_mulitple_fields(field_17) @location ||= scheme.locations.find_by_id_on_multiple_fields(field_17)
end end
def renttype def renttype

20
app/views/bulk_upload_lettings_logs/forms/prepare_your_file.html.erb

@ -10,22 +10,24 @@
<span class="govuk-caption-l">Upload lettings logs in bulk (<%= @form.year_combo %>)</span> <span class="govuk-caption-l">Upload lettings logs in bulk (<%= @form.year_combo %>)</span>
<h1 class="govuk-heading-l">Prepare your file</h1> <h1 class="govuk-heading-l">Prepare your file</h1>
<h2 class="govuk-heading-m">Create your file</h2> <h2 class="govuk-heading-s">Download template</h2>
<ul class="govuk-list govuk-list--bullet"> <ul class="govuk-list govuk-list--bullet">
<li>Download the <%= govuk_link_to "bulk lettings template", @form.template_path %></li> <li>If your organisation is new to using bulk upload or you have updated your HMS export use <%= govuk_link_to "this template (improved question ordering)", @form.template_path %></li>
<li>Export the data from your housing management system, matching the template. <%= govuk_link_to "Find out more about exporting your data", bulk_upload_lettings_log_path(id: "guidance", form: { year: @form.year }) %></li> <li>If your organisation was using bulk upload on the previous CORE website and hasn't changed its HMS to be compatible with the new CORE service, use <%= govuk_link_to "this template", @form.old_template_path %></li>
<li>If you cannot export it in this format, you may have to input it manually</li>
<li>You can not have a file with both general needs logs and supported housing logs. These must be in separate files</li>
</ul> </ul>
<h2 class="govuk-heading-m">Check your data</h2> <h2 class="govuk-heading-s">Create your file</h2>
<ul class="govuk-list govuk-list--bullet"> <ul class="govuk-list govuk-list--bullet">
<li>Check data is complete and formatted correctly, using <%= govuk_link_to "data specifications", @form.specification_path, target: "_blank" %></li> <li>Fill in the template with CORE data from your housing management system according to the <%= govuk_link_to "Lettings #{@form.year_combo} Bulk Upload Specification", @form.specification_path %></li>
<li>If you have to manually enter large volumes of data into the bulk upload template, we recommend creating logs directly in the service instead. <%= govuk_link_to "Find out more about exporting your data", bulk_upload_lettings_log_path(id: "guidance", form: { year: @form.year }) %></li>
</ul> </ul>
<h2 class="govuk-heading-m">Save your file</h2> <%= @form.inset_text %>
<h2 class="govuk-heading-s">Save your file</h2>
<ul class="govuk-list govuk-list--bullet"> <ul class="govuk-list govuk-list--bullet">
<li>Save the file (CSV format <strong>only</strong>)</li> <li>Save your file as a CSV</li>
<li>Your file should now be ready to upload</li>
</ul> </ul>
<%= f.govuk_submit %> <%= f.govuk_submit %>

17
app/views/bulk_upload_sales_logs/forms/prepare_your_file.html.erb

@ -10,21 +10,22 @@
<span class="govuk-caption-l">Upload sales logs in bulk (<%= @form.year_combo %>)</span> <span class="govuk-caption-l">Upload sales logs in bulk (<%= @form.year_combo %>)</span>
<h1 class="govuk-heading-l">Prepare your file</h1> <h1 class="govuk-heading-l">Prepare your file</h1>
<h2 class="govuk-heading-m">Create your file</h2> <h2 class="govuk-heading-s">Download template</h2>
<ul class="govuk-list govuk-list--bullet"> <ul class="govuk-list govuk-list--bullet">
<li>Download the <%= govuk_link_to "bulk sales template", @form.template_path %></li> <li>If your organisation is new to using bulk upload or you have updated your HMS export use <%= govuk_link_to "this template (improved question ordering)", @form.template_path %></li>
<li>Export the data from your housing management system, matching the template. <%= govuk_link_to "Find out more about exporting your data", bulk_upload_sales_log_path(id: "guidance", form: { year: @form.year }) %></li> <li>If your organisation was using bulk upload on the previous CORE website and hasn't changed its HMS to be compatible with the new CORE service, use <%= govuk_link_to "this template", @form.old_template_path %></li>
<li>If you cannot export it in this format, you may have to input it manually</li>
</ul> </ul>
<h2 class="govuk-heading-m">Check your data</h2> <h2 class="govuk-heading-s">Create your file</h2>
<ul class="govuk-list govuk-list--bullet"> <ul class="govuk-list govuk-list--bullet">
<li>Check data is complete and formatted correctly, using data <%= govuk_link_to "specifications", @form.specification_path, target: "_blank" %></li> <li>Fill in the template with CORE data from your housing management system according to the <%= govuk_link_to "Sales #{@form.year_combo} Bulk Upload Specification", @form.specification_path %></li>
<li>If you have to manually enter large volumes of data into the bulk upload template, we recommend creating logs directly in the service instead. <%= govuk_link_to "Find out more about exporting your data", bulk_upload_sales_log_path(id: "guidance", form: { year: @form.year }) %></li>
</ul> </ul>
<h2 class="govuk-heading-m">Save your file</h2> <h2 class="govuk-heading-s">Save your file</h2>
<ul class="govuk-list govuk-list--bullet"> <ul class="govuk-list govuk-list--bullet">
<li>Save the file (CSV format <strong>only</strong>)</li> <li>Save your file as a CSV</li>
<li>Your file should now be ready to upload</li>
</ul> </ul>
<%= f.govuk_submit %> <%= f.govuk_submit %>

Loading…
Cancel
Save