From 93cf84edca8cb40c8105a37d5f188e3a3846c029 Mon Sep 17 00:00:00 2001 From: kosiakkatrina <54268893+kosiakkatrina@users.noreply.github.com> Date: Mon, 22 Jul 2024 16:51:07 +0100 Subject: [PATCH 1/9] CLDC-3027 Remove unused admin user code (#2524) * Remove leftover admin user code * Fix flaky tests --- app/views/devise/sessions/new.html.erb | 6 +----- config/initializers/rack_attack.rb | 6 ------ spec/factories/admin_user.rb | 9 --------- spec/models/sales_log_spec.rb | 4 +--- spec/models/scheme_spec.rb | 2 +- 5 files changed, 3 insertions(+), 24 deletions(-) delete mode 100644 spec/factories/admin_user.rb diff --git a/app/views/devise/sessions/new.html.erb b/app/views/devise/sessions/new.html.erb index aeb260b96..440eeb624 100644 --- a/app/views/devise/sessions/new.html.erb +++ b/app/views/devise/sessions/new.html.erb @@ -1,8 +1,4 @@ -<% if resource_name == :admin_user %> - <% title = "Sign in to your CORE administration account" %> -<% else %> - <% title = "Sign in to your account to submit CORE data" %> -<% end %> +<% title = "Sign in to your account to submit CORE data" %> <% content_for :title, title %> diff --git a/config/initializers/rack_attack.rb b/config/initializers/rack_attack.rb index 99efcbc7d..c4394e508 100644 --- a/config/initializers/rack_attack.rb +++ b/config/initializers/rack_attack.rb @@ -17,12 +17,6 @@ Rack::Attack.throttle("password reset requests", limit: 5, period: 60.seconds) d end end -Rack::Attack.throttle("admin password reset requests", limit: 5, period: 60.seconds) do |request| - if request.params["admin_user"].present? && request.path == "/admin/password" && request.post? - request.params["admin_user"]["email"].to_s.downcase.gsub(/\s+/, "") - end -end - Rack::Attack.throttled_responder = lambda do |_env| headers = { "Location" => "/429", diff --git a/spec/factories/admin_user.rb b/spec/factories/admin_user.rb deleted file mode 100644 index 74f9a96b5..000000000 --- a/spec/factories/admin_user.rb +++ /dev/null @@ -1,9 +0,0 @@ -FactoryBot.define do - factory :admin_user do - sequence(:email) { |i| "admin#{i}@example.com" } - password { "pAssword1" } - phone { "07563867654" } - created_at { Time.zone.now } - updated_at { Time.zone.now } - end -end diff --git a/spec/models/sales_log_spec.rb b/spec/models/sales_log_spec.rb index f0440f530..ddc696be4 100644 --- a/spec/models/sales_log_spec.rb +++ b/spec/models/sales_log_spec.rb @@ -892,7 +892,7 @@ RSpec.describe SalesLog, type: :model do end context "when searching logs" do - let!(:sales_log_to_search) { create(:sales_log, purchid: "to search", postcode_full: "ME0 0WW") } + let!(:sales_log_to_search) { create(:sales_log, purchid: "to search", postcode_full: "ME0 0WW", id: 4_843_695) } before do create_list(:sales_log, 5, :completed) @@ -934,8 +934,6 @@ RSpec.describe SalesLog, type: :model do describe "#search_by" do it "allows searching using ID" do - sales_log_to_search.id += 30_000 - sales_log_to_search.save! result = described_class.search_by(sales_log_to_search.id.to_s) expect(result.count).to eq(1) expect(result.first.id).to eq sales_log_to_search.id diff --git a/spec/models/scheme_spec.rb b/spec/models/scheme_spec.rb index a04e7d465..9b3db15a4 100644 --- a/spec/models/scheme_spec.rb +++ b/spec/models/scheme_spec.rb @@ -23,7 +23,7 @@ RSpec.describe Scheme, type: :model do end describe "scopes" do - let!(:scheme_1) { FactoryBot.create(:scheme) } + let!(:scheme_1) { FactoryBot.create(:scheme, id: 583_964) } let!(:scheme_2) { FactoryBot.create(:scheme) } let!(:location) { FactoryBot.create(:location, :export, scheme: scheme_1) } let!(:location_2) { FactoryBot.create(:location, scheme: scheme_2, postcode: "NE4 6TR", name: "second location") } From a4a83908ae251347128d4fa5bb2b82c2b645fa34 Mon Sep 17 00:00:00 2001 From: kosiakkatrina <54268893+kosiakkatrina@users.noreply.github.com> Date: Tue, 23 Jul 2024 16:48:29 +0100 Subject: [PATCH 2/9] Refactor locations/index page (#2523) --- app/helpers/tab_nav_helper.rb | 10 ++++++++- app/views/locations/index.html.erb | 34 +++++++++++------------------ spec/helpers/tab_nav_helper_spec.rb | 5 ++--- 3 files changed, 24 insertions(+), 25 deletions(-) diff --git a/app/helpers/tab_nav_helper.rb b/app/helpers/tab_nav_helper.rb index 27542094d..6ed9fe2ab 100644 --- a/app/helpers/tab_nav_helper.rb +++ b/app/helpers/tab_nav_helper.rb @@ -7,7 +7,15 @@ module TabNavHelper [govuk_link_to(link_text, user), "User #{user.email}"].join("\n") end - def location_cell_postcode(location, link) + def location_cell_postcode(location, scheme) + link = if location.confirmed + scheme_location_path(scheme, location) + elsif location.postcode.present? + scheme_location_check_answers_path(scheme, location, route: "locations") + else + scheme_location_postcode_path(scheme, location) + end + link_text = location.postcode || "Add postcode" [govuk_link_to(link_text, link, method: :patch), "Location"].join("\n") end diff --git a/app/views/locations/index.html.erb b/app/views/locations/index.html.erb index 88b17321e..78a362332 100644 --- a/app/views/locations/index.html.erb +++ b/app/views/locations/index.html.erb @@ -16,46 +16,38 @@ <%= render partial: "organisations/headings", locals: { main: @scheme.service_name, sub: nil } %>
- <%= render SubNavigationComponent.new(items: scheme_items(request.path, @scheme.id)) %> - <%= render partial: "locations/location_filters" %>

Locations

<%= render SearchComponent.new(current_user:, search_label: "Search by location name or postcode", value: @searched) %> - <%= govuk_section_break(visible: true, size: "m") %> <%= govuk_table do |table| %> <%= table.with_caption(classes: %w[govuk-!-font-size-19 govuk-!-font-weight-regular]) do |caption| %> - <%= render(SearchResultCaptionComponent.new(searched: @searched, count: @pagy.count, item_label:, total_count: @total_count, item: "locations", filters_count: applied_filters_count(@filter_type))) %> + <%= render(SearchResultCaptionComponent.new( + searched: @searched, + count: @pagy.count, + item_label:, + total_count: @total_count, + item: "locations", + filters_count: applied_filters_count(@filter_type), + )) %> <% end %> <%= table.with_head do |head| %> <%= head.with_row do |row| %> - <% row.with_cell(header: true, text: "Postcode", html_attributes: { - scope: "col", - }) %> - <% row.with_cell(header: true, text: "Name", html_attributes: { - scope: "col", - }) %> - <% row.with_cell(header: true, text: "Location code", html_attributes: { - scope: "col", - }) %> - <% row.with_cell(header: true, text: "Status", html_attributes: { - scope: "col", - }) %> + <% row.with_cell(header: true, text: "Postcode", html_attributes: { scope: "col" }) %> + <% row.with_cell(header: true, text: "Name", html_attributes: { scope: "col" }) %> + <% row.with_cell(header: true, text: "Location code", html_attributes: { scope: "col" }) %> + <% row.with_cell(header: true, text: "Status", html_attributes: { scope: "col" }) %> <% end %> <% end %> <% @locations.each do |location| %> <%= table.with_body do |body| %> <%= body.with_row do |row| %> - <% row.with_cell(text: simple_format(location_cell_postcode(location, if location.confirmed - scheme_location_path(@scheme, location) - else - location.postcode.present? ? scheme_location_check_answers_path(@scheme, location, route: "locations") : scheme_location_postcode_path(@scheme, location) - end), { class: "govuk-!-font-weight-bold" }, wrapper_tag: "div")) %> + <% row.with_cell(text: simple_format(location_cell_postcode(location, @scheme), { class: "govuk-!-font-weight-bold" }, wrapper_tag: "div")) %> <% row.with_cell(text: location.name) %> <% row.with_cell(text: location.id) %> <% row.with_cell(text: status_tag_from_resource(location)) %> diff --git a/spec/helpers/tab_nav_helper_spec.rb b/spec/helpers/tab_nav_helper_spec.rb index 9dbf92e7a..173a58b54 100644 --- a/spec/helpers/tab_nav_helper_spec.rb +++ b/spec/helpers/tab_nav_helper_spec.rb @@ -22,9 +22,8 @@ RSpec.describe TabNavHelper do describe "#location_cell" do it "returns the location link to the postcode with optional name" do - link = "/schemes/#{location.scheme.id}/locations/#{location.id}/edit" - expected_html = "#{location.postcode}\nLocation" - expect(location_cell_postcode(location, link)).to match(expected_html) + expected_html = "#{location.postcode}\nLocation" + expect(location_cell_postcode(location, scheme)).to match(expected_html) end end From b9f900c98e56524e149984c23f56ae27e7b84a42 Mon Sep 17 00:00:00 2001 From: kosiakkatrina <54268893+kosiakkatrina@users.noreply.github.com> Date: Wed, 24 Jul 2024 13:59:21 +0100 Subject: [PATCH 3/9] CLDC-3550 Fix rent_type 2024 BU mapping (#2501) * Fix rent_type 2024 BU mapping * Correct rent_type values * Reuse rent_type mapping * Track updated bulk uploads * Fix test --- app/models/bulk_upload.rb | 2 +- .../lettings/year2024/row_parser.rb | 15 +- app/services/bulk_upload/sales/log_creator.rb | 2 +- .../20240715072421_add_rent_fix_status.rb | 5 + db/schema.rb | 3 +- lib/tasks/correct_noint_value.rake | 24 -- lib/tasks/correct_rent_type_value.rake | 21 ++ spec/factories/bulk_upload.rb | 2 +- spec/lib/tasks/correct_noint_value_spec.rb | 87 ------ .../lib/tasks/correct_rent_type_value_spec.rb | 256 ++++++++++++++++++ .../lettings/year2024/row_parser_spec.rb | 50 ++-- 11 files changed, 324 insertions(+), 143 deletions(-) create mode 100644 db/migrate/20240715072421_add_rent_fix_status.rb delete mode 100644 lib/tasks/correct_noint_value.rake create mode 100644 lib/tasks/correct_rent_type_value.rake delete mode 100644 spec/lib/tasks/correct_noint_value_spec.rb create mode 100644 spec/lib/tasks/correct_rent_type_value_spec.rb diff --git a/app/models/bulk_upload.rb b/app/models/bulk_upload.rb index a1b656f49..7af43ee28 100644 --- a/app/models/bulk_upload.rb +++ b/app/models/bulk_upload.rb @@ -1,6 +1,6 @@ class BulkUpload < ApplicationRecord enum log_type: { lettings: "lettings", sales: "sales" } - enum noint_fix_status: { not_applied: "not_applied", applied: "applied", not_needed: "not_needed" } + enum rent_type_fix_status: { not_applied: "not_applied", applied: "applied", not_needed: "not_needed" } belongs_to :user diff --git a/app/services/bulk_upload/lettings/year2024/row_parser.rb b/app/services/bulk_upload/lettings/year2024/row_parser.rb index 16e876384..b912c167b 100644 --- a/app/services/bulk_upload/lettings/year2024/row_parser.rb +++ b/app/services/bulk_upload/lettings/year2024/row_parser.rb @@ -12,7 +12,7 @@ class BulkUpload::Lettings::Year2024::RowParser field_8: "What is the tenancy start date?", field_9: "What is the tenancy start date?", field_10: "What is the tenancy start date?", - field_11: "Is this a London Affordable Rent letting?", + field_11: "What is the rent type?", field_12: "Which 'Other' type of Intermediate Rent is this letting?", field_13: "What is the tenant code?", field_14: "What is the property reference?", @@ -136,6 +136,15 @@ class BulkUpload::Lettings::Year2024::RowParser field_130: "What do you expect the outstanding amount to be?", }.freeze + RENT_TYPE_BU_MAPPING = { + 1 => 0, + 2 => 1, + 3 => 2, + 4 => 3, + 5 => 4, + 6 => 5, + }.freeze + attribute :bulk_upload attribute :block_log_creation, :boolean, default: -> { false } @@ -280,7 +289,7 @@ class BulkUpload::Lettings::Year2024::RowParser category: :setup, }, inclusion: { - in: (0..5).to_a, + in: (1..6).to_a, message: I18n.t("validations.invalid_option", question: "rent type"), unless: -> { field_11.blank? }, category: :setup, @@ -1134,7 +1143,7 @@ private attributes["assigned_to"] = assigned_to || bulk_upload.user attributes["created_by"] = bulk_upload.user attributes["needstype"] = field_4 - attributes["rent_type"] = field_11 + attributes["rent_type"] = RENT_TYPE_BU_MAPPING[field_11] attributes["startdate"] = startdate attributes["unittype_gn"] = field_26 attributes["builtype"] = field_27 diff --git a/app/services/bulk_upload/sales/log_creator.rb b/app/services/bulk_upload/sales/log_creator.rb index 9f3a00fc9..aeb3f66c4 100644 --- a/app/services/bulk_upload/sales/log_creator.rb +++ b/app/services/bulk_upload/sales/log_creator.rb @@ -7,7 +7,7 @@ class BulkUpload::Sales::LogCreator end def call - @bulk_upload.update!(noint_fix_status: BulkUpload.noint_fix_statuses[:not_needed]) + @bulk_upload.update!(rent_type_fix_status: BulkUpload.rent_type_fix_statuses[:not_needed]) row_parsers.each do |row_parser| row_parser.valid? diff --git a/db/migrate/20240715072421_add_rent_fix_status.rb b/db/migrate/20240715072421_add_rent_fix_status.rb new file mode 100644 index 000000000..18733499c --- /dev/null +++ b/db/migrate/20240715072421_add_rent_fix_status.rb @@ -0,0 +1,5 @@ +class AddRentFixStatus < ActiveRecord::Migration[7.0] + def change + add_column :bulk_uploads, :rent_type_fix_status, :string, default: "not_applied" + end +end diff --git a/db/schema.rb b/db/schema.rb index 66693435f..8aeca4b3d 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.0].define(version: 2024_06_10_142812) do +ActiveRecord::Schema[7.0].define(version: 2024_07_15_072421) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -42,6 +42,7 @@ ActiveRecord::Schema[7.0].define(version: 2024_06_10_142812) do t.text "choice" t.integer "total_logs_count" t.string "noint_fix_status", default: "not_applied" + t.string "rent_type_fix_status", default: "not_applied" t.index ["identifier"], name: "index_bulk_uploads_on_identifier", unique: true t.index ["user_id"], name: "index_bulk_uploads_on_user_id" end diff --git a/lib/tasks/correct_noint_value.rake b/lib/tasks/correct_noint_value.rake deleted file mode 100644 index 354daa8c1..000000000 --- a/lib/tasks/correct_noint_value.rake +++ /dev/null @@ -1,24 +0,0 @@ -desc "Alter noint values for bulk uploaded sales logs where these have not been set in the service" -task correct_noint_value: :environment do - update_counts = { - in_progress: 0, - completed: 0, - pending: 0, - deleted: 0, - } - affected_uploads = BulkUpload.where(log_type: "sales", noint_fix_status: BulkUpload.noint_fix_statuses[:not_applied]) - affected_uploads.each do |upload| - upload.logs.where(noint: 2).each do |log| - noint_at_upload = log.versions.length == 1 ? log.noint : log.versions.first.next.reify.noint - next unless noint_at_upload == 2 - - Rails.logger.info("Updating noint value on log #{log.id}, owning org #{log.owning_organisation_id}") - update_counts[log.status.to_sym] += 1 - log.noint = 1 - log.skip_update_status = true - log.save! - end - upload.update!(noint_fix_status: BulkUpload.noint_fix_statuses[:applied]) - end - Rails.logger.info("Logs updated; #{update_counts}") -end diff --git a/lib/tasks/correct_rent_type_value.rake b/lib/tasks/correct_rent_type_value.rake new file mode 100644 index 000000000..1d43383c7 --- /dev/null +++ b/lib/tasks/correct_rent_type_value.rake @@ -0,0 +1,21 @@ +desc "Alter rent_type values for bulk uploaded lettings logs for 2024 where they were not mapped correctly" +task correct_rent_type_value: :environment do + affected_uploads = BulkUpload.where(log_type: "lettings", year: 2024, rent_type_fix_status: BulkUpload.rent_type_fix_statuses[:not_applied]) + affected_uploads.each do |upload| + upload.logs.where.not(rent_type: nil).each do |log| + current_rent_type = log.rent_type + rent_type_at_upload = log.versions.length == 1 ? log.rent_type : log.versions.first.next.reify.rent_type + next unless rent_type_at_upload == current_rent_type + + new_rent_type_value = BulkUpload::Lettings::Year2024::RowParser::RENT_TYPE_BU_MAPPING[rent_type_at_upload] + log.rent_type = new_rent_type_value + log.skip_update_status = true if log.status == "pending" + if log.save + Rails.logger.info("Log #{log.id} rent_type updated from #{rent_type_at_upload} to #{log.rent_type}") + else + Rails.logger.error("Log #{log.id} rent_type could not be updated from #{rent_type_at_upload} to #{log.rent_type}. Error: #{log.errors.full_messages.join(', ')}") + end + end + upload.update!(rent_type_fix_status: BulkUpload.rent_type_fix_statuses[:applied]) + end +end diff --git a/spec/factories/bulk_upload.rb b/spec/factories/bulk_upload.rb index f7d81ab7a..c848fb071 100644 --- a/spec/factories/bulk_upload.rb +++ b/spec/factories/bulk_upload.rb @@ -8,7 +8,7 @@ FactoryBot.define do identifier { SecureRandom.uuid } sequence(:filename) { |n| "bulk-upload-#{n}.csv" } needstype { 1 } - noint_fix_status { BulkUpload.noint_fix_statuses.values.sample } + rent_type_fix_status { BulkUpload.rent_type_fix_statuses.values.sample } trait(:sales) do log_type { BulkUpload.log_types[:sales] } diff --git a/spec/lib/tasks/correct_noint_value_spec.rb b/spec/lib/tasks/correct_noint_value_spec.rb deleted file mode 100644 index 51dd7779c..000000000 --- a/spec/lib/tasks/correct_noint_value_spec.rb +++ /dev/null @@ -1,87 +0,0 @@ -require "rails_helper" -require "rake" - -RSpec.describe "correct_noint_value" do - describe ":correct_noint_value", type: :task do - subject(:task) { Rake::Task["correct_noint_value"] } - - before do - Rake.application.rake_require("tasks/correct_noint_value") - Rake::Task.define_task(:environment) - task.reenable - end - - context "when the rake task is run" do - context "and there is a sales bulk upload with the fix needed" do - let(:bulk_upload) { create(:bulk_upload, :sales, noint_fix_status: BulkUpload.noint_fix_statuses[:not_applied]) } - - before do - bulk_upload.save! - end - - it "updates the noint value on a log with noint = 2 where it was set to 2 on create" do - log = create(:sales_log, :completed, noint: 2, bulk_upload:) - - task.invoke - log.reload - - expect(log.noint).to be(1) - end - - it "updates the noint value on a log with noint = 2 where it was set to 2 on create and other fields have since changed" do - log = create(:sales_log, :in_progress, noint: 2, bulk_upload:) - log.update!(status: Log.statuses[:completed]) - - task.invoke - log.reload - - expect(log.noint).to be(1) - end - - it "does not update the noint value on a log that has noint = 1" do - log = create(:sales_log, :completed, noint: 2, bulk_upload:) - log.update!(noint: 1) - - task.invoke - log.reload - - expect(log.noint).to be(1) - end - - it "does not update the noint value on a log with noint = 2 where noint was nil on create" do - log = create(:sales_log, :completed, noint: nil, bulk_upload:) - log.update!(noint: 2) - - task.invoke - log.reload - - expect(log.noint).to be(2) - end - - it "updates the noint_fix_status value on the bulk upload" do - task.invoke - bulk_upload.reload - - expect(bulk_upload.noint_fix_status).to eq(BulkUpload.noint_fix_statuses[:applied]) - end - end - - context "and there is a sales bulk upload with the fix marked as not needed" do - let(:bulk_upload) { create(:bulk_upload, :sales, noint_fix_status: BulkUpload.noint_fix_statuses[:not_needed]) } - - before do - bulk_upload.save! - end - - it "does not update the noint values on logs" do - log = create(:sales_log, :completed, noint: 2, bulk_upload:) - - task.invoke - log.reload - - expect(log.noint).to be(2) - end - end - end - end -end diff --git a/spec/lib/tasks/correct_rent_type_value_spec.rb b/spec/lib/tasks/correct_rent_type_value_spec.rb new file mode 100644 index 000000000..adccda405 --- /dev/null +++ b/spec/lib/tasks/correct_rent_type_value_spec.rb @@ -0,0 +1,256 @@ +require "rails_helper" +require "rake" + +RSpec.describe "correct_rent_type_value" do + describe ":correct_rent_type_value", type: :task do + subject(:task) { Rake::Task["correct_rent_type_value"] } + + before do + Rake.application.rake_require("tasks/correct_rent_type_value") + Rake::Task.define_task(:environment) + task.reenable + end + + context "when the rake task is run" do + context "and rent_type is 1" do + let(:bulk_upload) { create(:bulk_upload, :lettings, year: 2024, rent_type_fix_status: BulkUpload.rent_type_fix_statuses[:not_applied]) } + let(:bulk_upload_2023) { create(:bulk_upload, :lettings, year: 2023, rent_type_fix_status: BulkUpload.rent_type_fix_statuses[:not_applied]) } + + before do + bulk_upload.save! + end + + it "updates the rent_type value on a log where it was set to 1 on create" do + log = create(:lettings_log, :completed, rent_type: 1, bulk_upload:) + initial_updated_at = log.updated_at + + task.invoke + log.reload + + expect(log.rent_type).to be(0) + expect(log.status).to eq("completed") + expect(log.updated_at).not_to eq(initial_updated_at) + expect(bulk_upload.reload.rent_type_fix_status).to eq(BulkUpload.rent_type_fix_statuses[:applied]) + end + + it "updates the rent_type value on a pending log where it was set to 1 on create" do + log = build(:lettings_log, :completed, rent_type: 1, bulk_upload:, status: "pending") + log.skip_update_status = true + log.save! + initial_updated_at = log.updated_at + expect(log.status).to eq("pending") + + task.invoke + log.reload + + expect(log.rent_type).to be(0) + expect(log.status).to eq("pending") + expect(log.updated_at).not_to eq(initial_updated_at) + expect(bulk_upload.reload.rent_type_fix_status).to eq(BulkUpload.rent_type_fix_statuses[:applied]) + end + + it "updates the rent_type value on a deleted log where it was set to 1 on create" do + log = create(:lettings_log, :completed, rent_type: 1, bulk_upload:, discarded_at: Time.zone.yesterday) + initial_updated_at = log.updated_at + expect(log.status).to eq("deleted") + + task.invoke + log.reload + + expect(log.rent_type).to be(0) + expect(log.status).to eq("deleted") + expect(log.updated_at).not_to eq(initial_updated_at) + expect(bulk_upload.reload.rent_type_fix_status).to eq(BulkUpload.rent_type_fix_statuses[:applied]) + end + + it "updates the rent_type value on a log where it was set to 1 on create and other fields have since changed" do + log = create(:lettings_log, :completed, rent_type: 1, bulk_upload:) + log.update!(tenancycode: "abc") + initial_updated_at = log.updated_at + + task.invoke + log.reload + + expect(log.rent_type).to be(0) + expect(log.status).to eq("completed") + expect(log.updated_at).not_to eq(initial_updated_at) + expect(bulk_upload.reload.rent_type_fix_status).to eq(BulkUpload.rent_type_fix_statuses[:applied]) + end + + it "does not update the rent_type value on a log if it has since been changed" do + log = create(:lettings_log, :completed, rent_type: 1, bulk_upload:) + log.update!(rent_type: 0) + initial_updated_at = log.updated_at + + task.invoke + log.reload + + expect(log.rent_type).to be(0) + expect(log.status).to eq("completed") + expect(log.updated_at).to eq(initial_updated_at) + end + + it "does not update the rent_type value on a 2023 log turned 2024" do + log = build(:lettings_log, :completed, startdate: Time.zone.local(2023, 6, 6), rent_type: 1, bulk_upload: bulk_upload_2023) + log.save!(validate: false) + log.address_line1_input = log.address_line1 + log.postcode_full_input = log.postcode_full + log.nationality_all_group = 826 + log.uprn = "10033558653" + log.uprn_selection = 1 + log.startdate = Time.zone.today + log.save! + + initial_updated_at = log.updated_at + + task.invoke + log.reload + + expect(log.rent_type).to be(1) + expect(log.updated_at).to eq(initial_updated_at) + end + + it "does not update and logs error if a validation triggers" do + log = build(:lettings_log, :completed, startdate: Time.zone.local(2021, 6, 6), rent_type: 1, bulk_upload:) + log.save!(validate: false) + initial_updated_at = log.updated_at + + expect(Rails.logger).to receive(:error).with(/Log #{log.id} rent_type could not be updated from 1 to 0. Error: /) + task.invoke + log.reload + + expect(log.rent_type).to be(1) + expect(log.updated_at).to eq(initial_updated_at) + end + + context "when the rent_type_fix_status is not_needed" do + let(:bulk_upload) { create(:bulk_upload, :lettings, year: 2024, rent_type_fix_status: BulkUpload.rent_type_fix_statuses[:not_needed]) } + + before do + bulk_upload.save! + end + + it "does not update the rent_type values on logs" do + log = create(:lettings_log, :completed, rent_type: 1, bulk_upload:) + initial_updated_at = log.updated_at + + task.invoke + log.reload + + expect(log.rent_type).to be(1) + expect(log.updated_at).to eq(initial_updated_at) + expect(bulk_upload.reload.rent_type_fix_status).to eq(BulkUpload.rent_type_fix_statuses[:not_needed]) + end + end + end + + context "and rent_type is 2" do + let(:bulk_upload) { create(:bulk_upload, :lettings, year: 2024, rent_type_fix_status: BulkUpload.rent_type_fix_statuses[:not_applied]) } + let(:bulk_upload_2023) { create(:bulk_upload, :lettings, year: 2023, rent_type_fix_status: BulkUpload.rent_type_fix_statuses[:not_applied]) } + + before do + bulk_upload.save! + end + + it "updates the rent_type value on a log where it was set to 2 on create" do + log = create(:lettings_log, :completed, rent_type: 2, bulk_upload:) + initial_updated_at = log.updated_at + + task.invoke + log.reload + + expect(log.rent_type).to be(1) + expect(log.status).to eq("completed") + expect(log.updated_at).not_to eq(initial_updated_at) + end + + it "updates the rent_type value on a pending log where it was set to 2 on create" do + log = build(:lettings_log, :completed, rent_type: 2, bulk_upload:, status: "pending") + log.skip_update_status = true + log.save! + initial_updated_at = log.updated_at + expect(log.status).to eq("pending") + + task.invoke + log.reload + + expect(log.rent_type).to be(1) + expect(log.status).to eq("pending") + expect(log.updated_at).not_to eq(initial_updated_at) + end + + it "updates the rent_type value on a deleted log where it was set to 2 on create" do + log = create(:lettings_log, :completed, rent_type: 2, bulk_upload:, discarded_at: Time.zone.yesterday) + initial_updated_at = log.updated_at + expect(log.status).to eq("deleted") + + task.invoke + log.reload + + expect(log.rent_type).to be(1) + expect(log.status).to eq("deleted") + expect(log.updated_at).not_to eq(initial_updated_at) + end + + it "updates the rent_type value on a log where it was set to 2 on create and other fields have since changed" do + log = create(:lettings_log, :completed, rent_type: 2, bulk_upload:) + log.update!(tenancycode: "abc") + initial_updated_at = log.updated_at + + task.invoke + log.reload + + expect(log.rent_type).to be(1) + expect(log.status).to eq("completed") + expect(log.updated_at).not_to eq(initial_updated_at) + end + + it "does not update the rent_type value on a log if it has since been changed" do + log = create(:lettings_log, :completed, rent_type: 2, bulk_upload:) + log.update!(rent_type: 0) + initial_updated_at = log.updated_at + + task.invoke + log.reload + + expect(log.rent_type).to be(0) + expect(log.status).to eq("completed") + expect(log.updated_at).to eq(initial_updated_at) + end + + it "does not update the rent_type value on a 2023 log turned 2024" do + log = build(:lettings_log, :completed, startdate: Time.zone.local(2023, 6, 6), rent_type: 2, bulk_upload: bulk_upload_2023) + log.save!(validate: false) + log.address_line1_input = log.address_line1 + log.postcode_full_input = log.postcode_full + log.nationality_all_group = 826 + log.uprn = "10033558653" + log.uprn_selection = 1 + log.startdate = Time.zone.today + log.save! + + initial_updated_at = log.updated_at + + task.invoke + log.reload + + expect(log.rent_type).to be(2) + expect(log.updated_at).to eq(initial_updated_at) + end + + it "does not update and logs error if a validation triggers" do + log = build(:lettings_log, :completed, startdate: Time.zone.local(2021, 6, 6), rent_type: 2, bulk_upload:) + log.save!(validate: false) + initial_updated_at = log.updated_at + + expect(Rails.logger).to receive(:error).with(/Log #{log.id} rent_type could not be updated from 2 to 1. Error: /) + task.invoke + log.reload + + expect(log.rent_type).to be(2) + expect(log.updated_at).to eq(initial_updated_at) + end + end + end + end +end diff --git a/spec/services/bulk_upload/lettings/year2024/row_parser_spec.rb b/spec/services/bulk_upload/lettings/year2024/row_parser_spec.rb index e53850d1c..fbff000fd 100644 --- a/spec/services/bulk_upload/lettings/year2024/row_parser_spec.rb +++ b/spec/services/bulk_upload/lettings/year2024/row_parser_spec.rb @@ -24,7 +24,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do field_8: now.day.to_s, field_9: now.month.to_s, field_10: now.strftime("%g"), - field_11: "0", + field_11: "1", field_15: "1", } end @@ -136,7 +136,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do field_22: "2TD", field_1: owning_org.old_visible_id, field_2: managing_org.old_visible_id, - field_11: "0", + field_11: "1", field_7: "2", field_26: "2", field_27: "1", @@ -412,7 +412,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do let(:attributes) do valid_attributes.merge({ field_5: "S#{scheme.id}", field_4: "2", - field_11: "1", + field_11: "2", field_6: location.old_visible_id, field_1: owning_org.old_visible_id, field_122: 0, @@ -461,7 +461,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do let(:attributes) do valid_attributes.merge({ field_5: "S#{scheme.id}", field_4: "2", - field_11: "1", + field_11: "2", field_6: location.old_visible_id, field_1: owning_org.old_visible_id, field_122: 0, @@ -471,7 +471,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do let(:attributes_too) do valid_attributes.merge({ field_5: "S#{scheme.id}", field_4: "2", - field_11: "1", + field_11: "2", field_6: location.old_visible_id, field_1: owning_org.old_visible_id, field_122: 0, @@ -554,7 +554,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do let(:attributes) do valid_attributes.merge({ field_5: "S#{scheme.id}", field_4: "2", - field_11: "1", + field_11: "2", field_6: location.id, field_1: owning_org.old_visible_id, field_122: 0, @@ -603,7 +603,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do let(:attributes) do valid_attributes.merge({ field_5: "S#{scheme.id}", field_4: "2", - field_11: "1", + field_11: "2", field_6: location.id, field_1: owning_org.old_visible_id, field_122: 0, @@ -613,7 +613,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do let(:attributes_too) do valid_attributes.merge({ field_5: "S#{scheme.id}", field_4: "2", - field_11: "1", + field_11: "2", field_6: location.id, field_1: owning_org.old_visible_id, field_122: 0, @@ -665,7 +665,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do field_123: 1, field_29: 1, field_4: 1, - field_11: "1", + field_11: "2", field_23: "E09000008" }) end @@ -712,7 +712,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do allow(FeatureToggle).to receive(:bulk_upload_duplicate_log_check_enabled?).and_return(true) end - let(:attributes) { valid_attributes.merge(field_11: "0.00") } + let(:attributes) { valid_attributes.merge(field_11: "1.00") } it "returns true" do expect(parser).to be_valid @@ -724,7 +724,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do allow(FeatureToggle).to receive(:bulk_upload_duplicate_log_check_enabled?).and_return(true) end - let(:attributes) { valid_attributes.merge(field_11: "0.56") } + let(:attributes) { valid_attributes.merge(field_11: "1.56") } it "returns false" do expect(parser).not_to be_valid @@ -872,7 +872,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do describe "#field_5, field_6" do # scheme and location fields context "when nullable not permitted" do - let(:attributes) { { bulk_upload:, field_4: "2", field_11: "1", field_5: nil, field_6: nil } } + let(:attributes) { { bulk_upload:, field_4: "2", field_11: "2", field_5: nil, field_6: nil } } it "cannot be nulled" do parser.valid? @@ -882,7 +882,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do end context "when nullable permitted" do - let(:attributes) { { bulk_upload:, field_4: "1", field_11: "0", field_5: nil, field_6: nil } } + let(:attributes) { { bulk_upload:, field_4: "1", field_11: "1", field_5: nil, field_6: nil } } it "can be nulled" do parser.valid? @@ -900,7 +900,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do end context "when matching scheme cannot be found" do - let(:attributes) { { bulk_upload:, field_1: owning_org.old_visible_id, field_2: owning_org.old_visible_id, field_4: "2", field_11: "1", field_5: "S123", field_6: location.id } } + let(:attributes) { { bulk_upload:, field_1: owning_org.old_visible_id, field_2: owning_org.old_visible_id, field_4: "2", field_11: "2", field_5: "S123", field_6: location.id } } it "returns a setup error" do expect(parser.errors.where(:field_5, category: :setup).map(&:message)).to eq(["This scheme code does not belong to the owning organisation or managing organisation"]) @@ -909,7 +909,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do end context "when missing location" do - let(:attributes) { { bulk_upload:, field_1: owning_org.old_visible_id, field_2: owning_org.old_visible_id, field_4: "2", field_11: "1", field_5: "S#{scheme.id}", field_6: nil } } + let(:attributes) { { bulk_upload:, field_1: owning_org.old_visible_id, field_2: owning_org.old_visible_id, field_4: "2", field_11: "2", field_5: "S#{scheme.id}", field_6: nil } } it "returns a setup error" do expect(parser.errors[:field_5]).to be_blank @@ -919,7 +919,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do end context "when matching location cannot be found" do - let(:attributes) { { bulk_upload:, field_1: owning_org.old_visible_id, field_2: owning_org.old_visible_id, field_4: "2", field_11: "1", field_5: "S#{scheme.id}", field_6: "123" } } + let(:attributes) { { bulk_upload:, field_1: owning_org.old_visible_id, field_2: owning_org.old_visible_id, field_4: "2", field_11: "2", field_5: "S#{scheme.id}", field_6: "123" } } it "returns a setup error" do expect(parser.errors[:field_5]).to be_blank @@ -928,7 +928,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do end context "when matching location exists" do - let(:attributes) { { bulk_upload:, field_1: owning_org.old_visible_id, field_2: owning_org.old_visible_id, field_4: "2", field_11: "1", field_5: "S#{scheme.id}", field_6: location.id } } + let(:attributes) { { bulk_upload:, field_1: owning_org.old_visible_id, field_2: owning_org.old_visible_id, field_4: "2", field_11: "2", field_5: "S#{scheme.id}", field_6: location.id } } it "does not return an error" do expect(parser.errors[:field_5]).to be_blank @@ -948,7 +948,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do context "when location exists but not related" do let(:other_scheme) { create(:scheme, :with_old_visible_id) } let(:other_location) { create(:location, :with_old_visible_id, scheme: other_scheme) } - let(:attributes) { { bulk_upload:, field_1: owning_org.old_visible_id, field_2: owning_org.old_visible_id, field_4: "2", field_11: "1", field_5: "S#{scheme.id}", field_6: other_location.id } } + let(:attributes) { { bulk_upload:, field_1: owning_org.old_visible_id, field_2: owning_org.old_visible_id, field_4: "2", field_11: "2", field_5: "S#{scheme.id}", field_6: other_location.id } } it "returns a setup error" do expect(parser.errors[:field_5]).to be_blank @@ -959,7 +959,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do context "when scheme belongs to someone else" do let(:other_scheme) { create(:scheme, :with_old_visible_id) } let(:other_location) { create(:location, :with_old_visible_id, scheme: other_scheme) } - let(:attributes) { { bulk_upload:, field_4: "2", field_11: "1", field_5: "S#{other_scheme.id}", field_6: other_location.id, field_1: owning_org.old_visible_id, field_2: owning_org.old_visible_id } } + let(:attributes) { { bulk_upload:, field_4: "2", field_11: "2", field_5: "S#{other_scheme.id}", field_6: other_location.id, field_1: owning_org.old_visible_id, field_2: owning_org.old_visible_id } } it "returns a setup error" do expect(parser.errors.where(:field_5, category: :setup).map(&:message)).to eq(["This scheme code does not belong to the owning organisation or managing organisation"]) @@ -968,7 +968,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do end context "when scheme belongs to owning org" do - let(:attributes) { { bulk_upload:, field_4: "2", field_11: "1", field_5: "S#{scheme.id}", field_6: location.id, field_1: owning_org.old_visible_id, field_2: owning_org.old_visible_id } } + let(:attributes) { { bulk_upload:, field_4: "2", field_11: "2", field_5: "S#{scheme.id}", field_6: location.id, field_1: owning_org.old_visible_id, field_2: owning_org.old_visible_id } } it "does not return an error" do expect(parser.errors[:field_5]).to be_blank @@ -979,7 +979,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do context "when scheme belongs to managing org" do let(:managing_org_scheme) { create(:scheme, :with_old_visible_id, owning_organisation: managing_org) } let(:managing_org_location) { create(:location, :with_old_visible_id, scheme: managing_org_scheme) } - let(:attributes) { { bulk_upload:, field_4: "2", field_11: "1", field_5: "S#{managing_org_scheme.id}", field_6: managing_org_location.id, field_2: managing_org.old_visible_id } } + let(:attributes) { { bulk_upload:, field_4: "2", field_11: "2", field_5: "S#{managing_org_scheme.id}", field_6: managing_org_location.id, field_2: managing_org.old_visible_id } } it "clears the scheme answer" do expect(parser.errors[:field_5]).to include("You must answer scheme name") @@ -989,7 +989,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do context "when matching location exists but is incomplete" do let(:incomplete_location) { create(:location, :with_old_visible_id, :incomplete, scheme:) } - let(:attributes) { { bulk_upload:, field_1: owning_org.old_visible_id, field_2: owning_org.old_visible_id, field_4: "2", field_11: "1", field_5: "S#{scheme.id}", field_6: incomplete_location.id } } + let(:attributes) { { bulk_upload:, field_1: owning_org.old_visible_id, field_2: owning_org.old_visible_id, field_4: "2", field_11: "2", field_5: "S#{scheme.id}", field_6: incomplete_location.id } } it "returns a setup error for scheme" do expect(parser.errors.where(:field_5).map(&:message)).to eq(["This location is incomplete. Select another location or update this one"]) @@ -1253,7 +1253,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do describe "fields 7, 8, 9 => startdate" do context "when any one of these fields is blank" do - let(:attributes) { { bulk_upload:, field_11: "0", field_8: nil, field_9: nil, field_10: nil } } + let(:attributes) { { bulk_upload:, field_11: "1", field_8: nil, field_9: nil, field_10: nil } } it "returns an error" do parser.valid? @@ -1273,7 +1273,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do end context "when invalid date given" do - let(:attributes) { { bulk_upload:, field_11: "0", field_8: "a", field_9: "12", field_10: "23" } } + let(:attributes) { { bulk_upload:, field_11: "1", field_8: "a", field_9: "12", field_10: "23" } } it "does not raise an error" do expect { parser.valid? }.not_to raise_error @@ -1817,7 +1817,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do end context "when soft validation is triggered and not required" do - let(:attributes) { setup_section_params.merge({ field_125: 120, field_126: 120, field_127: 120, field_128: 120, field_123: 1, field_29: 1, field_4: 1, field_11: "1", field_23: "E09000008" }) } + let(:attributes) { setup_section_params.merge({ field_125: 120, field_126: 120, field_127: 120, field_128: 120, field_123: 1, field_29: 1, field_4: 1, field_11: "2", field_23: "E09000008" }) } it "adds an error to the relevant fields" do parser.valid? From 523f931770eb7eb1f347cdfa2e65dd03850f729a Mon Sep 17 00:00:00 2001 From: kosiakkatrina <54268893+kosiakkatrina@users.noreply.github.com> Date: Wed, 24 Jul 2024 17:32:55 +0100 Subject: [PATCH 4/9] Set the bulk upload value for correct log type (#2533) --- app/services/bulk_upload/lettings/log_creator.rb | 1 + app/services/bulk_upload/sales/log_creator.rb | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/app/services/bulk_upload/lettings/log_creator.rb b/app/services/bulk_upload/lettings/log_creator.rb index a81b6260d..3aaf1d69d 100644 --- a/app/services/bulk_upload/lettings/log_creator.rb +++ b/app/services/bulk_upload/lettings/log_creator.rb @@ -7,6 +7,7 @@ class BulkUpload::Lettings::LogCreator end def call + @bulk_upload.update!(rent_type_fix_status: BulkUpload.rent_type_fix_statuses[:not_needed]) row_parsers.each do |row_parser| row_parser.valid? diff --git a/app/services/bulk_upload/sales/log_creator.rb b/app/services/bulk_upload/sales/log_creator.rb index aeb3f66c4..2d0888e4d 100644 --- a/app/services/bulk_upload/sales/log_creator.rb +++ b/app/services/bulk_upload/sales/log_creator.rb @@ -7,7 +7,6 @@ class BulkUpload::Sales::LogCreator end def call - @bulk_upload.update!(rent_type_fix_status: BulkUpload.rent_type_fix_statuses[:not_needed]) row_parsers.each do |row_parser| row_parser.valid? From 8af9c255e3883b2621314b85585bca09be9ed78b Mon Sep 17 00:00:00 2001 From: Manny Dinssa <44172848+Dinssa@users.noreply.github.com> Date: Wed, 24 Jul 2024 19:08:46 +0100 Subject: [PATCH 5/9] CLDC-3567-Remove-DLUHC-references-from-CORE-pages (#2530) --- LICENSE | 2 +- app/models/form/lettings/pages/declaration.rb | 2 +- .../form/lettings/questions/declaration.rb | 4 +- app/models/form/sales/pages/privacy_notice.rb | 2 +- .../form/sales/questions/privacy_notice.rb | 4 +- app/views/content/accessibility_statement.md | 10 ++-- app/views/content/data_sharing_agreement.md | 52 ++++++++--------- app/views/content/privacy_notice.md | 8 +-- .../form/guidance/_privacy_notice_buyer.erb | 2 +- .../guidance/_privacy_notice_buyer_2024.erb | 2 +- ...ivacy_notice_buyer_2024_joint_purchase.erb | 2 +- .../_privacy_notice_buyer_joint_purchase.erb | 2 +- .../form/guidance/_privacy_notice_tenant.erb | 2 +- .../guidance/_privacy_notice_tenant_2024.erb | 2 +- .../add_managing_agent.html.erb | 2 +- .../add_stock_owner.html.erb | 2 +- .../data_sharing_agreement.html.erb | 54 +++++++++--------- app/views/start/index.html.erb | 4 +- config/forms/2021_2022.json | 4 +- config/forms/2022_2023.json | 4 +- config/locales/en.yml | 8 +-- db/seeds.rb | 4 +- .../adr-001-initial-architecture-decisions.md | 2 +- docs/adr/adr-004-gov-paas.md | 2 +- docs/adr/adr-010-admin-users-vs-users.md | 2 +- docs/adr/adr-020-migration-to-aws.md | 2 +- docs/api/index.html | 2 +- docs/api/v1.json | 2 +- docs/index.md | 4 +- docs/monitoring.md | 2 +- .../lettings_log_summary_component_spec.rb | 4 +- .../sales_log_summary_component_spec.rb | 2 +- spec/factories/organisation.rb | 2 +- spec/features/lettings_log_spec.rb | 4 +- spec/features/sales_log_spec.rb | 4 +- spec/features/schemes_spec.rb | 2 +- spec/fixtures/exports/general_needs_log.csv | 2 +- spec/fixtures/exports/general_needs_log.xml | 4 +- .../exports/general_needs_log_23_24.xml | 4 +- .../exports/general_needs_log_24_25.xml | 4 +- .../exports/supported_housing_logs.xml | 4 +- .../files/2023_24_lettings_bulk_upload.csv | 2 +- ...ettings_bulk_upload_empty_with_headers.csv | 2 +- .../2023_24_lettings_bulk_upload_invalid.csv | 2 +- .../files/2023_24_sales_bulk_upload.csv | 24 ++++---- .../2023_24_sales_bulk_upload_invalid.csv | 24 ++++---- .../files/blank_bulk_upload_sales.csv | 10 ++-- spec/fixtures/files/excel_as_csv.csv | Bin 24693 -> 24688 bytes .../lettings_log_csv_export_codes_23.csv | 2 +- .../lettings_log_csv_export_codes_24.csv | 2 +- .../lettings_log_csv_export_labels_23.csv | 2 +- .../lettings_log_csv_export_labels_24.csv | 2 +- ...gs_log_csv_export_non_support_codes_23.csv | 2 +- ...gs_log_csv_export_non_support_codes_24.csv | 2 +- ...s_log_csv_export_non_support_labels_23.csv | 2 +- ...s_log_csv_export_non_support_labels_24.csv | 2 +- spec/fixtures/files/original_schemes.csv | 10 ++-- .../files/sales_logs_csv_export_codes_23.csv | 2 +- .../files/sales_logs_csv_export_codes_24.csv | 2 +- .../files/sales_logs_csv_export_labels_23.csv | 2 +- .../files/sales_logs_csv_export_labels_24.csv | 2 +- ..._logs_csv_export_non_support_labels_24.csv | 2 +- .../schemes_and_locations_csv_export.csv | 2 +- spec/fixtures/files/schemes_csv_export.csv | 2 +- spec/fixtures/files/updated_schemes.csv | 6 +- spec/fixtures/forms/2021_2022.json | 2 +- spec/helpers/tab_nav_helper_spec.rb | 2 +- .../lettings/questions/declaration_spec.rb | 8 +-- .../form/sales/pages/privacy_notice_spec.rb | 2 +- .../sales/questions/privacy_notice_spec.rb | 16 +++--- spec/models/organisation_spec.rb | 14 ++--- .../requests/organisations_controller_spec.rb | 2 +- .../lettings/year2023/row_parser_spec.rb | 2 +- .../data_sharing_agreement.html.erb_spec.rb | 10 ++-- 74 files changed, 200 insertions(+), 200 deletions(-) diff --git a/LICENSE b/LICENSE index d7aa40044..a6a5070e0 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2021 Department for Levelling Up, Housing & Communities +Copyright (c) 2021 Ministry of Housing, Communities and Local Government Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/app/models/form/lettings/pages/declaration.rb b/app/models/form/lettings/pages/declaration.rb index 1a1740aaf..89561817d 100644 --- a/app/models/form/lettings/pages/declaration.rb +++ b/app/models/form/lettings/pages/declaration.rb @@ -2,7 +2,7 @@ class Form::Lettings::Pages::Declaration < ::Form::Page def initialize(id, hsh, subsection) super @id = "declaration" - @header = "Department for Levelling Up, Housing & Communities privacy notice" + @header = "Ministry of Housing, Communities and Local Government privacy notice" end def questions diff --git a/app/models/form/lettings/questions/declaration.rb b/app/models/form/lettings/questions/declaration.rb index 0960e77cd..5d3f6d76b 100644 --- a/app/models/form/lettings/questions/declaration.rb +++ b/app/models/form/lettings/questions/declaration.rb @@ -12,9 +12,9 @@ class Form::Lettings::Questions::Declaration < ::Form::Question def answer_options declaration_text = if form.start_year_after_2024? - "The tenant has seen or been given access to the DLUHC privacy notice" + "The tenant has seen or been given access to the MHCLG privacy notice" else - "The tenant has seen the DLUHC privacy notice" + "The tenant has seen the MHCLG privacy notice" end { "declaration" => { "value" => declaration_text } }.freeze diff --git a/app/models/form/sales/pages/privacy_notice.rb b/app/models/form/sales/pages/privacy_notice.rb index ea3c387d6..1bd9e22de 100644 --- a/app/models/form/sales/pages/privacy_notice.rb +++ b/app/models/form/sales/pages/privacy_notice.rb @@ -1,7 +1,7 @@ class Form::Sales::Pages::PrivacyNotice < ::Form::Page def initialize(id, hsh, subsection, joint_purchase:) super(id, hsh, subsection) - @header = "Department for Levelling Up, Housing and Communities privacy notice" + @header = "Ministry of Housing, Communities and Local Government privacy notice" @joint_purchase = joint_purchase end diff --git a/app/models/form/sales/questions/privacy_notice.rb b/app/models/form/sales/questions/privacy_notice.rb index ebb6b9434..6e53f36ff 100644 --- a/app/models/form/sales/questions/privacy_notice.rb +++ b/app/models/form/sales/questions/privacy_notice.rb @@ -12,9 +12,9 @@ class Form::Sales::Questions::PrivacyNotice < ::Form::Question def answer_options declaration_text = if form.start_year_after_2024? - "The #{@joint_purchase ? 'buyers have' : 'buyer has'} seen or been given access to the DLUHC privacy notice" + "The #{@joint_purchase ? 'buyers have' : 'buyer has'} seen or been given access to the MHCLG privacy notice" else - "The #{@joint_purchase ? 'buyers have' : 'buyer has'} seen the DLUHC privacy notice" + "The #{@joint_purchase ? 'buyers have' : 'buyer has'} seen the MHCLG privacy notice" end { "privacynotice" => { "value" => declaration_text } }.freeze diff --git a/app/views/content/accessibility_statement.md b/app/views/content/accessibility_statement.md index c0fcf7a5d..a49bd999c 100644 --- a/app/views/content/accessibility_statement.md +++ b/app/views/content/accessibility_statement.md @@ -1,6 +1,6 @@ This accessibility statement applies to the Submit social housing lettings and sales data (CORE) online service. -This website is run by the Department for Levelling Up, Housing and Communities (DLUHC). We want as many people as possible to be able to use this website. For example, that means you should be able to: +This website is run by the Ministry of Housing, Communities and Local Government (MHCLG). We want as many people as possible to be able to use this website. For example, that means you should be able to: - change colours, contrast levels and fonts - zoom in up to 300% without the text spilling off the screen @@ -27,16 +27,16 @@ We know some parts of this website are not fully accessible: If you need information on this website in a different format like accessible PDF, large print, easy read, audio recording or braille, you can contact us by: -- email: [dluhc.digital-services@levellingup.gov.uk](mailto: dluhc.digital-services@levellingup.gov.uk) +- email: [mhclg.digital-services@communities.gov.uk](mailto: mhclg.digital-services@communities.gov.uk) - phone: 0333 202 5084 We’ll consider your request and get back to you in 2 working days. -You can also [contact us through the helpdesk](https://digital.dclg.gov.uk/jira/servicedesk/customer/portal/4/). +You can also [contact us through the helpdesk](https://dluhcdigital.atlassian.net/servicedesk/customer/portal/6/group/11). ### Reporting accessibility problems with this website -We’re always looking to improve the accessibility of this website. If you find any problems not listed on this page or think we’re not meeting accessibility requirements, [contact the helpdesk](https://digital.dclg.gov.uk/jira/servicedesk/customer/portal/4/). +We’re always looking to improve the accessibility of this website. If you find any problems not listed on this page or think we’re not meeting accessibility requirements, [contact the helpdesk](https://dluhcdigital.atlassian.net/servicedesk/customer/portal/6/group/11). ### Enforcement procedure @@ -44,7 +44,7 @@ The Equality and Human Rights Commission (EHRC) is responsible for enforcing the ## Technical information about this website’s accessibility -DLUHC is committed to making its website accessible, in accordance with the Public Sector Bodies (Websites and Mobile Applications) (No. 2) Accessibility Regulations 2018. +MHCLG is committed to making its website accessible, in accordance with the Public Sector Bodies (Websites and Mobile Applications) (No. 2) Accessibility Regulations 2018. ### Compliance status diff --git a/app/views/content/data_sharing_agreement.md b/app/views/content/data_sharing_agreement.md index 6cfca7ccd..a019d9b60 100644 --- a/app/views/content/data_sharing_agreement.md +++ b/app/views/content/data_sharing_agreement.md @@ -1,4 +1,4 @@ -## [Data provider organisation] and Department for Levelling Up, Housing and Communities +## [Data provider organisation] and Ministry of Housing, Communities and Local Government This agreement is made the [XX] day of [XX] 20[XX] @@ -8,18 +8,18 @@ This agreement is made the [XX] day of [XX] 20[XX] and -2) The Department for Levelling Up, Housing and Communities of 2 Marsham Street, London, SW1P 4DF (“DLUHC”) +2) The Ministry of Housing, Communities and Local Government of 2 Marsham Street, London, SW1P 4DF (“MHCLG”) ### 1. Background -1.1. The Department for Levelling Up, Housing and Communities (DLUHC) collect data on social housing lettings and sales via CORE (COntinuous REcording of social housing lettings and sales) for statistical purposes. They are the data controller for all data within the CORE system. +1.1. The Ministry of Housing, Communities and Local Government (MHCLG) collect data on social housing lettings and sales via CORE (COntinuous REcording of social housing lettings and sales) for statistical purposes. They are the data controller for all data within the CORE system. -1.2. The purpose of this Agreement is to describe the duties of CORE data providers to DLUHC and to formalise the arrangement established to share the data between DLUHC and data providers. This agreement covers all data in the CORE system. This agreement does not cover data providers’ own versions of these data. +1.2. The purpose of this Agreement is to describe the duties of CORE data providers to MHCLG and to formalise the arrangement established to share the data between MHCLG and data providers. This agreement covers all data in the CORE system. This agreement does not cover data providers’ own versions of these data. -1.3. Data providers and DLUHC will each be responsible for compliance with the Data Protection legislation including the Data Protection Act 2018 and the EU General Data Protection Regulation (GDPR). +1.3. Data providers and MHCLG will each be responsible for compliance with the Data Protection legislation including the Data Protection Act 2018 and the EU General Data Protection Regulation (GDPR). -1.4. DLUHC shall only collect data from and share data with CORE data providers that have signed this data sharing agreement. +1.4. MHCLG shall only collect data from and share data with CORE data providers that have signed this data sharing agreement. -1.5. There are occasions when DLUHC may instruct a third party to carry out analysis on the CORE dataset on their behalf. This third party will be a data processor for DLUHC and work under a contract ensuring data protection compliance. +1.5. There are occasions when MHCLG may instruct a third party to carry out analysis on the CORE dataset on their behalf. This third party will be a data processor for MHCLG and work under a contract ensuring data protection compliance. **It is now agreed** as follows: @@ -35,7 +35,7 @@ parties with delegated authority to handle the day-to-day matters arising from t * “Data Protection Legislation” means the Data Protection Act 2018 and all applicable laws and regulations relating to the processing of personal data and privacy, including where applicable the guidance and codes of practice issued by the Information Commissioner; it includes the General Data Protection Regulation (GDPR). * “Data” means the data supplied by the CORE data providers via the CORE system and the data that is calculated or derived via the CORE system based on that initial data; * “GDPR” means the General Data Protection Regulation. -* “Parties” means the parties to this Agreement, namely DLUHC and the CORE data providers. CORE data providers include social housing providers and managing organisations that provide data on behalf of the social housing providers. +* “Parties” means the parties to this Agreement, namely MHCLG and the CORE data providers. CORE data providers include social housing providers and managing organisations that provide data on behalf of the social housing providers. * “Personal Data” has the meaning in Article 4(1) of the GDPR. “Processing” has the meaning in Article 4(2) of the GDPR. * “Request for Information” means a request for information or a request under the Freedom of Information Act 2000. * “Special category personal data” has the meaning in Article 9(1) of the GDPR. In this Agreement: @@ -57,7 +57,7 @@ shall be construed as a reference to the statute, enactment, order, regulation o 3.2. The Parties may, by mutual consent in writing, agree to amend this agreement. ### 4. Purpose and scope of data collection via CORE -4.1. CORE (COntinuous Recording of social housing lettings and sales) is a national information source funded by the Department for Levelling Up, Housing and Communities that records information on the characteristics of Private Registered Providers’ and Local Authorities’ new social housing tenants and the homes they rent and buy. +4.1. CORE (COntinuous Recording of social housing lettings and sales) is a national information source funded by the Ministry of Housing, Communities and Local Government that records information on the characteristics of Private Registered Providers’ and Local Authorities’ new social housing tenants and the homes they rent and buy. 4.2. The CORE dataset includes information on the letting or sale, type of tenancy or sale, rents and charges, demographic information about the tenant/buyer and other information related to the tenants/buyers themselves (e.g. source of referral, route into housing, whether they are on benefits, income). @@ -66,7 +66,7 @@ shall be construed as a reference to the statute, enactment, order, regulation o 4.4. The dataset also contains information which is very sensitive, and which in some cases is “special category” personal data for the purposes of the GDPR, and if disclosed could cause considerable distress to the data subject, for example it indicates whether the social housing tenant has been in prison or probation or referred by a mental health institution; or whether anyone in the household has suffered from domestic abuse or hate crime. ### 5. Roles and responsibilities -5.1. DLUHC shall be the ‘Data controller’ for all personal data held within the CORE database. +5.1. MHCLG shall be the ‘Data controller’ for all personal data held within the CORE database. 5.2. CORE data providers are data controllers for personal data that they hold within their own systems. It is recognised that while much of the CORE data will be replicated in data collections held by CORE data providers, each organisation accepts full data controller responsibility for the data it holds. @@ -74,10 +74,10 @@ shall be construed as a reference to the statute, enactment, order, regulation o 5.4. In order to be compliant with the data protection legislation all data subjects (social housing tenants and buyers) from the CORE dataset need to be informed of how their data will be processed and used. -5.5. DLUHC has set the information that needs to be provided to new CORE data subjects in the privacy notice in Annex 1 of this agreement. CORE data providers must either share the DLUHC privacy notice with tenants or if using their own privacy notice, state within that they share the data with DLUHC and provide a link to the DLUHC privacy notice. +5.5. MHCLG has set the information that needs to be provided to new CORE data subjects in the privacy notice in Annex 1 of this agreement. CORE data providers must either share the MHCLG privacy notice with tenants or if using their own privacy notice, state within that they share the data with MHCLG and provide a link to the MHCLG privacy notice. ### 6. Legal basis for data sharing -6.1. CORE provides DLUHC with an essential evidence base for monitoring and developing government policy, in particular to assess who is accessing social housing and their associated tenancy and property details. It is necessary therefore that the personal data that forms the CORE data is processed for that purpose. The legal basis for processing this personal data is s(8)(d) of the Data Protection Act 2018 which states: +6.1. CORE provides MHCLG with an essential evidence base for monitoring and developing government policy, in particular to assess who is accessing social housing and their associated tenancy and property details. It is necessary therefore that the personal data that forms the CORE data is processed for that purpose. The legal basis for processing this personal data is s(8)(d) of the Data Protection Act 2018 which states: > In Article 6(1) of the GDPR (lawfulness of processing), the reference in point (e) to processing of personal data that is necessary for the performance of a task carried out in the public interest or in the exercise of the controller’s official authority includes processing of personal data that is necessary for— (d) the exercise of a function of the Crown, a Minister of the Crown or a government department. @@ -97,45 +97,45 @@ shall be construed as a reference to the statute, enactment, order, regulation o 8.3. Data providers will be able to access the CORE personal data they submitted right after it is validated by the system; but can only access processed data from MHCLG after MHCLG has published the data. MHCLG will make the processed data available to data providers as soon as possible via the system. -8.4.CORE team members in DLUHC and third-party data processors as developers/maintenance contractors have access to all parts of the website, including data. The handling of CORE data by contractors is covered in the contracts with these organisations. All CORE staff that have access to the data have had training on how to handle personal data. +8.4.CORE team members in MHCLG and third-party data processors as developers/maintenance contractors have access to all parts of the website, including data. The handling of CORE data by contractors is covered in the contracts with these organisations. All CORE staff that have access to the data have had training on how to handle personal data. -8.5. All work carried out by DLUHC will follow appropriate security measures and procedures to ensure the protection of the data. +8.5. All work carried out by MHCLG will follow appropriate security measures and procedures to ensure the protection of the data. ### 9. Protection of personal data -9.1. CORE data providers and DLUHC agree that they shall: +9.1. CORE data providers and MHCLG agree that they shall: * A. Implement appropriate technical and organisational measures to protect the Personal Data against unauthorised or unlawful Processing and against accidental loss, destruction, damage, alteration or disclosure. These measures shall ensure a level of security appropriate to the harm which might result from any unauthorised or unlawful Processing, accidental loss, destruction or damage to the Personal Data and having regard to the nature of the Personal Data which is to be protected; -* B. Take reasonable steps to ensure the reliability of any personnel who have access to the Personal Data. DLUHC and Data providers will ensure such personnel will be a limited number of analysts assigned to the data collection. +* B. Take reasonable steps to ensure the reliability of any personnel who have access to the Personal Data. MHCLG and Data providers will ensure such personnel will be a limited number of analysts assigned to the data collection. -9.2. The data providers and DLUHC shall comply at all times with the Data Protection Legislation and shall ensure that they each perform their obligations under this agreement in full compliance with the Data Protection Legislation and any other applicable law, in particular the Human Rights Act 1998 and the common law duty of confidentiality. +9.2. The data providers and MHCLG shall comply at all times with the Data Protection Legislation and shall ensure that they each perform their obligations under this agreement in full compliance with the Data Protection Legislation and any other applicable law, in particular the Human Rights Act 1998 and the common law duty of confidentiality. 9.3. CORE data providers should limit access to CORE to a small number of individuals who can be named on request. CORE access is limited to registered users only via password, but it is the responsibility of the CORE data providers to ensure that all individuals granted access to the datasets should be briefed on the legal requirements around handling and storing the Data from CORE. ### 10. Freedom of information -10.1. DLUHC acknowledges that CORE data providers that are or act on behalf of local authorities may be subject to the requirements of the FOIA and the Environmental Information Regulations and shall assist and cooperate with them to enable them to comply with their Information disclosure requirements. +10.1. MHCLG acknowledges that CORE data providers that are or act on behalf of local authorities may be subject to the requirements of the FOIA and the Environmental Information Regulations and shall assist and cooperate with them to enable them to comply with their Information disclosure requirements. ### 11. Loss or unauthorised release -11.1. CORE data providers will report to DLUHC any loss or unauthorised release of the Data as soon as possible and no later than 24 hours after the loss or unauthorised release is identified. DLUHC will report to CORE data providers any loss or unauthorised release of the Data as soon as possible and no later than 24 hours after the loss or unauthorised release is identified. +11.1. CORE data providers will report to MHCLG any loss or unauthorised release of the Data as soon as possible and no later than 24 hours after the loss or unauthorised release is identified. MHCLG will report to CORE data providers any loss or unauthorised release of the Data as soon as possible and no later than 24 hours after the loss or unauthorised release is identified. -11.2. CORE data providers and DLUHC acknowledge that any loss or unauthorised release of the Data can be treated as valid grounds for immediately terminating this agreement by DLUHC. +11.2. CORE data providers and MHCLG acknowledge that any loss or unauthorised release of the Data can be treated as valid grounds for immediately terminating this agreement by MHCLG. ### 12. Authorised representatives -12.1. CORE data providers and DLUHC will each appoint an Authorised Representative to be the primary point of contact in all day-to-day matters relating to this Agreement: +12.1. CORE data providers and MHCLG will each appoint an Authorised Representative to be the primary point of contact in all day-to-day matters relating to this Agreement: 12.2. For [the Data Provider]: Name: Postal Address: E-mail address: Telephone number: -12.3. For DLUHC: Name: Rachel Worledge +12.3. For MHCLG: Name: Rachel Worledge Postal Address: South-west section, 4th Floor, Fry Building, 2 Marsham Street, London, SW1P 4DF -E-mail address: Rachel.Worledge@levellingup.gov.uk +E-mail address: Rachel.Worledge@communities.gov.uk ### 13. Products and publications 13.1. The Data potentially allows for persons to be identified, although the risk of this happening should be minimised by the steps taken in clause 9. CORE data providers should agree to carry out a thorough check of the Data and ensure that all steps are taken within its powers to minimise the risk that any outputs lead to identification of a person by a third party. ### 14. Dispute resolution -14.1. Any disputes arising concerning this Agreement will be resolved initially by discussions between the Authorised Representatives of the CORE data providers and DLUHC. +14.1. Any disputes arising concerning this Agreement will be resolved initially by discussions between the Authorised Representatives of the CORE data providers and MHCLG. -14.2. If the dispute cannot be resolved amicably between the Authorised Representatives then the matter will be escalated to: for the CORE data providers: the Chief Executive; and for DLUHC: the Deputy Director of the Data, Analytics and Statistics Division. +14.2. If the dispute cannot be resolved amicably between the Authorised Representatives then the matter will be escalated to: for the CORE data providers: the Chief Executive; and for MHCLG: the Deputy Director of the Data, Analytics and Statistics Division. ### 15. Termination 15.1. Any Party may terminate this Agreement upon one month’s written notice to the other. @@ -152,7 +152,7 @@ signed for and on behalf of [job title of an officer with appropriate delegated * Name: * Title: -SIGNED for and on behalf of the deputy director of the data, analytics & statistics in the Department for Levelling Up, Housing and Communities, by: +SIGNED for and on behalf of the deputy director of the data, analytics & statistics in the Ministry of Housing, Communities and Local Government, by: * Name: Sandra Tudor * Title: Deputy Director diff --git a/app/views/content/privacy_notice.md b/app/views/content/privacy_notice.md index ba42a4b7e..b32774288 100644 --- a/app/views/content/privacy_notice.md +++ b/app/views/content/privacy_notice.md @@ -1,10 +1,10 @@ ## How do we use your information? -If your household enters a new social housing tenancy or purchases a social housing property, social housing providers will share your personal information with the Department for Levelling Up, Housing & Communities (DLUHC) for research and statistical purposes only. +If your household enters a new social housing tenancy or purchases a social housing property, social housing providers will share your personal information with the Ministry of Housing, Communities and Local Government (MHCLG) for research and statistical purposes only. ## How do we get this information? -The information is provided via ‘<%= t('service_name') %>’, a service funded and managed by DLUHC. It collects information on the tenants or residents, tenancy or sale, and the dwelling itself. Some of this data is personal and sensitive, so DLUHC is responsible for ensuring it’s processed in line with data protection legislation. +The information is provided via ‘<%= t('service_name') %>’, a service funded and managed by MHCLG. It collects information on the tenants or residents, tenancy or sale, and the dwelling itself. Some of this data is personal and sensitive, so MHCLG is responsible for ensuring it’s processed in line with data protection legislation. ## Why do we share this information? @@ -17,7 +17,7 @@ Information sharing will not affect your benefits, services or any treatments yo ## To find out more… -Social housing lettings and sales data is collected on DLUHC’s behalf. Data providers do not require the tenant or buyer’s consent to provide this information, but tenants and buyers have the right to know how and for what purpose data is being collected, held and used. +Social housing lettings and sales data is collected on MHCLG’s behalf. Data providers do not require the tenant or buyer’s consent to provide this information, but tenants and buyers have the right to know how and for what purpose data is being collected, held and used. Data processing must have a lawful basis. In this case it’s necessary for a task carried out in the public interest meeting a function of the Crown, a Minister of the Crown, or government department. @@ -32,7 +32,7 @@ Collected data will be held for as long as necessary for research and statistica * if household left last settled home because discharged from prison, a long stay hospital or other institution * if referral source is probation or prison, youth offending or community mental health team, or health service -DLUHC publishes data annually, in aggregate form, as part of a report and complementary tables. +MHCLG publishes data annually, in aggregate form, as part of a report and complementary tables. * For annual lettings data, visit: [https://www.gov.uk/government/collections/rents-lettings-and-tenancies](https://www.gov.uk/government/collections/rents-lettings-and-tenancies) diff --git a/app/views/form/guidance/_privacy_notice_buyer.erb b/app/views/form/guidance/_privacy_notice_buyer.erb index fabe9ced1..599574a06 100644 --- a/app/views/form/guidance/_privacy_notice_buyer.erb +++ b/app/views/form/guidance/_privacy_notice_buyer.erb @@ -1 +1 @@ -

Make sure the buyer has seen <%= govuk_link_to "the Department for Levelling Up, Housing & Communities (DLUHC) privacy notice", privacy_notice_path, target: :_blank %> before completing this log.

+

Make sure the buyer has seen <%= govuk_link_to "the Ministry of Housing, Communities and Local Government (MHCLG) privacy notice", privacy_notice_path, target: :_blank %> before completing this log.

diff --git a/app/views/form/guidance/_privacy_notice_buyer_2024.erb b/app/views/form/guidance/_privacy_notice_buyer_2024.erb index 9977bf20b..1ed6e683e 100644 --- a/app/views/form/guidance/_privacy_notice_buyer_2024.erb +++ b/app/views/form/guidance/_privacy_notice_buyer_2024.erb @@ -1 +1 @@ -

Make sure the buyer has seen or been given access to <%= govuk_link_to "the Department for Levelling Up, Housing & Communities (DLUHC) privacy notice", privacy_notice_path, target: :_blank %> before completing this log. This is a legal requirement under data protection legislation.

+

Make sure the buyer has seen or been given access to <%= govuk_link_to "the Ministry of Housing, Communities and Local Government (MHCLG) privacy notice", privacy_notice_path, target: :_blank %> before completing this log. This is a legal requirement under data protection legislation.

diff --git a/app/views/form/guidance/_privacy_notice_buyer_2024_joint_purchase.erb b/app/views/form/guidance/_privacy_notice_buyer_2024_joint_purchase.erb index b2f4fd8ca..74ce54a3d 100644 --- a/app/views/form/guidance/_privacy_notice_buyer_2024_joint_purchase.erb +++ b/app/views/form/guidance/_privacy_notice_buyer_2024_joint_purchase.erb @@ -1 +1 @@ -

Make sure the buyers have seen or been given access to <%= govuk_link_to "the Department for Levelling Up, Housing & Communities (DLUHC) privacy notice", privacy_notice_path, target: :_blank %> before completing this log. This is a legal requirement under data protection legislation.

+

Make sure the buyers have seen or been given access to <%= govuk_link_to "the Ministry of Housing, Communities and Local Government (MHCLG) privacy notice", privacy_notice_path, target: :_blank %> before completing this log. This is a legal requirement under data protection legislation.

diff --git a/app/views/form/guidance/_privacy_notice_buyer_joint_purchase.erb b/app/views/form/guidance/_privacy_notice_buyer_joint_purchase.erb index 772a2ee68..edab9e1e9 100644 --- a/app/views/form/guidance/_privacy_notice_buyer_joint_purchase.erb +++ b/app/views/form/guidance/_privacy_notice_buyer_joint_purchase.erb @@ -1 +1 @@ -

Make sure the buyers have seen <%= govuk_link_to "the Department for Levelling Up, Housing & Communities (DLUHC) privacy notice", privacy_notice_path, target: :_blank %> before completing this log.

+

Make sure the buyers have seen <%= govuk_link_to "the Ministry of Housing, Communities and Local Government (MHCLG) privacy notice", privacy_notice_path, target: :_blank %> before completing this log.

diff --git a/app/views/form/guidance/_privacy_notice_tenant.erb b/app/views/form/guidance/_privacy_notice_tenant.erb index 88b281730..7df685448 100644 --- a/app/views/form/guidance/_privacy_notice_tenant.erb +++ b/app/views/form/guidance/_privacy_notice_tenant.erb @@ -1 +1 @@ -

Make sure the tenant has seen <%= govuk_link_to "the Department for Levelling Up, Housing & Communities (DLUHC) privacy notice", privacy_notice_path, target: :_blank %> before completing this log.

+

Make sure the tenant has seen <%= govuk_link_to "the Ministry of Housing, Communities and Local Government (MHCLG) privacy notice", privacy_notice_path, target: :_blank %> before completing this log.

diff --git a/app/views/form/guidance/_privacy_notice_tenant_2024.erb b/app/views/form/guidance/_privacy_notice_tenant_2024.erb index 3007c8904..12de7baba 100644 --- a/app/views/form/guidance/_privacy_notice_tenant_2024.erb +++ b/app/views/form/guidance/_privacy_notice_tenant_2024.erb @@ -1 +1 @@ -

Make sure the lead tenant has seen or been given access to <%= govuk_link_to "the Department for Levelling Up, Housing & Communities (DLUHC) privacy notice", privacy_notice_path, target: :_blank %> before completing this log. This is a legal requirement under data protection legislation.

+

Make sure the lead tenant has seen or been given access to <%= govuk_link_to "the Ministry of Housing, Communities and Local Government (MHCLG) privacy notice", privacy_notice_path, target: :_blank %> before completing this log. This is a legal requirement under data protection legislation.

diff --git a/app/views/organisation_relationships/add_managing_agent.html.erb b/app/views/organisation_relationships/add_managing_agent.html.erb index 1cb00e989..b3e3a4a42 100644 --- a/app/views/organisation_relationships/add_managing_agent.html.erb +++ b/app/views/organisation_relationships/add_managing_agent.html.erb @@ -31,7 +31,7 @@
  • Double check the spelling and try again
  • Type the first few letters to see the suggestions
  • If you still can't find it, - <%= govuk_link_to("contact the DLUHC service desk", GlobalConstants::HELPDESK_URL, rel: "noreferrer noopener", target: "_blank") %> + <%= govuk_link_to("contact the MHCLG service desk", GlobalConstants::HELPDESK_URL, rel: "noreferrer noopener", target: "_blank") %>
  • <% end %> diff --git a/app/views/organisation_relationships/add_stock_owner.html.erb b/app/views/organisation_relationships/add_stock_owner.html.erb index 64d9e0204..b74d812ec 100644 --- a/app/views/organisation_relationships/add_stock_owner.html.erb +++ b/app/views/organisation_relationships/add_stock_owner.html.erb @@ -31,7 +31,7 @@
  • Double check the spelling and try again
  • Type the first few letters to see the suggestions
  • If you still can't find it, - <%= govuk_link_to("contact the DLUHC service desk", GlobalConstants::HELPDESK_URL, rel: "noreferrer noopener", target: "_blank") %> + <%= govuk_link_to("contact the MHCLG service desk", GlobalConstants::HELPDESK_URL, rel: "noreferrer noopener", target: "_blank") %>
  • <% end %> diff --git a/app/views/organisations/data_sharing_agreement.html.erb b/app/views/organisations/data_sharing_agreement.html.erb index 5e2791760..722d9e176 100644 --- a/app/views/organisations/data_sharing_agreement.html.erb +++ b/app/views/organisations/data_sharing_agreement.html.erb @@ -6,8 +6,8 @@
    -

    - <%= org_name_for_data_sharing_agreement(@data_protection_confirmation, current_user) %> and Department for Levelling Up, Housing and Communities +

    + <%= org_name_for_data_sharing_agreement(@data_protection_confirmation, current_user) %> and Ministry of Housing, Communities and Local Government

    <% if @data_protection_confirmation&.confirmed? %> @@ -25,13 +25,13 @@

    1) <%= @organisation.name %> of <%= @organisation.address_row %> (“CORE Data Provider”)

    <% end %>

    and

    -

    2) The Department for Levelling Up, Housing and Communities of 2 Marsham Street, London, SW1P 4DF (“DLUHC”)

    +

    2) The Ministry of Housing, Communities and Local Government of 2 Marsham Street, London, SW1P 4DF (“MHCLG”)

    1. Background

    -

    1.1. The Department for Levelling Up, Housing and Communities (DLUHC) collect data on social housing lettings and sales via CORE (COntinuous REcording of social housing lettings and sales) for statistical purposes. They are the data controller for all data within the CORE system.

    -

    1.2. The purpose of this Agreement is to describe the duties of CORE data providers to DLUHC and to formalise the arrangement established to share the data between DLUHC and data providers. This agreement covers all data in the CORE system. This agreement does not cover data providers’ own versions of these data.

    -

    1.3. Data providers and DLUHC will each be responsible for compliance with the Data Protection legislation including the Data Protection Act 2018 and the EU General Data Protection Regulation (GDPR).

    -

    1.4. DLUHC shall only collect data from and share data with CORE data providers that have signed this data sharing agreement.

    -

    1.5. There are occasions when DLUHC may instruct a third party to carry out analysis on the CORE dataset on their behalf. This third party will be a data processor for DLUHC and work under a contract ensuring data protection compliance.

    +

    1.1. The Ministry of Housing, Communities and Local Government (MHCLG) collect data on social housing lettings and sales via CORE (COntinuous REcording of social housing lettings and sales) for statistical purposes. They are the data controller for all data within the CORE system.

    +

    1.2. The purpose of this Agreement is to describe the duties of CORE data providers to MHCLG and to formalise the arrangement established to share the data between MHCLG and data providers. This agreement covers all data in the CORE system. This agreement does not cover data providers’ own versions of these data.

    +

    1.3. Data providers and MHCLG will each be responsible for compliance with the Data Protection legislation including the Data Protection Act 2018 and the EU General Data Protection Regulation (GDPR).

    +

    1.4. MHCLG shall only collect data from and share data with CORE data providers that have signed this data sharing agreement.

    +

    1.5. There are occasions when MHCLG may instruct a third party to carry out analysis on the CORE dataset on their behalf. This third party will be a data processor for MHCLG and work under a contract ensuring data protection compliance.

    It is now agreed as follows:

    2. Definitions and interpretation

    2.1. In this Agreement the following words and phrases shall have the following meanings, unless expressly stated to the contrary:

    @@ -45,7 +45,7 @@
  • “Data Protection Legislation” means the Data Protection Act 2018 and all applicable laws and regulations relating to the processing of personal data and privacy, including where applicable the guidance and codes of practice issued by the Information Commissioner; it includes the General Data Protection Regulation (GDPR).
  • “Data” means the data supplied by the CORE data providers via the CORE system and the data that is calculated or derived via the CORE system based on that initial data;
  • “GDPR” means the General Data Protection Regulation.
  • -
  • “Parties” means the parties to this Agreement, namely DLUHC and the CORE data providers. CORE data providers include social housing providers and managing organisations that provide data on behalf of the social housing providers.
  • +
  • “Parties” means the parties to this Agreement, namely MHCLG and the CORE data providers. CORE data providers include social housing providers and managing organisations that provide data on behalf of the social housing providers.
  • “Personal Data” has the meaning in Article 4(1) of the GDPR. “Processing” has the meaning in Article 4(2) of the GDPR.
  • “Request for Information” means a request for information or a request under the Freedom of Information Act 2000.
  • “Special category personal data” has the meaning in Article 9(1) of the GDPR. In this Agreement: @@ -66,18 +66,18 @@

    3.1. This Agreement shall commence upon signature by the Parties and shall continue in effect whilst the CORE data collection remains live, in accordance with the requirements of this Agreement unless otherwise subject to earlier termination in accordance with Clause 15.

    3.2. The Parties may, by mutual consent in writing, agree to amend this agreement.

    4. Purpose and scope of data collection via CORE

    -

    4.1. CORE (COntinuous Recording of social housing lettings and sales) is a national information source funded by the Department for Levelling Up, Housing and Communities that records information on the characteristics of Private Registered Providers’ and Local Authorities’ new social housing tenants and the homes they rent and buy.

    +

    4.1. CORE (COntinuous Recording of social housing lettings and sales) is a national information source funded by the Ministry of Housing, Communities and Local Government that records information on the characteristics of Private Registered Providers’ and Local Authorities’ new social housing tenants and the homes they rent and buy.

    4.2. The CORE dataset includes information on the letting or sale, type of tenancy or sale, rents and charges, demographic information about the tenant/buyer and other information related to the tenants/buyers themselves (e.g. source of referral, route into housing, whether they are on benefits, income).

    4.3. The data in the CORE dataset is considered personal data because individuals could be easily identified. The dataset does not contain direct personal identifiers but when taken as a whole the data allows social housing tenants to be identified. This is because the dataset contains information such as UPRN (Unique Property Reference Number), which allows properties to be uniquely identified or full postcode data.

    4.4. The dataset also contains information which is very sensitive, and which in some cases is “special category” personal data for the purposes of the GDPR, and if disclosed could cause considerable distress to the data subject, for example it indicates whether the social housing tenant has been in prison or probation or referred by a mental health institution; or whether anyone in the household has suffered from domestic abuse or hate crime.

    5. Roles and responsibilities

    -

    5.1. DLUHC shall be the ‘Data controller’ for all personal data held within the CORE database.

    +

    5.1. MHCLG shall be the ‘Data controller’ for all personal data held within the CORE database.

    5.2. CORE data providers are data controllers for personal data that they hold within their own systems. It is recognised that while much of the CORE data will be replicated in data collections held by CORE data providers, each organisation accepts full data controller responsibility for the data it holds.

    5.3. CORE data providers need to submit information for the tenancy, the tenants and the property each time there is a new social housing letting or sale. The data collection covers general needs and supported housing lettings. Since April 2012, local authorities and private registered providers report their affordable rent lettings as well as their social rent lettings and, from April 2017, rent-to-buy lettings are also included.

    5.4. In order to be compliant with the data protection legislation all data subjects (social housing tenants and buyers) from the CORE dataset need to be informed of how their data will be processed and used.

    -

    5.5. DLUHC has set the information that needs to be provided to new CORE data subjects in the privacy notice in Annex 1 of this agreement. CORE data providers must either share the DLUHC privacy notice with tenants or if using their own privacy notice, state within that they share the data with DLUHC and provide a link to the DLUHC privacy notice.

    +

    5.5. MHCLG has set the information that needs to be provided to new CORE data subjects in the privacy notice in Annex 1 of this agreement. CORE data providers must either share the MHCLG privacy notice with tenants or if using their own privacy notice, state within that they share the data with MHCLG and provide a link to the MHCLG privacy notice.

    -

    6.1. CORE provides DLUHC with an essential evidence base for monitoring and developing government policy, in particular to assess who is accessing social housing and their associated tenancy and property details. It is necessary therefore that the personal data that forms the CORE data is processed for that purpose. The legal basis for processing this personal data is s(8)(d) of the Data Protection Act 2018 which states:

    +

    6.1. CORE provides MHCLG with an essential evidence base for monitoring and developing government policy, in particular to assess who is accessing social housing and their associated tenancy and property details. It is necessary therefore that the personal data that forms the CORE data is processed for that purpose. The legal basis for processing this personal data is s(8)(d) of the Data Protection Act 2018 which states:

    In Article 6(1) of the GDPR (lawfulness of processing), the reference in point (e) to processing of personal data that is necessary for the performance of a task carried out in the public interest or in the exercise of the controller’s official authority includes processing of personal data that is necessary for— (d) the exercise of a function of the Crown, a Minister of the Crown or a government department.

    @@ -91,35 +91,35 @@

    8.1. The security of the CORE data collection system is compliant with Government security standards (https://core.communities.gov.uk/public/index.html).

    8.2. All parts of the CORE website where an individual’s letting/sale data is submitted or downloaded are only accessible via login and passwords. The CORE system has hierarchies in place to ensure that data providers and users can only submit, view or download data for the organisations they are associated with.

    8.3. Data providers will be able to access the CORE personal data they submitted right after it is validated by the system; but can only access processed data from MHCLG after MHCLG has published the data. MHCLG will make the processed data available to data providers as soon as possible via the system.

    -

    8.4.CORE team members in DLUHC and third-party data processors as developers/maintenance contractors have access to all parts of the website, including data. The handling of CORE data by contractors is covered in the contracts with these organisations. All CORE staff that have access to the data have had training on how to handle personal data.

    -

    8.5. All work carried out by DLUHC will follow appropriate security measures and procedures to ensure the protection of the data.

    +

    8.4.CORE team members in MHCLG and third-party data processors as developers/maintenance contractors have access to all parts of the website, including data. The handling of CORE data by contractors is covered in the contracts with these organisations. All CORE staff that have access to the data have had training on how to handle personal data.

    +

    8.5. All work carried out by MHCLG will follow appropriate security measures and procedures to ensure the protection of the data.

    9. Protection of personal data

    -

    9.1. CORE data providers and DLUHC agree that they shall:

    +

    9.1. CORE data providers and MHCLG agree that they shall:

    • A. Implement appropriate technical and organisational measures to protect the Personal Data against unauthorised or unlawful Processing and against accidental loss, destruction, damage, alteration or disclosure. These measures shall ensure a level of security appropriate to the harm which might result from any unauthorised or unlawful Processing, accidental loss, destruction or damage to the Personal Data and having regard to the nature of the Personal Data which is to be protected;
    • -
    • B. Take reasonable steps to ensure the reliability of any personnel who have access to the Personal Data. DLUHC and Data providers will ensure such personnel will be a limited number of analysts assigned to the data collection.
    • +
    • B. Take reasonable steps to ensure the reliability of any personnel who have access to the Personal Data. MHCLG and Data providers will ensure such personnel will be a limited number of analysts assigned to the data collection.
    -

    9.2. The data providers and DLUHC shall comply at all times with the Data Protection Legislation and shall ensure that they each perform their obligations under this agreement in full compliance with the Data Protection Legislation and any other applicable law, in particular the Human Rights Act 1998 and the common law duty of confidentiality.

    +

    9.2. The data providers and MHCLG shall comply at all times with the Data Protection Legislation and shall ensure that they each perform their obligations under this agreement in full compliance with the Data Protection Legislation and any other applicable law, in particular the Human Rights Act 1998 and the common law duty of confidentiality.

    9.3. CORE data providers should limit access to CORE to a small number of individuals who can be named on request. CORE access is limited to registered users only via password, but it is the responsibility of the CORE data providers to ensure that all individuals granted access to the datasets should be briefed on the legal requirements around handling and storing the Data from CORE.

    10. Freedom of information

    -

    10.1. DLUHC acknowledges that CORE data providers that are or act on behalf of local authorities may be subject to the requirements of the FOIA and the Environmental Information Regulations and shall assist and cooperate with them to enable them to comply with their Information disclosure requirements.

    +

    10.1. MHCLG acknowledges that CORE data providers that are or act on behalf of local authorities may be subject to the requirements of the FOIA and the Environmental Information Regulations and shall assist and cooperate with them to enable them to comply with their Information disclosure requirements.

    11. Loss or unauthorised release

    -

    11.1. CORE data providers will report to DLUHC any loss or unauthorised release of the Data as soon as possible and no later than 24 hours after the loss or unauthorised release is identified. DLUHC will report to CORE data providers any loss or unauthorised release of the Data as soon as possible and no later than 24 hours after the loss or unauthorised release is identified.

    -

    11.2. CORE data providers and DLUHC acknowledge that any loss or unauthorised release of the Data can be treated as valid grounds for immediately terminating this agreement by DLUHC.

    +

    11.1. CORE data providers will report to MHCLG any loss or unauthorised release of the Data as soon as possible and no later than 24 hours after the loss or unauthorised release is identified. MHCLG will report to CORE data providers any loss or unauthorised release of the Data as soon as possible and no later than 24 hours after the loss or unauthorised release is identified.

    +

    11.2. CORE data providers and MHCLG acknowledge that any loss or unauthorised release of the Data can be treated as valid grounds for immediately terminating this agreement by MHCLG.

    12. Authorised representatives

    -

    12.1. CORE data providers and DLUHC will each appoint an Authorised Representative to be the primary point of contact in all day-to-day matters relating to this Agreement:

    +

    12.1. CORE data providers and MHCLG will each appoint an Authorised Representative to be the primary point of contact in all day-to-day matters relating to this Agreement:

    <%= present_section_12_2(data_protection_confirmation: @data_protection_confirmation, user: current_user, organisation: @organisation) %>

    -

    12.3. For DLUHC: Name: Rachel Worledge, +

    12.3. For MHCLG: Name: Rachel Worledge, Postal Address: South-west section, 4th Floor, Fry Building, 2 Marsham Street, London, SW1P 4DF, - E-mail address: Rachel.Worledge@levellingup.gov.uk

    + E-mail address: Rachel.Worledge@communities.gov.uk

    13. Products and publications

    13.1. The Data potentially allows for persons to be identified, although the risk of this happening should be minimised by the steps taken in clause 9. CORE data providers should agree to carry out a thorough check of the Data and ensure that all steps are taken within its powers to minimise the risk that any outputs lead to identification of a person by a third party.

    14. Dispute resolution

    -

    14.1. Any disputes arising concerning this Agreement will be resolved initially by discussions between the Authorised Representatives of the CORE data providers and DLUHC.

    -

    14.2. If the dispute cannot be resolved amicably between the Authorised Representatives then the matter will be escalated to: for the CORE data providers: the Chief Executive; and for DLUHC: the Deputy Director of the Data, Analytics and Statistics Division.

    +

    14.1. Any disputes arising concerning this Agreement will be resolved initially by discussions between the Authorised Representatives of the CORE data providers and MHCLG.

    +

    14.2. If the dispute cannot be resolved amicably between the Authorised Representatives then the matter will be escalated to: for the CORE data providers: the Chief Executive; and for MHCLG: the Deputy Director of the Data, Analytics and Statistics Division.

    15. Termination

    15.1. Any Party may terminate this Agreement upon one month’s written notice to the other.

    15.2. Any Party may terminate this Agreement with immediate effect in the event of a @@ -132,7 +132,7 @@

  • Name: <%= name_for_data_sharing_agreement(@data_protection_confirmation, current_user) %>
  • Title: Data Protection Officer
  • -

    SIGNED for and on behalf of the deputy director of the data, analytics & statistics in the Department for Levelling Up, Housing and Communities, by:

    +

    SIGNED for and on behalf of the deputy director of the data, analytics & statistics in the Ministry of Housing, Communities and Local Government, by:

    • Name: Sandra Tudor
    • Title: Deputy Director
    • diff --git a/app/views/start/index.html.erb b/app/views/start/index.html.erb index 14ed39282..491d68d49 100644 --- a/app/views/start/index.html.erb +++ b/app/views/start/index.html.erb @@ -4,7 +4,7 @@
      -

      Use this service to submit social housing lettings and sales data to the Department for Levelling Up, Housing and Communities (DLUHC).

      +

      Use this service to submit social housing lettings and sales data to the Ministry of Housing, Communities and Local Government (MHCLG).

      We’ll ask you questions about a letting or sale, like details about the household or property. Your answers will create a log that you can submit directly to us.

      Your organisation can also set up and manage user accounts.

      The data will be used to update the national record for social housing. It will also help to inform policy about the cost of social housing and what type of housing needs to be built.

      @@ -21,7 +21,7 @@

      Before you start

      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.

      +

      You can <%= govuk_mail_to("mhclg.digital-services@communities.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 %>


      <%= render partial: "layouts/collection_resources" %> diff --git a/config/forms/2021_2022.json b/config/forms/2021_2022.json index 37e796e04..f4c94c35c 100644 --- a/config/forms/2021_2022.json +++ b/config/forms/2021_2022.json @@ -1134,7 +1134,7 @@ ], "pages": { "declaration": { - "header": "Department for Levelling Up, Housing & Communities privacy notice", + "header": "Ministry of Housing, Communities and Local Government privacy notice", "description": "", "questions": { "declaration": { @@ -1145,7 +1145,7 @@ "type": "checkbox", "answer_options": { "declaration": { - "value": "The tenant has seen the DLUHC privacy notice" + "value": "The tenant has seen the MHCLG privacy notice" } } } diff --git a/config/forms/2022_2023.json b/config/forms/2022_2023.json index 7de00a07b..96fa8cfb4 100644 --- a/config/forms/2022_2023.json +++ b/config/forms/2022_2023.json @@ -1164,7 +1164,7 @@ ], "pages": { "declaration": { - "header": "Department for Levelling Up, Housing & Communities privacy notice", + "header": "Ministry of Housing, Communities and Local Government privacy notice", "description": "", "questions": { "declaration": { @@ -1175,7 +1175,7 @@ "type": "checkbox", "answer_options": { "declaration": { - "value": "The tenant has seen the DLUHC privacy notice" + "value": "The tenant has seen the MHCLG privacy notice" } } } diff --git a/config/locales/en.yml b/config/locales/en.yml index 9dcfed8c3..51ddfdc36 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -581,13 +581,13 @@ en: declaration: missing: - pre_2024: "You must show the DLUHC privacy notice to the tenant before you can submit this log." - post_2024: "You must show or give access to the DLUHC privacy notice to the tenant before you can submit this log." + pre_2024: "You must show the MHCLG privacy notice to the tenant before you can submit this log." + post_2024: "You must show or give access to the MHCLG privacy notice to the tenant before you can submit this log." privacynotice: missing: - pre_2024: "You must show the DLUHC privacy notice to the %{buyer_or_buyers} before you can submit this log." - post_2024: "You must show or give access to the DLUHC privacy notice to the %{buyer_or_buyers} before you can submit this log." + pre_2024: "You must show the MHCLG privacy notice to the %{buyer_or_buyers} before you can submit this log." + post_2024: "You must show or give access to the MHCLG privacy notice to the %{buyer_or_buyers} before you can submit this log." scheme: toggle_date: diff --git a/db/seeds.rb b/db/seeds.rb index 38125d8d1..2dd8570bc 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -61,7 +61,7 @@ unless Rails.env.test? ) org = Organisation.find_or_create_by!( - name: "DLUHC", + name: "MHCLG", address_line1: "2 Marsham Street", address_line2: "London", postcode: "SW1P 4DF", @@ -70,7 +70,7 @@ unless Rails.env.test? managing_agents_label: "None", provider_type: "LA", ) do - info = "Seeded DLUHC Organisation" + info = "Seeded MHCLG Organisation" if Rails.env.development? pp info else diff --git a/docs/adr/adr-001-initial-architecture-decisions.md b/docs/adr/adr-001-initial-architecture-decisions.md index dd69e546f..9951621a4 100644 --- a/docs/adr/adr-001-initial-architecture-decisions.md +++ b/docs/adr/adr-001-initial-architecture-decisions.md @@ -6,7 +6,7 @@ parent: Architecture decisions ## Ruby on Rails -- Well established and commonly used within DLUHC and GOV.UK in general +- Well established and commonly used within MHCLG and GOV.UK in general - Good ecosystem for common web app tasks, quick productivity - Matches team skill set - Analysis/RAP pipelines will sit in the DAP platform and not this application directly so optimising for web framework tasks makes sense. diff --git a/docs/adr/adr-004-gov-paas.md b/docs/adr/adr-004-gov-paas.md index e33d92618..5c2699c67 100644 --- a/docs/adr/adr-004-gov-paas.md +++ b/docs/adr/adr-004-gov-paas.md @@ -13,7 +13,7 @@ Production infrastructure sizing will be decided at a later time and once our ac The reasoning for this is: - Department policy is to use GOV.UK PaaS whenever possible -- DLUHC does not have a lot of internal dev ops skills/capacity so by leveraging GOV.UK PaaS we can leverage having most of the monitoring, running, scaling and security already provided. +- MHCLG does not have a lot of internal dev ops skills/capacity so by leveraging GOV.UK PaaS we can leverage having most of the monitoring, running, scaling and security already provided. - We get a simpler infrastructure setup than the AWS setup we currently have - All of the infrastructure we currently require is well supported on GOV.UK PaaS diff --git a/docs/adr/adr-010-admin-users-vs-users.md b/docs/adr/adr-010-admin-users-vs-users.md index d05371b74..5b72a3c48 100644 --- a/docs/adr/adr-010-admin-users-vs-users.md +++ b/docs/adr/adr-010-admin-users-vs-users.md @@ -6,7 +6,7 @@ parent: Architecture decisions ## Why do we have 2 user classes, `AdminUser` and `User`? -This is modelling a real life split. `AdminUsers` are internal DLUHC users or help desk employees. While `Users` are external users working at data providing organisations. So local authority/housing association’s "admin" users, i.e. Data Co-ordinators are a type of the User class. They have the ability to add or remove other users to or from their organisation, and to update their organisation details etc, but only through the designed UI. They do not get direct access to ActiveAdmin. +This is modelling a real life split. `AdminUsers` are internal MHCLG users or help desk employees. While `Users` are external users working at data providing organisations. So local authority/housing association’s "admin" users, i.e. Data Co-ordinators are a type of the User class. They have the ability to add or remove other users to or from their organisation, and to update their organisation details etc, but only through the designed UI. They do not get direct access to ActiveAdmin. AdminUsers on the other hand get direct access to ActiveAdmin. From there they can download entire datasets (via CSV, XML, JSON), view any log from any organisation, and add or remove users of any type including other Admin users. This means TDA will likely also require more stringent authentication for them using MFA (which users will likely not require). So the class split also helps there. diff --git a/docs/adr/adr-020-migration-to-aws.md b/docs/adr/adr-020-migration-to-aws.md index f7a900750..4892c835e 100644 --- a/docs/adr/adr-020-migration-to-aws.md +++ b/docs/adr/adr-020-migration-to-aws.md @@ -6,4 +6,4 @@ parent: Architecture decisions GOV.UK PaaS is being decomissioned at the end of this year and by 23 December 2023 all services hosted on GOV.UK PaaS will need to have migrated to an alternate hosting platform. -Like other DLUHC services, we are moving our service directly to DLUHC-owned AWS infrastructure. +Like other MHCLG services, we are moving our service directly to MHCLG-owned AWS infrastructure. diff --git a/docs/api/index.html b/docs/api/index.html index 5711eb9fa..7bc29b8cf 100644 --- a/docs/api/index.html +++ b/docs/api/index.html @@ -4,7 +4,7 @@ - DLUHC CORE Data Collection API + MHCLG CORE Data Collection API
      diff --git a/docs/api/v1.json b/docs/api/v1.json index 1caf96253..7d66f3eca 100644 --- a/docs/api/v1.json +++ b/docs/api/v1.json @@ -1,7 +1,7 @@ { "openapi": "3.0.0", "info": { - "title": "DLUHC CORE Data Collection API", + "title": "MHCLG CORE Data Collection API", "version": "1.0", "description": "Submit social housing lettings and sales data (CORE)" }, diff --git a/docs/index.md b/docs/index.md index b41df293c..97a62b034 100644 --- a/docs/index.md +++ b/docs/index.md @@ -4,13 +4,13 @@ nav_order: 1 # Overview -All lettings and and sales of social housing in England need to be logged with the Department for levelling up, housing and communities (DLUHC). This is done by data providing organisations: Local Authorities and Private Registered Providers (PRPs, i.e. housing associations). +All lettings and and sales of social housing in England need to be logged with the Ministry of Housing, Communities and Local Government (MHCLG). This is done by data providing organisations: Local Authorities and Private Registered Providers (PRPs, i.e. housing associations). Data is collected via a form that runs on an annual data collection window basis. Form changes are made annually to add new questions, remove any that are no longer needed, or adjust wording or answer options etc. Each data collection window runs from 1 April to 1 April the following year (plus an extra 3 months to allow for any late submissions). This means that between April and June, 2 collection windows are open simultaneously and logs can be submitted for either. -ADD (Analytics & Data Directorate) statisticians are the other primary users of the service. The data collected is transferred to DLUHCs consolidated data store (CDS) via nightly XML exports to an S3 bucket. CDS ingests and transforms this data, ultimately storing it in a MS SQL database and exposing it to analysts and statisticians via Amazon Workspaces. +ADD (Analytics & Data Directorate) statisticians are the other primary users of the service. The data collected is transferred to MHCLG's consolidated data store (CDS) via nightly XML exports to an S3 bucket. CDS ingests and transforms this data, ultimately storing it in a MS SQL database and exposing it to analysts and statisticians via Amazon Workspaces. ## Users diff --git a/docs/monitoring.md b/docs/monitoring.md index ce9e81a37..bbd5dcf64 100644 --- a/docs/monitoring.md +++ b/docs/monitoring.md @@ -14,7 +14,7 @@ From CloudWatch, navigate to the desired log group (e.g. for the app task runnin Alternatively, you can also navigate to a specific AWS service / resource in question (e.g. ECS tasks), selecting the instance of interest (e.g. a specific ECS task), and finding the “logs” tab (or similar) to view the log “events”. ### Sentry -To access Sentry, ensure you have been added to the DLUHC account. +To access Sentry, ensure you have been added to the MHCLG account. Generally error logs in Sentry will also be present somewhere in the CloudWatch logs, but they will be easier to assess here (e.g. number of occurrences over a time period). The logs in Sentry are created by the application when it makes Rails.logger.error calls. ## Debugging diff --git a/spec/components/lettings_log_summary_component_spec.rb b/spec/components/lettings_log_summary_component_spec.rb index 0c30a1fd8..52b6b1955 100644 --- a/spec/components/lettings_log_summary_component_spec.rb +++ b/spec/components/lettings_log_summary_component_spec.rb @@ -18,8 +18,8 @@ RSpec.describe LettingsLogSummaryComponent, type: :component do expect(result).to have_text("Tenancy starts #{Time.zone.today.strftime('%e %B %Y').strip}") expect(result).to have_text("Created #{Time.zone.today.strftime('%e %B %Y').strip}") expect(result).to have_text("Assigned to Danny Rojas") - expect(result).to have_content("Owned by\n DLUHC") - expect(result).to have_content("Managed by\n DLUHC") + expect(result).to have_content("Owned by\n MHCLG") + expect(result).to have_content("Managed by\n MHCLG") end end diff --git a/spec/components/sales_log_summary_component_spec.rb b/spec/components/sales_log_summary_component_spec.rb index 8635873af..ce9b3a45c 100644 --- a/spec/components/sales_log_summary_component_spec.rb +++ b/spec/components/sales_log_summary_component_spec.rb @@ -16,7 +16,7 @@ RSpec.describe SalesLogSummaryComponent, type: :component do it "shows the log summary with organisational relationships" do result = render_inline(described_class.new(current_user: support_user, log: sales_log)) - expect(result).to have_content("Owned by\n DLUHC") + expect(result).to have_content("Owned by\n MHCLG") expect(result).not_to have_content("Managed by") end end diff --git a/spec/factories/organisation.rb b/spec/factories/organisation.rb index f498632cd..6623ff355 100644 --- a/spec/factories/organisation.rb +++ b/spec/factories/organisation.rb @@ -1,6 +1,6 @@ FactoryBot.define do factory :organisation do - name { "DLUHC" } + name { "MHCLG" } address_line1 { "2 Marsham Street" } address_line2 { "London" } provider_type { "LA" } diff --git a/spec/features/lettings_log_spec.rb b/spec/features/lettings_log_spec.rb index a29047cbb..2b977fdd7 100644 --- a/spec/features/lettings_log_spec.rb +++ b/spec/features/lettings_log_spec.rb @@ -269,7 +269,7 @@ RSpec.describe "Lettings Log Features" do expect(breadcrumbs.length).to eq 3 expect(breadcrumbs[0].text).to eq "Home" expect(breadcrumbs[0][:href]).to eq root_path - expect(breadcrumbs[1].text).to eq "Lettings logs (DLUHC)" + expect(breadcrumbs[1].text).to eq "Lettings logs (MHCLG)" expect(breadcrumbs[1][:href]).to eq lettings_logs_organisation_path(lettings_log.owning_organisation) expect(breadcrumbs[2].text).to eq "Log #{lettings_log.id}" expect(breadcrumbs[2][:href]).to eq lettings_log_path(lettings_log) @@ -285,7 +285,7 @@ RSpec.describe "Lettings Log Features" do expect(breadcrumbs.length).to eq 3 expect(breadcrumbs[0].text).to eq "Home" expect(breadcrumbs[0][:href]).to eq root_path - expect(breadcrumbs[1].text).to eq "Lettings logs (DLUHC)" + expect(breadcrumbs[1].text).to eq "Lettings logs (MHCLG)" expect(breadcrumbs[1][:href]).to eq lettings_logs_organisation_path(lettings_log.owning_organisation) expect(breadcrumbs[2].text).to eq "Log #{lettings_log.id}" expect(breadcrumbs[2][:href]).to eq lettings_log_path(lettings_log) diff --git a/spec/features/sales_log_spec.rb b/spec/features/sales_log_spec.rb index 86469658c..779d978bf 100644 --- a/spec/features/sales_log_spec.rb +++ b/spec/features/sales_log_spec.rb @@ -259,7 +259,7 @@ RSpec.describe "Sales Log Features" do expect(breadcrumbs.length).to eq 3 expect(breadcrumbs[0].text).to eq "Home" expect(breadcrumbs[0][:href]).to eq root_path - expect(breadcrumbs[1].text).to eq "Sales logs (DLUHC)" + expect(breadcrumbs[1].text).to eq "Sales logs (MHCLG)" expect(breadcrumbs[1][:href]).to eq sales_logs_organisation_path(sales_log.owning_organisation) expect(breadcrumbs[2].text).to eq "Log #{sales_log.id}" expect(breadcrumbs[2][:href]).to eq sales_log_path(sales_log.id) @@ -273,7 +273,7 @@ RSpec.describe "Sales Log Features" do expect(breadcrumbs.length).to eq 3 expect(breadcrumbs[0].text).to eq "Home" expect(breadcrumbs[0][:href]).to eq root_path - expect(breadcrumbs[1].text).to eq "Sales logs (DLUHC)" + expect(breadcrumbs[1].text).to eq "Sales logs (MHCLG)" expect(breadcrumbs[1][:href]).to eq sales_logs_organisation_path(sales_log.owning_organisation) expect(breadcrumbs[2].text).to eq "Log #{sales_log.id}" expect(breadcrumbs[2][:href]).to eq sales_log_path(sales_log.id) diff --git a/spec/features/schemes_spec.rb b/spec/features/schemes_spec.rb index 7b94cb298..da80693ec 100644 --- a/spec/features/schemes_spec.rb +++ b/spec/features/schemes_spec.rb @@ -211,7 +211,7 @@ RSpec.describe "Schemes scheme Features" do end it "shows list of links to the organisation's schemes" do - click_on("Schemes (DLUHC)") + click_on("Schemes (MHCLG)") same_organisation_schemes.each do |scheme| expect(page).to have_link(scheme.service_name) expect(page).to have_content(scheme.id_to_display) diff --git a/spec/fixtures/exports/general_needs_log.csv b/spec/fixtures/exports/general_needs_log.csv index 3f50e0c25..9abb8c17e 100644 --- a/spec/fixtures/exports/general_needs_log.csv +++ b/spec/fixtures/exports/general_needs_log.csv @@ -1,2 +1,2 @@ status,tenancycode,age1,sex1,ethnic,national,prevten,ecstat1,hhmemb,age2,sex2,ecstat2,age3,sex3,ecstat3,age4,sex4,ecstat4,age5,sex5,ecstat5,age6,sex6,ecstat6,age7,sex7,ecstat7,age8,sex8,ecstat8,homeless,underoccupation_benefitcap,leftreg,reservist,illness,preg_occ,startertenancy,tenancylength,tenancy,ppostcode_full,rsnvac,unittype_gn,beds,offered,wchair,earnings,incfreq,benefits,period,layear,waityear,postcode_full,reasonpref,cbl,chr,cap,reasonother,housingneeds_a,housingneeds_b,housingneeds_c,housingneeds_f,housingneeds_g,housingneeds_h,illness_type_1,illness_type_2,illness_type_3,illness_type_4,illness_type_8,illness_type_5,illness_type_6,illness_type_7,illness_type_9,illness_type_10,rp_homeless,rp_insan_unsat,rp_medwel,rp_hardship,rp_dontknow,tenancyother,irproduct_other,reason,propcode,la,prevloc,hb,hbrentshortfall,mrcdate,incref,startdate,armedforces,unitletas,builtype,voiddate,renttype,needstype,lettype,totchild,totelder,totadult,nocharge,referral,brent,scharge,pscharge,supcharg,tcharge,tshortfall,chcharge,ppcodenk,has_benefits,renewal,wrent,wscharge,wpschrge,wsupchrg,wtcharge,wtshortfall,refused,housingneeds,wchchrg,newprop,relat2,relat3,relat4,relat5,relat6,relat7,relat8,lar,irproduct,joint,sheltered,hhtype,new_old,vacdays,uprn,uprn_known,uprn_confirmed,address_line1,address_line2,town_or_city,county,formid,owningorgid,owningorgname,hcnum,maningorgid,maningorgname,manhcnum,createddate,uploaddate -2,BZ737,35,F,2,13,6,0,2,32,M,6,,,,,,,,,,,,,,,,,,,1,4,4,1,1,2,1,5,4,SE2 6RT,6,7,3,2,1,68,1,1,2,2,7,NW1 5TY,1,2,1,2,,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,,,4,123,E09000003,E07000105,6,1,2020-05-05T10:36:49+01:00,0,2022-02-02T10:36:49+00:00,1,2,1,2019-11-03T00:00:00+00:00,2,1,7,0,0,2,0,2,200.0,50.0,40.0,35.0,325.0,12.0,,1,1,0,100.0,25.0,20.0,17.5,162.5,6.0,0,1,,2,P,,,,,,,,,3,,4,2,638,,0,,Address line 1,,London,,{id},{owning_org_id},DLUHC,1234,{managing_org_id},DLUHC,1234,2022-05-01T00:00:00+01:00,2022-05-01T00:00:00+01:00 +2,BZ737,35,F,2,13,6,0,2,32,M,6,,,,,,,,,,,,,,,,,,,1,4,4,1,1,2,1,5,4,SE2 6RT,6,7,3,2,1,68,1,1,2,2,7,NW1 5TY,1,2,1,2,,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,,,4,123,E09000003,E07000105,6,1,2020-05-05T10:36:49+01:00,0,2022-02-02T10:36:49+00:00,1,2,1,2019-11-03T00:00:00+00:00,2,1,7,0,0,2,0,2,200.0,50.0,40.0,35.0,325.0,12.0,,1,1,0,100.0,25.0,20.0,17.5,162.5,6.0,0,1,,2,P,,,,,,,,,3,,4,2,638,,0,,Address line 1,,London,,{id},{owning_org_id},MHCLG,1234,{managing_org_id},MHCLG,1234,2022-05-01T00:00:00+01:00,2022-05-01T00:00:00+01:00 diff --git a/spec/fixtures/exports/general_needs_log.xml b/spec/fixtures/exports/general_needs_log.xml index 98abfc438..bacc7e9f0 100644 --- a/spec/fixtures/exports/general_needs_log.xml +++ b/spec/fixtures/exports/general_needs_log.xml @@ -147,10 +147,10 @@ {id} {owning_org_id} - DLUHC + MHCLG 1234 {managing_org_id} - DLUHC + MHCLG 1234 2022-05-01T00:00:00+01:00 2022-05-01T00:00:00+01:00 diff --git a/spec/fixtures/exports/general_needs_log_23_24.xml b/spec/fixtures/exports/general_needs_log_23_24.xml index ae7dfb644..9635cd0e4 100644 --- a/spec/fixtures/exports/general_needs_log_23_24.xml +++ b/spec/fixtures/exports/general_needs_log_23_24.xml @@ -148,10 +148,10 @@ {id} {owning_org_id} - DLUHC + MHCLG 1234 {managing_org_id} - DLUHC + MHCLG 1234 2023-04-03T00:00:00+01:00 2023-04-03T00:00:00+01:00 diff --git a/spec/fixtures/exports/general_needs_log_24_25.xml b/spec/fixtures/exports/general_needs_log_24_25.xml index 8f14a362f..a665a284e 100644 --- a/spec/fixtures/exports/general_needs_log_24_25.xml +++ b/spec/fixtures/exports/general_needs_log_24_25.xml @@ -161,10 +161,10 @@ la as entered {id} {owning_org_id} - DLUHC + MHCLG 1234 {managing_org_id} - DLUHC + MHCLG 1234 2024-04-03T00:00:00+01:00 2024-04-03T00:00:00+01:00 diff --git a/spec/fixtures/exports/supported_housing_logs.xml b/spec/fixtures/exports/supported_housing_logs.xml index 35303ae37..50649241b 100644 --- a/spec/fixtures/exports/supported_housing_logs.xml +++ b/spec/fixtures/exports/supported_housing_logs.xml @@ -146,10 +146,10 @@ {id} {owning_org_id} - DLUHC + MHCLG 1234 {managing_org_id} - DLUHC + MHCLG 1234 2022-05-01T00:00:00+01:00 2022-05-01T00:00:00+01:00 diff --git a/spec/fixtures/files/2023_24_lettings_bulk_upload.csv b/spec/fixtures/files/2023_24_lettings_bulk_upload.csv index ea5a8a0b1..825a0b72d 100644 --- a/spec/fixtures/files/2023_24_lettings_bulk_upload.csv +++ b/spec/fixtures/files/2023_24_lettings_bulk_upload.csv @@ -1,5 +1,5 @@ ,Setting up this lettings log,,,,,,,,,,,,,,,,,Property information,,,,,,,,,,,,,,,,,,,,,Tenancy information,,,,,,Household characteristics,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,Household needs,,,,,,,,,,,,,,,,,,,,,Household situation,,,,,,,,,,,,,,,,,,,,"Income, benefits and outgoings",,,,,,,,,,,,,, -Question,Which organisation owns this property?,Which organisation manages this letting?,What is the CORE username of the account this letting log should be assigned to? ,What is the needs type?,What is the letting type?,Is this letting a renewal?,What is the tenancy start date? - day DD,What is the tenancy start date? - month MM,What is the tenancy start date? - year YY,Is this a London Affordable Rent letting?,Which type of Intermediate Rent is this letting?,Which 'Other' type of Intermediate Rent is this letting?,What is the tenant code?,What is the property reference?,What management group does this letting belong to?,What scheme does this letting belong to?,Which location is this letting for?,"If known, provide this property’s UPRN",Address Line 1,Address Line 2,Town or city,County,Part 1 of the property's postcode,Part 2 of the property's postcode,What is the property's local authority?,What type was the property most recently let as?,What is the reason for the property being vacant?,How many times was the property offered between becoming vacant and this letting?,What type of unit is the property?,Which type of building is the property?,Is the property built or adapted to wheelchair-user standards?,How many bedrooms does the property have?,What is the void date? - day DD,What is the void date? - month MM,What is the void date? - year YYYY,What date were any major repairs completed on? - day DD,What date were any major repairs completed on? - month MM,What date were any major repairs completed on? - year YY,Is this a joint tenancy?,Is this a starter tenancy?,What is the type of tenancy?,"If 'Other', what is the type of tenancy?",What is the length of the fixed-term tenancy to the nearest year?,Is this letting in sheltered accommodation?,Has the tenant seen the DLUHC privacy notice?,What is the lead tenant’s age?,Which of these best describes the lead tenant’s gender identity? ,Which of these best describes the lead tenant's ethnic background?,What is the lead tenant’s nationality?,Which of these best describes the lead tenant’s working situation?,What is person 2's relationship to the lead tenant?,What is person 2's age?,Which of these best describes person 2's gender identity?,Which of these best describes person 2's working situation?,What is person 3's relationship to the lead tenant?,What is person 3's age?,Which of these best describes person 3's gender identity?,Which of these best describes person 3's working situation?,What is person 4's relationship to the lead tenant?,What is person 4's age?,Which of these best describes person 4's gender identity?,Which of these best describes person 4's working situation?,What is person 5's relationship to the lead tenant?,What is person 5's age?,Which of these best describes person 5's gender identity?,Which of these best describes person 5's working situation?,What is person 6's relationship to the lead tenant?,What is person 6's age?,Which of these best describes person 6's gender identity?,Which of these best describes person 6's working situation?,What is person 7's relationship to the lead tenant?,What is person 7's age?,Which of these best describes person 7's gender identity?,Which of these best describes person 7's working situation?,What is person 8's relationship to the lead tenant?,What is person 8's age?,Which of these best describes person 8's gender identity?,Which of these best describes person 8's working situation?,Does anybody in the household have links to the UK armed forces?,Is this person still serving in the UK armed forces?,Was this person seriously injured or ill as a result of serving in the UK armed forces?,Is anybody in the household pregnant?,"Disabled access needs +Question,Which organisation owns this property?,Which organisation manages this letting?,What is the CORE username of the account this letting log should be assigned to? ,What is the needs type?,What is the letting type?,Is this letting a renewal?,What is the tenancy start date? - day DD,What is the tenancy start date? - month MM,What is the tenancy start date? - year YY,Is this a London Affordable Rent letting?,Which type of Intermediate Rent is this letting?,Which 'Other' type of Intermediate Rent is this letting?,What is the tenant code?,What is the property reference?,What management group does this letting belong to?,What scheme does this letting belong to?,Which location is this letting for?,"If known, provide this property’s UPRN",Address Line 1,Address Line 2,Town or city,County,Part 1 of the property's postcode,Part 2 of the property's postcode,What is the property's local authority?,What type was the property most recently let as?,What is the reason for the property being vacant?,How many times was the property offered between becoming vacant and this letting?,What type of unit is the property?,Which type of building is the property?,Is the property built or adapted to wheelchair-user standards?,How many bedrooms does the property have?,What is the void date? - day DD,What is the void date? - month MM,What is the void date? - year YYYY,What date were any major repairs completed on? - day DD,What date were any major repairs completed on? - month MM,What date were any major repairs completed on? - year YY,Is this a joint tenancy?,Is this a starter tenancy?,What is the type of tenancy?,"If 'Other', what is the type of tenancy?",What is the length of the fixed-term tenancy to the nearest year?,Is this letting in sheltered accommodation?,Has the tenant seen the MHCLG privacy notice?,What is the lead tenant’s age?,Which of these best describes the lead tenant’s gender identity? ,Which of these best describes the lead tenant's ethnic background?,What is the lead tenant’s nationality?,Which of these best describes the lead tenant’s working situation?,What is person 2's relationship to the lead tenant?,What is person 2's age?,Which of these best describes person 2's gender identity?,Which of these best describes person 2's working situation?,What is person 3's relationship to the lead tenant?,What is person 3's age?,Which of these best describes person 3's gender identity?,Which of these best describes person 3's working situation?,What is person 4's relationship to the lead tenant?,What is person 4's age?,Which of these best describes person 4's gender identity?,Which of these best describes person 4's working situation?,What is person 5's relationship to the lead tenant?,What is person 5's age?,Which of these best describes person 5's gender identity?,Which of these best describes person 5's working situation?,What is person 6's relationship to the lead tenant?,What is person 6's age?,Which of these best describes person 6's gender identity?,Which of these best describes person 6's working situation?,What is person 7's relationship to the lead tenant?,What is person 7's age?,Which of these best describes person 7's gender identity?,Which of these best describes person 7's working situation?,What is person 8's relationship to the lead tenant?,What is person 8's age?,Which of these best describes person 8's gender identity?,Which of these best describes person 8's working situation?,Does anybody in the household have links to the UK armed forces?,Is this person still serving in the UK armed forces?,Was this person seriously injured or ill as a result of serving in the UK armed forces?,Is anybody in the household pregnant?,"Disabled access needs a) Fully wheelchair-accessible housing","Disabled access needs diff --git a/spec/fixtures/files/2023_24_lettings_bulk_upload_empty_with_headers.csv b/spec/fixtures/files/2023_24_lettings_bulk_upload_empty_with_headers.csv index 7628c034f..8418dadc1 100644 --- a/spec/fixtures/files/2023_24_lettings_bulk_upload_empty_with_headers.csv +++ b/spec/fixtures/files/2023_24_lettings_bulk_upload_empty_with_headers.csv @@ -1,5 +1,5 @@ ,Setting up this lettings log,,,,,,,,,,,,,,,,,Property information,,,,,,,,,,,,,,,,,,,,,Tenancy information,,,,,,Household characteristics,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,Household needs,,,,,,,,,,,,,,,,,,,,,Household situation,,,,,,,,,,,,,,,,,,,,"Income, benefits and outgoings",,,,,,,,,,,,,, -Question,Which organisation owns this property?,Which organisation manages this letting?,What is the CORE username of the account this letting log should be assigned to? ,What is the needs type?,What is the letting type?,Is this letting a renewal?,What is the tenancy start date? - day DD,What is the tenancy start date? - month MM,What is the tenancy start date? - year YY,Is this a London Affordable Rent letting?,Which type of Intermediate Rent is this letting?,Which 'Other' type of Intermediate Rent is this letting?,What is the tenant code?,What is the property reference?,What management group does this letting belong to?,What scheme does this letting belong to?,Which location is this letting for?,"If known, provide this property’s UPRN",Address Line 1,Address Line 2,Town or city,County,Part 1 of the property's postcode,Part 2 of the property's postcode,What is the property's local authority?,What type was the property most recently let as?,What is the reason for the property being vacant?,How many times was the property offered between becoming vacant and this letting?,What type of unit is the property?,Which type of building is the property?,Is the property built or adapted to wheelchair-user standards?,How many bedrooms does the property have?,What is the void date? - day DD,What is the void date? - month MM,What is the void date? - year YYYY,What date were any major repairs completed on? - day DD,What date were any major repairs completed on? - month MM,What date were any major repairs completed on? - year YY,Is this a joint tenancy?,Is this a starter tenancy?,What is the type of tenancy?,"If 'Other', what is the type of tenancy?",What is the length of the fixed-term tenancy to the nearest year?,Is this letting in sheltered accommodation?,Has the tenant seen the DLUHC privacy notice?,What is the lead tenant’s age?,Which of these best describes the lead tenant’s gender identity? ,Which of these best describes the lead tenant's ethnic background?,What is the lead tenant’s nationality?,Which of these best describes the lead tenant’s working situation?,What is person 2's relationship to the lead tenant?,What is person 2's age?,Which of these best describes person 2's gender identity?,Which of these best describes person 2's working situation?,What is person 3's relationship to the lead tenant?,What is person 3's age?,Which of these best describes person 3's gender identity?,Which of these best describes person 3's working situation?,What is person 4's relationship to the lead tenant?,What is person 4's age?,Which of these best describes person 4's gender identity?,Which of these best describes person 4's working situation?,What is person 5's relationship to the lead tenant?,What is person 5's age?,Which of these best describes person 5's gender identity?,Which of these best describes person 5's working situation?,What is person 6's relationship to the lead tenant?,What is person 6's age?,Which of these best describes person 6's gender identity?,Which of these best describes person 6's working situation?,What is person 7's relationship to the lead tenant?,What is person 7's age?,Which of these best describes person 7's gender identity?,Which of these best describes person 7's working situation?,What is person 8's relationship to the lead tenant?,What is person 8's age?,Which of these best describes person 8's gender identity?,Which of these best describes person 8's working situation?,Does anybody in the household have links to the UK armed forces?,Is this person still serving in the UK armed forces?,Was this person seriously injured or ill as a result of serving in the UK armed forces?,Is anybody in the household pregnant?,"Disabled access needs +Question,Which organisation owns this property?,Which organisation manages this letting?,What is the CORE username of the account this letting log should be assigned to? ,What is the needs type?,What is the letting type?,Is this letting a renewal?,What is the tenancy start date? - day DD,What is the tenancy start date? - month MM,What is the tenancy start date? - year YY,Is this a London Affordable Rent letting?,Which type of Intermediate Rent is this letting?,Which 'Other' type of Intermediate Rent is this letting?,What is the tenant code?,What is the property reference?,What management group does this letting belong to?,What scheme does this letting belong to?,Which location is this letting for?,"If known, provide this property’s UPRN",Address Line 1,Address Line 2,Town or city,County,Part 1 of the property's postcode,Part 2 of the property's postcode,What is the property's local authority?,What type was the property most recently let as?,What is the reason for the property being vacant?,How many times was the property offered between becoming vacant and this letting?,What type of unit is the property?,Which type of building is the property?,Is the property built or adapted to wheelchair-user standards?,How many bedrooms does the property have?,What is the void date? - day DD,What is the void date? - month MM,What is the void date? - year YYYY,What date were any major repairs completed on? - day DD,What date were any major repairs completed on? - month MM,What date were any major repairs completed on? - year YY,Is this a joint tenancy?,Is this a starter tenancy?,What is the type of tenancy?,"If 'Other', what is the type of tenancy?",What is the length of the fixed-term tenancy to the nearest year?,Is this letting in sheltered accommodation?,Has the tenant seen the MHCLG privacy notice?,What is the lead tenant’s age?,Which of these best describes the lead tenant’s gender identity? ,Which of these best describes the lead tenant's ethnic background?,What is the lead tenant’s nationality?,Which of these best describes the lead tenant’s working situation?,What is person 2's relationship to the lead tenant?,What is person 2's age?,Which of these best describes person 2's gender identity?,Which of these best describes person 2's working situation?,What is person 3's relationship to the lead tenant?,What is person 3's age?,Which of these best describes person 3's gender identity?,Which of these best describes person 3's working situation?,What is person 4's relationship to the lead tenant?,What is person 4's age?,Which of these best describes person 4's gender identity?,Which of these best describes person 4's working situation?,What is person 5's relationship to the lead tenant?,What is person 5's age?,Which of these best describes person 5's gender identity?,Which of these best describes person 5's working situation?,What is person 6's relationship to the lead tenant?,What is person 6's age?,Which of these best describes person 6's gender identity?,Which of these best describes person 6's working situation?,What is person 7's relationship to the lead tenant?,What is person 7's age?,Which of these best describes person 7's gender identity?,Which of these best describes person 7's working situation?,What is person 8's relationship to the lead tenant?,What is person 8's age?,Which of these best describes person 8's gender identity?,Which of these best describes person 8's working situation?,Does anybody in the household have links to the UK armed forces?,Is this person still serving in the UK armed forces?,Was this person seriously injured or ill as a result of serving in the UK armed forces?,Is anybody in the household pregnant?,"Disabled access needs a) Fully wheelchair-accessible housing","Disabled access needs diff --git a/spec/fixtures/files/2023_24_lettings_bulk_upload_invalid.csv b/spec/fixtures/files/2023_24_lettings_bulk_upload_invalid.csv index 8c36c5884..222f08591 100644 --- a/spec/fixtures/files/2023_24_lettings_bulk_upload_invalid.csv +++ b/spec/fixtures/files/2023_24_lettings_bulk_upload_invalid.csv @@ -1,5 +1,5 @@ ,Setting up this lettings log,,,,,,,,,,,,,,,,,Property information,,,,,,,,,,,,,,,,,,,,,Tenancy information,,,,,,Household characteristics,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,Household needs,,,,,,,,,,,,,,,,,,,,,Household situation,,,,,,,,,,,,,,,,,,,,"Income, benefits and outgoings",,,,,,,,,,,,,, -Question,Which organisation owns this property?,Which organisation manages this letting?,What is the CORE username of the account this letting log should be assigned to? ,What is the needs type?,What is the letting type?,Is this letting a renewal?,What is the tenancy start date? - day DD,What is the tenancy start date? - month MM,What is the tenancy start date? - year YY,Is this a London Affordable Rent letting?,Which type of Intermediate Rent is this letting?,Which 'Other' type of Intermediate Rent is this letting?,What is the tenant code?,What is the property reference?,What management group does this letting belong to?,What scheme does this letting belong to?,Which location is this letting for?,"If known, provide this property’s UPRN",Address Line 1,Address Line 2,Town or city,County,Part 1 of the property's postcode,Part 2 of the property's postcode,What is the property's local authority?,What type was the property most recently let as?,What is the reason for the property being vacant?,How many times was the property offered between becoming vacant and this letting?,What type of unit is the property?,Which type of building is the property?,Is the property built or adapted to wheelchair-user standards?,How many bedrooms does the property have?,What is the void date? - day DD,What is the void date? - month MM,What is the void date? - year YYYY,What date were any major repairs completed on? - day DD,What date were any major repairs completed on? - month MM,What date were any major repairs completed on? - year YY,Is this a joint tenancy?,Is this a starter tenancy?,What is the type of tenancy?,"If 'Other', what is the type of tenancy?",What is the length of the fixed-term tenancy to the nearest year?,Is this letting in sheltered accommodation?,Has the tenant seen the DLUHC privacy notice?,What is the lead tenant’s age?,Which of these best describes the lead tenant’s gender identity? ,Which of these best describes the lead tenant's ethnic background?,What is the lead tenant’s nationality?,Which of these best describes the lead tenant’s working situation?,What is person 2's relationship to the lead tenant?,What is person 2's age?,Which of these best describes person 2's gender identity?,Which of these best describes person 2's working situation?,What is person 3's relationship to the lead tenant?,What is person 3's age?,Which of these best describes person 3's gender identity?,Which of these best describes person 3's working situation?,What is person 4's relationship to the lead tenant?,What is person 4's age?,Which of these best describes person 4's gender identity?,Which of these best describes person 4's working situation?,What is person 5's relationship to the lead tenant?,What is person 5's age?,Which of these best describes person 5's gender identity?,Which of these best describes person 5's working situation?,What is person 6's relationship to the lead tenant?,What is person 6's age?,Which of these best describes person 6's gender identity?,Which of these best describes person 6's working situation?,What is person 7's relationship to the lead tenant?,What is person 7's age?,Which of these best describes person 7's gender identity?,Which of these best describes person 7's working situation?,What is person 8's relationship to the lead tenant?,What is person 8's age?,Which of these best describes person 8's gender identity?,Which of these best describes person 8's working situation?,Does anybody in the household have links to the UK armed forces?,Is this person still serving in the UK armed forces?,Was this person seriously injured or ill as a result of serving in the UK armed forces?,Is anybody in the household pregnant?,"Disabled access needs +Question,Which organisation owns this property?,Which organisation manages this letting?,What is the CORE username of the account this letting log should be assigned to? ,What is the needs type?,What is the letting type?,Is this letting a renewal?,What is the tenancy start date? - day DD,What is the tenancy start date? - month MM,What is the tenancy start date? - year YY,Is this a London Affordable Rent letting?,Which type of Intermediate Rent is this letting?,Which 'Other' type of Intermediate Rent is this letting?,What is the tenant code?,What is the property reference?,What management group does this letting belong to?,What scheme does this letting belong to?,Which location is this letting for?,"If known, provide this property’s UPRN",Address Line 1,Address Line 2,Town or city,County,Part 1 of the property's postcode,Part 2 of the property's postcode,What is the property's local authority?,What type was the property most recently let as?,What is the reason for the property being vacant?,How many times was the property offered between becoming vacant and this letting?,What type of unit is the property?,Which type of building is the property?,Is the property built or adapted to wheelchair-user standards?,How many bedrooms does the property have?,What is the void date? - day DD,What is the void date? - month MM,What is the void date? - year YYYY,What date were any major repairs completed on? - day DD,What date were any major repairs completed on? - month MM,What date were any major repairs completed on? - year YY,Is this a joint tenancy?,Is this a starter tenancy?,What is the type of tenancy?,"If 'Other', what is the type of tenancy?",What is the length of the fixed-term tenancy to the nearest year?,Is this letting in sheltered accommodation?,Has the tenant seen the MHCLG privacy notice?,What is the lead tenant’s age?,Which of these best describes the lead tenant’s gender identity? ,Which of these best describes the lead tenant's ethnic background?,What is the lead tenant’s nationality?,Which of these best describes the lead tenant’s working situation?,What is person 2's relationship to the lead tenant?,What is person 2's age?,Which of these best describes person 2's gender identity?,Which of these best describes person 2's working situation?,What is person 3's relationship to the lead tenant?,What is person 3's age?,Which of these best describes person 3's gender identity?,Which of these best describes person 3's working situation?,What is person 4's relationship to the lead tenant?,What is person 4's age?,Which of these best describes person 4's gender identity?,Which of these best describes person 4's working situation?,What is person 5's relationship to the lead tenant?,What is person 5's age?,Which of these best describes person 5's gender identity?,Which of these best describes person 5's working situation?,What is person 6's relationship to the lead tenant?,What is person 6's age?,Which of these best describes person 6's gender identity?,Which of these best describes person 6's working situation?,What is person 7's relationship to the lead tenant?,What is person 7's age?,Which of these best describes person 7's gender identity?,Which of these best describes person 7's working situation?,What is person 8's relationship to the lead tenant?,What is person 8's age?,Which of these best describes person 8's gender identity?,Which of these best describes person 8's working situation?,Does anybody in the household have links to the UK armed forces?,Is this person still serving in the UK armed forces?,Was this person seriously injured or ill as a result of serving in the UK armed forces?,Is anybody in the household pregnant?,"Disabled access needs a) Fully wheelchair-accessible housing","Disabled access needs diff --git a/spec/fixtures/files/2023_24_sales_bulk_upload.csv b/spec/fixtures/files/2023_24_sales_bulk_upload.csv index ae39051b6..fb249a02b 100644 --- a/spec/fixtures/files/2023_24_sales_bulk_upload.csv +++ b/spec/fixtures/files/2023_24_sales_bulk_upload.csv @@ -1,12 +1,12 @@ -Section,Setting up this sales log,,,,,,,,,,,,,,,Property information,,,,,,,,,,,,,,Household characteristics,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,Household situation,,,,,,,,,,,Other household information,,,,,"Income, benefits and outgoings",,,,,,,,Sale information - Shared ownership,,,,,,,,,,,,,,,,,,,,,,,,,,,,,Sale information - Discounted ownership,,,,,,,,,,,,Sale information - Outright sale,,,,,,,, -Question,Which organisation owned this property before the sale?,What is the CORE username of the account this sale log should be assigned to? ,What is the sale completion date? - day DD,What is the sale completion date? - month MM,What is the sale completion date? - year YY,What is the purchaser code?,Was this purchase made through an ownership scheme?,What is the type of shared ownership sale?,What is the type of discounted ownership sale?,What is the type of outright sale?,"If 'Other', what is the type of outright sale?",Is the buyer a company?,Will the buyer(s) live in the property?,Is this a joint purchase?,Are there more than 2 joint buyers of this property?,How many bedrooms does the property have?,What type of unit is the property?,Which type of building is the property?,"If known, enter this property’s UPRN",Address Line 1,Address Line 2,Town or city,County,Part 1 of the property's postcode,Part 2 of the property's postcode,What is the property's local authority?,Is the property built or adapted to wheelchair-user standards?,Did you interview the buyer to answer these questions?,Has the buyer seen the DLUHC privacy notice?,What is buyer 1’s age?,Which of these best describes buyer 1's gender identity?,Which of the following best describes buyer 1's ethnic background?,What is buyer 1's nationality?,"If ""Any other country"", what is buyer 1's nationality?",Which of these best describes buyer 1’s working situation? ,Will buyer 1 live in the property?,What is buyer 2 or person 2's relationship to buyer 1?,What is buyer 2 or person 2's age?,Which of these best describes buyer 2 or person 2's gender identity?,Which of the following best describes buyer 2's ethnic background?,What is buyer 2's nationality?,"If ""Any other country"", what is buyer 2's nationality?",Which of these best describes buyer 2 or person 2’s working situation? ,Will buyer 2 live in the property?,"Besides the buyer(s), how many other people live or will live in the property?",What is person 3's relationship to buyer 1?,What is person 3's age?,Which of these best describes person 3's gender identity?,Which of these best describes person 3’s working situation? ,What is person 4's relationship to buyer 1?,What is person 4's age?,Which of these best describes person 4's gender identity?,Which of these best describes person 4’s working situation? ,What is person 5's relationship to buyer 1?,What is person 5's age?,Which of these best describes person 5's gender identity?,Which of these best describes person 5’s working situation? ,What is person 6's relationship to buyer 1?,What is person 6's age?,Which of these best describes person 6's gender identity?,Which of these best describes person 6’s working situation? ,What was buyer 1's previous tenure?,Do you know the postcode of buyer 1's last settled accommodation?,Part 1 of postcode of buyer 1's last settled accommodation,Part 2 of postcode of buyer 1's last settled accommodation,What is the local authority of buyer 1's last settled accommodation?,Was the buyer registered with their PRP (HA)?,Was the buyer registered with another PRP (HA)?,Was the buyer registered with the local authority?,Was the buyer registered with a Help to Buy agent?,"At the time of purchase, was buyer 2 living at the same address as buyer 1?",What was buyer 2's previous tenure?,"Have any of the buyers ever served as a regular in the UK armed forces? -",Is the buyer still serving in the UK armed forces?,Are any of the buyers a spouse or civil partner of a UK armed forces regular who died in service within the last 2 years?,Does anyone in the household consider themselves to have a disability?,Does anyone in the household use a wheelchair?,What is buyer 1's annual income?,Was buyer 1's income used for a mortgage application?,What is buyer 2's annual income?,Was buyer 2's income used for a mortgage application?,Were the buyers receiving any of these housing-related benefits immediately before buying this property?,What is the total amount the buyers had in savings before they paid any deposit for the property?,Have any of the buyers previously owned a property?,Was the previous property under shared ownership?,How long did the buyer(s) live in the property before purchasing it?,Is this a staircasing transaction?,What percentage of the property has been bought in this staircasing transaction?,What percentage of the property do the buyers now own in total?,Was this transaction part of a back-to-back staircasing transaction to facilitate sale of the home on the open market?,Is this a resale?,What is the day of the exchange of contracts date? - DD,What is the month of the exchange of contracts date? - MM,What is the year of the exchange of contracts date? - YY,What is the day of the practical completion or handover date? - DD,What is the month of the practical completion or handover date? - MM,What is the year of the practical completion or handover date? - YY,Was the household rehoused under a ‘local authority nominations agreement’?,"Was the buyer a private registered provider, housing association or local authority tenant immediately before the sale?",How many bedrooms did the buyer's previous property have?,What was the previous property type?,What was the buyer’s previous tenure?,What is the full purchase price?,What was the initial percentage equity stake purchased?,Was a mortgage used to buy this property?,What is the mortgage amount?,What is the name of the mortgage lender?,"If 'Other', what is the name of the mortgage lender?",What is the length of the mortgage in years?,Does this include any extra borrowing?,How much was the cash deposit paid on the property?,How much cash discount was given through Social HomeBuy?,What is the basic monthly rent?,What are the total monthly leasehold charges for the property?,How long did the buyer(s) live in the property before purchasing it?,What is the full purchase price?,"What was the amount of any loan, grant, discount or subsidy given?",What was the percentage discount?,Was a mortgage used to buy this property?,What is the mortgage amount?,What is the name of the mortgage lender?,"If 'Other', what is the name mortgage lender?",What is the length of the mortgage in years?,Does this include any extra borrowing?,How much was the cash deposit paid on the property?,What are the total monthly leasehold charges for the property?,What is the full purchase price?,Was a mortgage used to buy this property?,What is the mortgage amount?,What is the name of the mortgage lender?,"If 'Other', what is the name of the mortgage lender?",What is the length of the mortgage in years?,Does this include any extra borrowing?,How much was the cash deposit paid on the property?,What are the total monthly leasehold charges for the property? -Additional info,Provide the owning organisation's CORE ID code,"If using new CORE then this will be the email address. If left empty, the sale log will be assigned to the account used to upload the log. ",,,,,A shared ownership sale is when the purchaser buys up to 75% of the property value and pays rent to the Private Registered Provider (PRP) on the remaining portion.,,,,,,,,,"For bedsits, enter ‘1’",,,"The UPRN is the Unique Property Reference Number. It's created by the Ordnance Survey so it's a unique number system used across all housing providers, all sectors (i.e. not just social housing) and all across the UK.",,,,,,,,,You should still try to answer all questions even if the buyer wasn't interviewed in person,You should show the privacy notice to the buyer before completing this log,,,,,,,,,,,,,,,,"You can provide details for a maximum of 4 other people if there are 2 buyers, or 5 other people if there is only one buyer",,,,,,,,,,,,,,,,,,This is also known as the household's 'last settled home',,,,,,,,,,"A regular is somebody who has served in the Royal Navy, the Royal Marines, the Royal Air Force or army full time and does not include reserve forces",,,This includes any long-term health condition that has an impact on the person's day-to-day life,This can be inside or outside the home,"Provide the gross annual income (i.e. salary before tax) plus the annual amount of benefits, Universal Credit or pensions, and income from investments",,"Provide the gross annual income (i.e. salary before tax) plus the annual amount of benefits, Universal Credit or pensions, and income from investments",,,Enter their total savings to the nearest £10,,For any buyer,"If the buyers haven't been living in the property, enter '0'","A staircasing transaction is when the household purchases more shares in their property, increasing the proportion they own and decreasing the proportion the housing association owns. Once the household purchases 100% of the shares, they own the property.",,,,"If the social landlord has previously sold the property to another buyer and is now reselling the property, enter 'yes'. If this is the first time the property has been sold, enter 'no'.","This is the date on which the sale becomes legally binding with an exchange of signed contracts between the vendor and the buyer. Where properties are sold 'off plan' (such as while the property is still being built), the exchange of contracts date may happen before the practical completion or handover date.",,,This is the date on which the building contractor hands over responsibility for the completed property to the private registered provider (PRP).,,,A local authority nominations agreement is a written agreement between a local authority and private registered provider (PRP) that some or all of its sales vacancies are offered to local authorities for rehousing.,,"For bedsits, enter ‘1’",,,"Enter the full purchase price of the property before any discounts are applied. For shared ownership, enter the full purchase price paid for 100% equity (this is equal to the value of the share owned by the PRP plus the value bought by the purchaser).","Enter the amount of initial equity held by the purchaser (for example, 25% or 50%)",,,,,,This is 'Yes' if the mortgage includes borrowing beyond the purchase price of the property,Enter the total cash sum paid by the buyer towards the property that was not funded by the mortgage,Enter the total cash discount given on the property being purchased through the Social HomeBuy scheme,Before any charges,"For example, service and management charges",,"For all schemes, including Right to Acquire (RTA), Right to Buy (RTB), Voluntary Right to Buy (VRTB) or Preserved Right to Buy (PRTB) sales, enter the full price of the property without any discount","For all schemes except Right to Buy (RTB), Preserved Right to Buy (PRTB), Voluntary Right to Buy (VRTB) and Rent to Buy","For Right to Buy (RTB), Preserved Right to Buy (PRTB) and Voluntary Right to Buy (VRTB). For capped discount, enter capped %. If property is sold to an existing tenant under RTB, PRTB or VRTB, enter % discount from full market value.",,,,,,This is 'Yes' if the mortgage includes borrowing beyond the purchase price of the property,Enter the total cash sum paid by the purchaser towards the property that was not funded by the mortgage. This excludes any grant or loan.,"For example, service and management charges",,,,,,,This is 'Yes' if the mortgage includes borrowing beyond the purchase price of the property,Enter the total cash sum paid by the purchaser towards the property that was not funded by the mortgage. This excludes any grant or loan,"For example, service and management charges" -Values,Numeric,"Email format if using new CORE. -Alphanumeric, except for commas if using old CORE.",Jan-31,01-Dec,20 - 24,"Alphanumeric, max 9 characters",01-Mar,"2, 16, 18, 24, 28 or 30 - 32","8, 9, 14, 21, 22, 27 or 29",10 or 12,Alphanumeric,01-Feb,,,01-Mar,01-Sep,1 - 4 or 9,01-Feb,"Numeric, max 12 digits",Alphanumeric,,Text,,XX(XX),XXX,"ONS CODE: Alphanumeric, 9 characters beginning with 'E'",01-Mar,01-Feb,1,"16 - 110 - or R","F, M, X or R",Jan-19,"12 - 13, 17 - 19",Text,0 - 8 or 10,01-Feb,"P, C, X or R",1 - 110 or R,"F, M, X or R",Jan-19,"12 - 13, 17 - 19",Text,0 - 10,01-Feb,0 - 5,"P, C, X or R",1 - 110 or R,"F, M, X or R",0 - 10,"P, C, X or R",1 - 110 or R,"F, M, X or R",0 - 10,"P, C, X or R",1 - 110 or R,"F, M, X or R",0 - 10,"P, C, X or R",1 - 110 or R,"F, M, X or R",0 - 10,"1 - 7, 9 or R",01-Feb,XX(XX),XXX,"ONS CODE: Alphanumeric, 9 characters beginning with 'E'",1 or empty,,,,01-Mar,"1 - 7, 9 or R","1, 3, 7 or 8",04-Jun,04-Jul,01-Mar,,0 - 99999 or R,01-Feb,0 - 99999 or R,01-Feb,01-Apr,0 - 999990 or R,01-Mar,,Integer <= 80,01-Mar,1 - 100,,01-Mar,01-Feb,Jan-31,01-Dec,22 - 24,Jan-31,01-Dec,22 - 24,01-Mar,01-Feb,01-Sep,1 - 4 or 9,1 - 3 or 9 - 10,0 - 999999,0 - 100,01-Feb,0 - 999999,Jan-40,Alphanumeric,Integer <= 60,01-Mar,0 - 999999,,0 - 9999.99,,Integer <= 80,0 - 999999,,0 - 100,01-Feb,0 - 999999,Jan-40,Alphanumeric,Integer <= 60,01-Mar,0 - 999999,0 - 999.99,0 - 999999,01-Feb,0 - 999999,Jan-40,Alphanumeric,Integer <= 60,01-Mar,0 - 999999,0 - 9999.99 -Can be empty?,No,Yes,No,,,Yes,No,"Yes, if the purchase was not made through a shared ownership scheme (if field 7 = 2 or 3)","Yes, if the purchase was not made through a discounted ownership scheme (if field 7 = 1 or 3)","Yes, if the purchase was not an outright sale (if field 7 = 1 or 2)","Yes, if 'Other' is not selected for type of outright sale (if field 10 is not 12)","Yes, if the purchase was not an outright sale (if field 7 = 1 or 2)",,No,"Yes, if the sale is not a joint purchase (if field 14 = 2)",No,,,"Yes, if property's full address is known (if fields 20, 22, and 24 - 25 are not empty)","Yes, if property's UPRN is known (if field 19 is not empty)",Yes,"Yes, if property's UPRN is known (if field 19 is not empty)",Yes,"Yes, if property's UPRN and local authority are known (if fields 19 and 26 are not empty",,No,,Yes,No,"Yes, if buyer is a company (if field 12 = 1)",,,,"Yes, if buyer is a company (if field 12 = 1) or if ""Any other country"" is not selected for buyer 1's nationality (if field 33 is not 12)","Yes, if buyer is a company (if field 12 = 1)",,"Yes, if buyer is a company (if field 12 = 1), or if sale is not a joint purchase (if field 14 = 2) and the other fields about this person (fields 38, 39 and 43) are also empty","Yes, if buyer is a company (if field 12 = 1), or if sale is not a joint purchase (if field 14 = 2) and the other fields about this person (fields 37, 39 and 43) are also empty","Yes, if buyer is a company (if field 12 = 1), or if sale is not a joint purchase (if field 14 = 2) and the other fields about this person (fields 37, 38 and 43) are also empty","Yes, if buyer is a company (if field 12 = 1) or if sale is not a joint purchase (if field 14 = 2)",,"Yes, if buyer is a company (if field 12 = 1) or if ""Any other country"" is not selected for buyer 2's nationality (if field 41 is not 12)","Yes, if buyer is a company (if field 12 = 1), or if sale is not a joint purchase (if field 14 = 2) and the other fields about this person (fields 37, 38 and 39) are also empty","Yes, if buyer is a company (if field 12 = 1) or if sale is not a joint purchase (if field 14 = 2)","Yes, if buyer is a company (if field 12 = 1)","Yes, if the other fields about this person (fields 47, 48 and 49) are also empty","Yes, if the other fields about this person (fields 46, 48 and 49) are also empty","Yes, if the other fields about this person (fields 46, 47 and 49) are also empty","Yes, if the other fields about this person (fields 46, 47 and 48) are also empty","Yes, if the other fields about this person (fields 51, 52 and 53) are also empty","Yes, if the other fields about this person (fields 50, 52 and 53) are also empty","Yes, if the other fields about this person (fields 50, 51 and 53) are also empty","Yes, if the other fields about this person (fields 50, 51 and 52) are also empty","Yes, if the other fields about this person (fields 55, 56 and 57) are also empty","Yes, if the other fields about this person (fields 54, 56 and 57) are also empty","Yes, if the other fields about this person (fields 54, 55 and 57) are also empty","Yes, if the other fields about this person (fields 54, 55 and 56) are also empty","Yes, if the other fields about this person (fields 59, 60 and 61) are also empty","Yes, if the other fields about this person (fields 58, 60 and 61) are also empty","Yes, if the other fields about this person (fields 58, 59 and 61) are also empty","Yes, if the other fields about this person (fields 58, 59 and 60) are also empty",No,,"Yes, if postcode of buyer 1's last settled accommodation is unknown (if field 63 = 2)",,Yes,Yes,,,,"Yes, if sale is not a joint purchase (if field 14 = 2)","Yes, if sale is not a joint purchase (if field 14 = 2), or if buyer is not known to have been living at the same address as buyer 1 at the time of purchase (if field 71 = 1 or 3)",No,"Yes, if none of the buyers are known to have served as a regular in the UK armed forces (if field 73 = 7, 3 or 8)",No,,,No,"Yes, if buyer 1's income is not known (if field 78 = R)","Yes, if sale is not a joint purchase (if field 14 = 2)","Yes, if sale is not a joint purchase (if field 14 = 2) or if buyer 2's income is not known (if field 80 = R)",No,,,"Yes, if the purchasers did not previously own a property or if it is not known (if field 84 = 2 or 3)","Yes, if the purchase was not made through a shared ownership scheme (if field 7 = 2 or 3)",,"Yes, if the purchase was not made through a shared ownership scheme (if field 7 = 2 or 3) or if this is not known to be a staircasing transaction (if field 87 = 2 or 3)",,,"Yes, if the purchase was not made through a shared ownership scheme (if field 7 = 2 or 3) or if this is a staircasing transaction (if field 87 = 1)","Yes, if the purchase was not made through a shared ownership scheme (if field 7 = 2 or 3), if this is a resale (if field 91 = 1) or if this is a staircasing transaction (if field 87 = 1)",,,,,,"Yes, if the purchase was not made through a shared ownership scheme (if field 7 = 2 or 3)",,"Yes, if the purchase was not made through a shared ownership scheme (if field 7 = 2 or 3) or if the buyer was not a private registered provider, housing association or local authority tenant immediately before sale (if field 99 = 2)",,,"Yes, if the purchase was not made through a shared ownership scheme (if field 7 = 2 or 3)",,,"Yes, if the purchase was not made through a shared ownership scheme (if field 7 = 2 or 3) or if a mortgage was not used (if field 105 = 2)",,"Yes, if the purchase was not made through a shared ownership scheme (if field 7 = 2 or 3), if a mortgage was not used (if field 105 = 2) or if 'Other' is not selected for mortgage lender name (if field 107 is not 40)","Yes, if the purchase was not made through a shared ownership scheme (if field 7 = 2 or 3) or if a mortgage was not used (if field 105 = 2)",,"Yes, if the purchase was not made through a shared ownership scheme (if field 7 = 2 or 3)","Yes, if the purchase was not made through a shared ownership scheme (if field 7 = 2 or 3) or the type of shared ownership sale is not Social Homebuy (if field 8 is not 18)","Yes, if the purchase was not made through a shared ownership scheme (if field 7 = 2 or 3)",,"Yes, if the purchase was not made through a discounted ownership scheme (if field 7 = 1 or 3)",,"Yes, if the purchase was not made through a discounted ownership scheme (if field 7 = 1 or 3) or if the type of discounted sale is PRTB, VRTB, RTB, or Rent to Buy (if field 9 is null, 9, 14, 27 or 29)","Yes, if the purchase was not made through a discounted ownership scheme (if field 7 = 1 or 3 or if the type of discounted sale is not PRTB, VRTB, or RTB (if field 9 is null, 8, 29, 21, 22)","Yes, if the purchase was not made through a discounted ownership scheme (if field 7 = 1 or 3)","Yes, if the purchase was not made through a discounted ownership scheme (if field 7 = 1 or 3) or if a mortgage was not used (if field 119 = 2)",,"Yes, if the purchase was not made through a discounted ownership scheme (if field 7 = 1 or 3), if a mortgage was not used (if field 119 = 2) or if 'Other' is not selected for mortgage lender name (if field 121 is not 40)","Yes, if the purchase was not made through a discounted ownership scheme (if field 7 = 1 or 3) or if a mortgage was not used (if field 119 = 2)",,"Yes, if the purchase was not made through a discounted ownership scheme (if field 7 = 1 or 3)",,"Yes, if the purchase was not an outright sale (if field 7 = 1 or 2)",,"Yes, if the purchase was not an outright sale (if field 7 = 1 or 2) or if a mortgage was not used (if field 128 = 2)",,"Yes, if the purchase was not an outright sale (if field 7 = 1 or 2), if a mortgage was not used (if field 128 = 2), or if 'Other' is not selected for mortgage lender name (if field 130 is not 40)","Yes, if the purchase was not an outright sale (if field 7 = 1 or 2) or if a mortgage was not used (if field 128 = 2)",,"Yes, if the purchase was not an outright sale (if field 7 = 1 or 2)", -Types of sales the question applies to,,,,,,,,Shared ownership only,Discounted ownership only,Outright sale only,,,,,Joint purchase only,,,,,,,,,,,,,,,,,,,,,,,,,Joint purchase only,,,,Joint purchase only,,,,,,,,,,,,,,,,,,,,,,,,,,,Joint purchase only,,,,,,,,,Joint purchase only,,,,,Shared ownership only,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,Discounted ownership only,,,,,,,,,,,,Outright sale only,,,,,,,, -Duplicate check field?,Yes,,Yes,,,,,,,,,,,,,,,,,,,,,Yes,,,,,,Yes,,,,,Yes,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, -Field number,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135 -,123,,2,10,23,23 test BU,1,2,,,,,M,1,2,1,1,1,,123,,123,,A1,1AA,E07000223,1,1,1,32,X,1,12,1,1,1,P,33,X,1,12,1,1,1,0,,,,,,,,,,,,,,,,,1,3,A1,1AA,1,1,250000,25,42500,3,21000,8,800,7,1,1,,1,,1,1,,1,1,,1,10,10,1,,123,,,3,,5,1,1,1,1,1,200000,25,1,200000,1,,2,1,50000,1,1,,1,1,1,1,0,10,10,1,1,,,,,,,,,,,, +Section,Setting up this sales log,,,,,,,,,,,,,,,Property information,,,,,,,,,,,,,,Household characteristics,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,Household situation,,,,,,,,,,,Other household information,,,,,"Income, benefits and outgoings",,,,,,,,Sale information - Shared ownership,,,,,,,,,,,,,,,,,,,,,,,,,,,,,Sale information - Discounted ownership,,,,,,,,,,,,Sale information - Outright sale,,,,,,,, +Question,Which organisation owned this property before the sale?,What is the CORE username of the account this sale log should be assigned to? ,What is the sale completion date? - day DD,What is the sale completion date? - month MM,What is the sale completion date? - year YY,What is the purchaser code?,Was this purchase made through an ownership scheme?,What is the type of shared ownership sale?,What is the type of discounted ownership sale?,What is the type of outright sale?,"If 'Other', what is the type of outright sale?",Is the buyer a company?,Will the buyer(s) live in the property?,Is this a joint purchase?,Are there more than 2 joint buyers of this property?,How many bedrooms does the property have?,What type of unit is the property?,Which type of building is the property?,"If known, enter this property’s UPRN",Address Line 1,Address Line 2,Town or city,County,Part 1 of the property's postcode,Part 2 of the property's postcode,What is the property's local authority?,Is the property built or adapted to wheelchair-user standards?,Did you interview the buyer to answer these questions?,Has the buyer seen the MHCLG privacy notice?,What is buyer 1’s age?,Which of these best describes buyer 1's gender identity?,Which of the following best describes buyer 1's ethnic background?,What is buyer 1's nationality?,"If ""Any other country"", what is buyer 1's nationality?",Which of these best describes buyer 1’s working situation? ,Will buyer 1 live in the property?,What is buyer 2 or person 2's relationship to buyer 1?,What is buyer 2 or person 2's age?,Which of these best describes buyer 2 or person 2's gender identity?,Which of the following best describes buyer 2's ethnic background?,What is buyer 2's nationality?,"If ""Any other country"", what is buyer 2's nationality?",Which of these best describes buyer 2 or person 2’s working situation? ,Will buyer 2 live in the property?,"Besides the buyer(s), how many other people live or will live in the property?",What is person 3's relationship to buyer 1?,What is person 3's age?,Which of these best describes person 3's gender identity?,Which of these best describes person 3’s working situation? ,What is person 4's relationship to buyer 1?,What is person 4's age?,Which of these best describes person 4's gender identity?,Which of these best describes person 4’s working situation? ,What is person 5's relationship to buyer 1?,What is person 5's age?,Which of these best describes person 5's gender identity?,Which of these best describes person 5’s working situation? ,What is person 6's relationship to buyer 1?,What is person 6's age?,Which of these best describes person 6's gender identity?,Which of these best describes person 6’s working situation? ,What was buyer 1's previous tenure?,Do you know the postcode of buyer 1's last settled accommodation?,Part 1 of postcode of buyer 1's last settled accommodation,Part 2 of postcode of buyer 1's last settled accommodation,What is the local authority of buyer 1's last settled accommodation?,Was the buyer registered with their PRP (HA)?,Was the buyer registered with another PRP (HA)?,Was the buyer registered with the local authority?,Was the buyer registered with a Help to Buy agent?,"At the time of purchase, was buyer 2 living at the same address as buyer 1?",What was buyer 2's previous tenure?,"Have any of the buyers ever served as a regular in the UK armed forces? +",Is the buyer still serving in the UK armed forces?,Are any of the buyers a spouse or civil partner of a UK armed forces regular who died in service within the last 2 years?,Does anyone in the household consider themselves to have a disability?,Does anyone in the household use a wheelchair?,What is buyer 1's annual income?,Was buyer 1's income used for a mortgage application?,What is buyer 2's annual income?,Was buyer 2's income used for a mortgage application?,Were the buyers receiving any of these housing-related benefits immediately before buying this property?,What is the total amount the buyers had in savings before they paid any deposit for the property?,Have any of the buyers previously owned a property?,Was the previous property under shared ownership?,How long did the buyer(s) live in the property before purchasing it?,Is this a staircasing transaction?,What percentage of the property has been bought in this staircasing transaction?,What percentage of the property do the buyers now own in total?,Was this transaction part of a back-to-back staircasing transaction to facilitate sale of the home on the open market?,Is this a resale?,What is the day of the exchange of contracts date? - DD,What is the month of the exchange of contracts date? - MM,What is the year of the exchange of contracts date? - YY,What is the day of the practical completion or handover date? - DD,What is the month of the practical completion or handover date? - MM,What is the year of the practical completion or handover date? - YY,Was the household rehoused under a ‘local authority nominations agreement’?,"Was the buyer a private registered provider, housing association or local authority tenant immediately before the sale?",How many bedrooms did the buyer's previous property have?,What was the previous property type?,What was the buyer’s previous tenure?,What is the full purchase price?,What was the initial percentage equity stake purchased?,Was a mortgage used to buy this property?,What is the mortgage amount?,What is the name of the mortgage lender?,"If 'Other', what is the name of the mortgage lender?",What is the length of the mortgage in years?,Does this include any extra borrowing?,How much was the cash deposit paid on the property?,How much cash discount was given through Social HomeBuy?,What is the basic monthly rent?,What are the total monthly leasehold charges for the property?,How long did the buyer(s) live in the property before purchasing it?,What is the full purchase price?,"What was the amount of any loan, grant, discount or subsidy given?",What was the percentage discount?,Was a mortgage used to buy this property?,What is the mortgage amount?,What is the name of the mortgage lender?,"If 'Other', what is the name mortgage lender?",What is the length of the mortgage in years?,Does this include any extra borrowing?,How much was the cash deposit paid on the property?,What are the total monthly leasehold charges for the property?,What is the full purchase price?,Was a mortgage used to buy this property?,What is the mortgage amount?,What is the name of the mortgage lender?,"If 'Other', what is the name of the mortgage lender?",What is the length of the mortgage in years?,Does this include any extra borrowing?,How much was the cash deposit paid on the property?,What are the total monthly leasehold charges for the property? +Additional info,Provide the owning organisation's CORE ID code,"If using new CORE then this will be the email address. If left empty, the sale log will be assigned to the account used to upload the log. ",,,,,A shared ownership sale is when the purchaser buys up to 75% of the property value and pays rent to the Private Registered Provider (PRP) on the remaining portion.,,,,,,,,,"For bedsits, enter ‘1’",,,"The UPRN is the Unique Property Reference Number. It's created by the Ordnance Survey so it's a unique number system used across all housing providers, all sectors (i.e. not just social housing) and all across the UK.",,,,,,,,,You should still try to answer all questions even if the buyer wasn't interviewed in person,You should show the privacy notice to the buyer before completing this log,,,,,,,,,,,,,,,,"You can provide details for a maximum of 4 other people if there are 2 buyers, or 5 other people if there is only one buyer",,,,,,,,,,,,,,,,,,This is also known as the household's 'last settled home',,,,,,,,,,"A regular is somebody who has served in the Royal Navy, the Royal Marines, the Royal Air Force or army full time and does not include reserve forces",,,This includes any long-term health condition that has an impact on the person's day-to-day life,This can be inside or outside the home,"Provide the gross annual income (i.e. salary before tax) plus the annual amount of benefits, Universal Credit or pensions, and income from investments",,"Provide the gross annual income (i.e. salary before tax) plus the annual amount of benefits, Universal Credit or pensions, and income from investments",,,Enter their total savings to the nearest £10,,For any buyer,"If the buyers haven't been living in the property, enter '0'","A staircasing transaction is when the household purchases more shares in their property, increasing the proportion they own and decreasing the proportion the housing association owns. Once the household purchases 100% of the shares, they own the property.",,,,"If the social landlord has previously sold the property to another buyer and is now reselling the property, enter 'yes'. If this is the first time the property has been sold, enter 'no'.","This is the date on which the sale becomes legally binding with an exchange of signed contracts between the vendor and the buyer. Where properties are sold 'off plan' (such as while the property is still being built), the exchange of contracts date may happen before the practical completion or handover date.",,,This is the date on which the building contractor hands over responsibility for the completed property to the private registered provider (PRP).,,,A local authority nominations agreement is a written agreement between a local authority and private registered provider (PRP) that some or all of its sales vacancies are offered to local authorities for rehousing.,,"For bedsits, enter ‘1’",,,"Enter the full purchase price of the property before any discounts are applied. For shared ownership, enter the full purchase price paid for 100% equity (this is equal to the value of the share owned by the PRP plus the value bought by the purchaser).","Enter the amount of initial equity held by the purchaser (for example, 25% or 50%)",,,,,,This is 'Yes' if the mortgage includes borrowing beyond the purchase price of the property,Enter the total cash sum paid by the buyer towards the property that was not funded by the mortgage,Enter the total cash discount given on the property being purchased through the Social HomeBuy scheme,Before any charges,"For example, service and management charges",,"For all schemes, including Right to Acquire (RTA), Right to Buy (RTB), Voluntary Right to Buy (VRTB) or Preserved Right to Buy (PRTB) sales, enter the full price of the property without any discount","For all schemes except Right to Buy (RTB), Preserved Right to Buy (PRTB), Voluntary Right to Buy (VRTB) and Rent to Buy","For Right to Buy (RTB), Preserved Right to Buy (PRTB) and Voluntary Right to Buy (VRTB). For capped discount, enter capped %. If property is sold to an existing tenant under RTB, PRTB or VRTB, enter % discount from full market value.",,,,,,This is 'Yes' if the mortgage includes borrowing beyond the purchase price of the property,Enter the total cash sum paid by the purchaser towards the property that was not funded by the mortgage. This excludes any grant or loan.,"For example, service and management charges",,,,,,,This is 'Yes' if the mortgage includes borrowing beyond the purchase price of the property,Enter the total cash sum paid by the purchaser towards the property that was not funded by the mortgage. This excludes any grant or loan,"For example, service and management charges" +Values,Numeric,"Email format if using new CORE. +Alphanumeric, except for commas if using old CORE.",Jan-31,01-Dec,20 - 24,"Alphanumeric, max 9 characters",01-Mar,"2, 16, 18, 24, 28 or 30 - 32","8, 9, 14, 21, 22, 27 or 29",10 or 12,Alphanumeric,01-Feb,,,01-Mar,01-Sep,1 - 4 or 9,01-Feb,"Numeric, max 12 digits",Alphanumeric,,Text,,XX(XX),XXX,"ONS CODE: Alphanumeric, 9 characters beginning with 'E'",01-Mar,01-Feb,1,"16 - 110 + or R","F, M, X or R",Jan-19,"12 - 13, 17 - 19",Text,0 - 8 or 10,01-Feb,"P, C, X or R",1 - 110 or R,"F, M, X or R",Jan-19,"12 - 13, 17 - 19",Text,0 - 10,01-Feb,0 - 5,"P, C, X or R",1 - 110 or R,"F, M, X or R",0 - 10,"P, C, X or R",1 - 110 or R,"F, M, X or R",0 - 10,"P, C, X or R",1 - 110 or R,"F, M, X or R",0 - 10,"P, C, X or R",1 - 110 or R,"F, M, X or R",0 - 10,"1 - 7, 9 or R",01-Feb,XX(XX),XXX,"ONS CODE: Alphanumeric, 9 characters beginning with 'E'",1 or empty,,,,01-Mar,"1 - 7, 9 or R","1, 3, 7 or 8",04-Jun,04-Jul,01-Mar,,0 - 99999 or R,01-Feb,0 - 99999 or R,01-Feb,01-Apr,0 - 999990 or R,01-Mar,,Integer <= 80,01-Mar,1 - 100,,01-Mar,01-Feb,Jan-31,01-Dec,22 - 24,Jan-31,01-Dec,22 - 24,01-Mar,01-Feb,01-Sep,1 - 4 or 9,1 - 3 or 9 - 10,0 - 999999,0 - 100,01-Feb,0 - 999999,Jan-40,Alphanumeric,Integer <= 60,01-Mar,0 - 999999,,0 - 9999.99,,Integer <= 80,0 - 999999,,0 - 100,01-Feb,0 - 999999,Jan-40,Alphanumeric,Integer <= 60,01-Mar,0 - 999999,0 - 999.99,0 - 999999,01-Feb,0 - 999999,Jan-40,Alphanumeric,Integer <= 60,01-Mar,0 - 999999,0 - 9999.99 +Can be empty?,No,Yes,No,,,Yes,No,"Yes, if the purchase was not made through a shared ownership scheme (if field 7 = 2 or 3)","Yes, if the purchase was not made through a discounted ownership scheme (if field 7 = 1 or 3)","Yes, if the purchase was not an outright sale (if field 7 = 1 or 2)","Yes, if 'Other' is not selected for type of outright sale (if field 10 is not 12)","Yes, if the purchase was not an outright sale (if field 7 = 1 or 2)",,No,"Yes, if the sale is not a joint purchase (if field 14 = 2)",No,,,"Yes, if property's full address is known (if fields 20, 22, and 24 - 25 are not empty)","Yes, if property's UPRN is known (if field 19 is not empty)",Yes,"Yes, if property's UPRN is known (if field 19 is not empty)",Yes,"Yes, if property's UPRN and local authority are known (if fields 19 and 26 are not empty",,No,,Yes,No,"Yes, if buyer is a company (if field 12 = 1)",,,,"Yes, if buyer is a company (if field 12 = 1) or if ""Any other country"" is not selected for buyer 1's nationality (if field 33 is not 12)","Yes, if buyer is a company (if field 12 = 1)",,"Yes, if buyer is a company (if field 12 = 1), or if sale is not a joint purchase (if field 14 = 2) and the other fields about this person (fields 38, 39 and 43) are also empty","Yes, if buyer is a company (if field 12 = 1), or if sale is not a joint purchase (if field 14 = 2) and the other fields about this person (fields 37, 39 and 43) are also empty","Yes, if buyer is a company (if field 12 = 1), or if sale is not a joint purchase (if field 14 = 2) and the other fields about this person (fields 37, 38 and 43) are also empty","Yes, if buyer is a company (if field 12 = 1) or if sale is not a joint purchase (if field 14 = 2)",,"Yes, if buyer is a company (if field 12 = 1) or if ""Any other country"" is not selected for buyer 2's nationality (if field 41 is not 12)","Yes, if buyer is a company (if field 12 = 1), or if sale is not a joint purchase (if field 14 = 2) and the other fields about this person (fields 37, 38 and 39) are also empty","Yes, if buyer is a company (if field 12 = 1) or if sale is not a joint purchase (if field 14 = 2)","Yes, if buyer is a company (if field 12 = 1)","Yes, if the other fields about this person (fields 47, 48 and 49) are also empty","Yes, if the other fields about this person (fields 46, 48 and 49) are also empty","Yes, if the other fields about this person (fields 46, 47 and 49) are also empty","Yes, if the other fields about this person (fields 46, 47 and 48) are also empty","Yes, if the other fields about this person (fields 51, 52 and 53) are also empty","Yes, if the other fields about this person (fields 50, 52 and 53) are also empty","Yes, if the other fields about this person (fields 50, 51 and 53) are also empty","Yes, if the other fields about this person (fields 50, 51 and 52) are also empty","Yes, if the other fields about this person (fields 55, 56 and 57) are also empty","Yes, if the other fields about this person (fields 54, 56 and 57) are also empty","Yes, if the other fields about this person (fields 54, 55 and 57) are also empty","Yes, if the other fields about this person (fields 54, 55 and 56) are also empty","Yes, if the other fields about this person (fields 59, 60 and 61) are also empty","Yes, if the other fields about this person (fields 58, 60 and 61) are also empty","Yes, if the other fields about this person (fields 58, 59 and 61) are also empty","Yes, if the other fields about this person (fields 58, 59 and 60) are also empty",No,,"Yes, if postcode of buyer 1's last settled accommodation is unknown (if field 63 = 2)",,Yes,Yes,,,,"Yes, if sale is not a joint purchase (if field 14 = 2)","Yes, if sale is not a joint purchase (if field 14 = 2), or if buyer is not known to have been living at the same address as buyer 1 at the time of purchase (if field 71 = 1 or 3)",No,"Yes, if none of the buyers are known to have served as a regular in the UK armed forces (if field 73 = 7, 3 or 8)",No,,,No,"Yes, if buyer 1's income is not known (if field 78 = R)","Yes, if sale is not a joint purchase (if field 14 = 2)","Yes, if sale is not a joint purchase (if field 14 = 2) or if buyer 2's income is not known (if field 80 = R)",No,,,"Yes, if the purchasers did not previously own a property or if it is not known (if field 84 = 2 or 3)","Yes, if the purchase was not made through a shared ownership scheme (if field 7 = 2 or 3)",,"Yes, if the purchase was not made through a shared ownership scheme (if field 7 = 2 or 3) or if this is not known to be a staircasing transaction (if field 87 = 2 or 3)",,,"Yes, if the purchase was not made through a shared ownership scheme (if field 7 = 2 or 3) or if this is a staircasing transaction (if field 87 = 1)","Yes, if the purchase was not made through a shared ownership scheme (if field 7 = 2 or 3), if this is a resale (if field 91 = 1) or if this is a staircasing transaction (if field 87 = 1)",,,,,,"Yes, if the purchase was not made through a shared ownership scheme (if field 7 = 2 or 3)",,"Yes, if the purchase was not made through a shared ownership scheme (if field 7 = 2 or 3) or if the buyer was not a private registered provider, housing association or local authority tenant immediately before sale (if field 99 = 2)",,,"Yes, if the purchase was not made through a shared ownership scheme (if field 7 = 2 or 3)",,,"Yes, if the purchase was not made through a shared ownership scheme (if field 7 = 2 or 3) or if a mortgage was not used (if field 105 = 2)",,"Yes, if the purchase was not made through a shared ownership scheme (if field 7 = 2 or 3), if a mortgage was not used (if field 105 = 2) or if 'Other' is not selected for mortgage lender name (if field 107 is not 40)","Yes, if the purchase was not made through a shared ownership scheme (if field 7 = 2 or 3) or if a mortgage was not used (if field 105 = 2)",,"Yes, if the purchase was not made through a shared ownership scheme (if field 7 = 2 or 3)","Yes, if the purchase was not made through a shared ownership scheme (if field 7 = 2 or 3) or the type of shared ownership sale is not Social Homebuy (if field 8 is not 18)","Yes, if the purchase was not made through a shared ownership scheme (if field 7 = 2 or 3)",,"Yes, if the purchase was not made through a discounted ownership scheme (if field 7 = 1 or 3)",,"Yes, if the purchase was not made through a discounted ownership scheme (if field 7 = 1 or 3) or if the type of discounted sale is PRTB, VRTB, RTB, or Rent to Buy (if field 9 is null, 9, 14, 27 or 29)","Yes, if the purchase was not made through a discounted ownership scheme (if field 7 = 1 or 3 or if the type of discounted sale is not PRTB, VRTB, or RTB (if field 9 is null, 8, 29, 21, 22)","Yes, if the purchase was not made through a discounted ownership scheme (if field 7 = 1 or 3)","Yes, if the purchase was not made through a discounted ownership scheme (if field 7 = 1 or 3) or if a mortgage was not used (if field 119 = 2)",,"Yes, if the purchase was not made through a discounted ownership scheme (if field 7 = 1 or 3), if a mortgage was not used (if field 119 = 2) or if 'Other' is not selected for mortgage lender name (if field 121 is not 40)","Yes, if the purchase was not made through a discounted ownership scheme (if field 7 = 1 or 3) or if a mortgage was not used (if field 119 = 2)",,"Yes, if the purchase was not made through a discounted ownership scheme (if field 7 = 1 or 3)",,"Yes, if the purchase was not an outright sale (if field 7 = 1 or 2)",,"Yes, if the purchase was not an outright sale (if field 7 = 1 or 2) or if a mortgage was not used (if field 128 = 2)",,"Yes, if the purchase was not an outright sale (if field 7 = 1 or 2), if a mortgage was not used (if field 128 = 2), or if 'Other' is not selected for mortgage lender name (if field 130 is not 40)","Yes, if the purchase was not an outright sale (if field 7 = 1 or 2) or if a mortgage was not used (if field 128 = 2)",,"Yes, if the purchase was not an outright sale (if field 7 = 1 or 2)", +Types of sales the question applies to,,,,,,,,Shared ownership only,Discounted ownership only,Outright sale only,,,,,Joint purchase only,,,,,,,,,,,,,,,,,,,,,,,,,Joint purchase only,,,,Joint purchase only,,,,,,,,,,,,,,,,,,,,,,,,,,,Joint purchase only,,,,,,,,,Joint purchase only,,,,,Shared ownership only,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,Discounted ownership only,,,,,,,,,,,,Outright sale only,,,,,,,, +Duplicate check field?,Yes,,Yes,,,,,,,,,,,,,,,,,,,,,Yes,,,,,,Yes,,,,,Yes,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Field number,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135 +,123,,2,10,23,23 test BU,1,2,,,,,M,1,2,1,1,1,,123,,123,,A1,1AA,E07000223,1,1,1,32,X,1,12,1,1,1,P,33,X,1,12,1,1,1,0,,,,,,,,,,,,,,,,,1,3,A1,1AA,1,1,250000,25,42500,3,21000,8,800,7,1,1,,1,,1,1,,1,1,,1,10,10,1,,123,,,3,,5,1,1,1,1,1,200000,25,1,200000,1,,2,1,50000,1,1,,1,1,1,1,0,10,10,1,1,,,,,,,,,,,, diff --git a/spec/fixtures/files/2023_24_sales_bulk_upload_invalid.csv b/spec/fixtures/files/2023_24_sales_bulk_upload_invalid.csv index b8defe9e9..9ea9e4ef8 100644 --- a/spec/fixtures/files/2023_24_sales_bulk_upload_invalid.csv +++ b/spec/fixtures/files/2023_24_sales_bulk_upload_invalid.csv @@ -1,12 +1,12 @@ -Section,Setting up this sales log,,,,,,,,,,,,,,,Property information,,,,,,,,,,,,,,Household characteristics,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,Household situation,,,,,,,,,,,Other household information,,,,,"Income, benefits and outgoings",,,,,,,,Sale information - Shared ownership,,,,,,,,,,,,,,,,,,,,,,,,,,,,,Sale information - Discounted ownership,,,,,,,,,,,,Sale information - Outright sale,,,,,,,, -Question,Which organisation owned this property before the sale?,What is the CORE username of the account this sale log should be assigned to? ,What is the sale completion date? - day DD,What is the sale completion date? - month MM,What is the sale completion date? - year YY,What is the purchaser code?,Was this purchase made through an ownership scheme?,What is the type of shared ownership sale?,What is the type of discounted ownership sale?,What is the type of outright sale?,"If 'Other', what is the type of outright sale?",Is the buyer a company?,Will the buyer(s) live in the property?,Is this a joint purchase?,Are there more than 2 joint buyers of this property?,How many bedrooms does the property have?,What type of unit is the property?,Which type of building is the property?,"If known, enter this property’s UPRN",Address Line 1,Address Line 2,Town or city,County,Part 1 of the property's postcode,Part 2 of the property's postcode,What is the property's local authority?,Is the property built or adapted to wheelchair-user standards?,Did you interview the buyer to answer these questions?,Has the buyer seen the DLUHC privacy notice?,What is buyer 1’s age?,Which of these best describes buyer 1's gender identity?,Which of the following best describes buyer 1's ethnic background?,What is buyer 1's nationality?,"If ""Any other country"", what is buyer 1's nationality?",Which of these best describes buyer 1’s working situation? ,Will buyer 1 live in the property?,What is buyer 2 or person 2's relationship to buyer 1?,What is buyer 2 or person 2's age?,Which of these best describes buyer 2 or person 2's gender identity?,Which of the following best describes buyer 2's ethnic background?,What is buyer 2's nationality?,"If ""Any other country"", what is buyer 2's nationality?",Which of these best describes buyer 2 or person 2’s working situation? ,Will buyer 2 live in the property?,"Besides the buyer(s), how many other people live or will live in the property?",What is person 3's relationship to buyer 1?,What is person 3's age?,Which of these best describes person 3's gender identity?,Which of these best describes person 3’s working situation? ,What is person 4's relationship to buyer 1?,What is person 4's age?,Which of these best describes person 4's gender identity?,Which of these best describes person 4’s working situation? ,What is person 5's relationship to buyer 1?,What is person 5's age?,Which of these best describes person 5's gender identity?,Which of these best describes person 5’s working situation? ,What is person 6's relationship to buyer 1?,What is person 6's age?,Which of these best describes person 6's gender identity?,Which of these best describes person 6’s working situation? ,What was buyer 1's previous tenure?,Do you know the postcode of buyer 1's last settled accommodation?,Part 1 of postcode of buyer 1's last settled accommodation,Part 2 of postcode of buyer 1's last settled accommodation,What is the local authority of buyer 1's last settled accommodation?,Was the buyer registered with their PRP (HA)?,Was the buyer registered with another PRP (HA)?,Was the buyer registered with the local authority?,Was the buyer registered with a Help to Buy agent?,"At the time of purchase, was buyer 2 living at the same address as buyer 1?",What was buyer 2's previous tenure?,"Have any of the buyers ever served as a regular in the UK armed forces? -",Is the buyer still serving in the UK armed forces?,Are any of the buyers a spouse or civil partner of a UK armed forces regular who died in service within the last 2 years?,Does anyone in the household consider themselves to have a disability?,Does anyone in the household use a wheelchair?,What is buyer 1's annual income?,Was buyer 1's income used for a mortgage application?,What is buyer 2's annual income?,Was buyer 2's income used for a mortgage application?,Were the buyers receiving any of these housing-related benefits immediately before buying this property?,What is the total amount the buyers had in savings before they paid any deposit for the property?,Have any of the buyers previously owned a property?,Was the previous property under shared ownership?,How long did the buyer(s) live in the property before purchasing it?,Is this a staircasing transaction?,What percentage of the property has been bought in this staircasing transaction?,What percentage of the property do the buyers now own in total?,Was this transaction part of a back-to-back staircasing transaction to facilitate sale of the home on the open market?,Is this a resale?,What is the day of the exchange of contracts date? - DD,What is the month of the exchange of contracts date? - MM,What is the year of the exchange of contracts date? - YY,What is the day of the practical completion or handover date? - DD,What is the month of the practical completion or handover date? - MM,What is the year of the practical completion or handover date? - YY,Was the household rehoused under a ‘local authority nominations agreement’?,"Was the buyer a private registered provider, housing association or local authority tenant immediately before the sale?",How many bedrooms did the buyer's previous property have?,What was the previous property type?,What was the buyer’s previous tenure?,What is the full purchase price?,What was the initial percentage equity stake purchased?,Was a mortgage used to buy this property?,What is the mortgage amount?,What is the name of the mortgage lender?,"If 'Other', what is the name of the mortgage lender?",What is the length of the mortgage in years?,Does this include any extra borrowing?,How much was the cash deposit paid on the property?,How much cash discount was given through Social HomeBuy?,What is the basic monthly rent?,What are the total monthly leasehold charges for the property?,How long did the buyer(s) live in the property before purchasing it?,What is the full purchase price?,"What was the amount of any loan, grant, discount or subsidy given?",What was the percentage discount?,Was a mortgage used to buy this property?,What is the mortgage amount?,What is the name of the mortgage lender?,"If 'Other', what is the name mortgage lender?",What is the length of the mortgage in years?,Does this include any extra borrowing?,How much was the cash deposit paid on the property?,What are the total monthly leasehold charges for the property?,What is the full purchase price?,Was a mortgage used to buy this property?,What is the mortgage amount?,What is the name of the mortgage lender?,"If 'Other', what is the name of the mortgage lender?",What is the length of the mortgage in years?,Does this include any extra borrowing?,How much was the cash deposit paid on the property?,What are the total monthly leasehold charges for the property? -Additional info,Provide the owning organisation's CORE ID code,"If using new CORE then this will be the email address. If left empty, the sale log will be assigned to the account used to upload the log. ",,,,,A shared ownership sale is when the purchaser buys up to 75% of the property value and pays rent to the Private Registered Provider (PRP) on the remaining portion.,,,,,,,,,"For bedsits, enter ‘1’",,,"The UPRN is the Unique Property Reference Number. It's created by the Ordnance Survey so it's a unique number system used across all housing providers, all sectors (i.e. not just social housing) and all across the UK.",,,,,,,,,You should still try to answer all questions even if the buyer wasn't interviewed in person,You should show the privacy notice to the buyer before completing this log,,,,,,,,,,,,,,,,"You can provide details for a maximum of 4 other people if there are 2 buyers, or 5 other people if there is only one buyer",,,,,,,,,,,,,,,,,,This is also known as the household's 'last settled home',,,,,,,,,,"A regular is somebody who has served in the Royal Navy, the Royal Marines, the Royal Air Force or army full time and does not include reserve forces",,,This includes any long-term health condition that has an impact on the person's day-to-day life,This can be inside or outside the home,"Provide the gross annual income (i.e. salary before tax) plus the annual amount of benefits, Universal Credit or pensions, and income from investments",,"Provide the gross annual income (i.e. salary before tax) plus the annual amount of benefits, Universal Credit or pensions, and income from investments",,,Enter their total savings to the nearest £10,,For any buyer,"If the buyers haven't been living in the property, enter '0'","A staircasing transaction is when the household purchases more shares in their property, increasing the proportion they own and decreasing the proportion the housing association owns. Once the household purchases 100% of the shares, they own the property.",,,,"If the social landlord has previously sold the property to another buyer and is now reselling the property, enter 'yes'. If this is the first time the property has been sold, enter 'no'.","This is the date on which the sale becomes legally binding with an exchange of signed contracts between the vendor and the buyer. Where properties are sold 'off plan' (such as while the property is still being built), the exchange of contracts date may happen before the practical completion or handover date.",,,This is the date on which the building contractor hands over responsibility for the completed property to the private registered provider (PRP).,,,A local authority nominations agreement is a written agreement between a local authority and private registered provider (PRP) that some or all of its sales vacancies are offered to local authorities for rehousing.,,"For bedsits, enter ‘1’",,,"Enter the full purchase price of the property before any discounts are applied. For shared ownership, enter the full purchase price paid for 100% equity (this is equal to the value of the share owned by the PRP plus the value bought by the purchaser).","Enter the amount of initial equity held by the purchaser (for example, 25% or 50%)",,,,,,This is 'Yes' if the mortgage includes borrowing beyond the purchase price of the property,Enter the total cash sum paid by the buyer towards the property that was not funded by the mortgage,Enter the total cash discount given on the property being purchased through the Social HomeBuy scheme,Before any charges,"For example, service and management charges",,"For all schemes, including Right to Acquire (RTA), Right to Buy (RTB), Voluntary Right to Buy (VRTB) or Preserved Right to Buy (PRTB) sales, enter the full price of the property without any discount","For all schemes except Right to Buy (RTB), Preserved Right to Buy (PRTB), Voluntary Right to Buy (VRTB) and Rent to Buy","For Right to Buy (RTB), Preserved Right to Buy (PRTB) and Voluntary Right to Buy (VRTB). For capped discount, enter capped %. If property is sold to an existing tenant under RTB, PRTB or VRTB, enter % discount from full market value.",,,,,,This is 'Yes' if the mortgage includes borrowing beyond the purchase price of the property,Enter the total cash sum paid by the purchaser towards the property that was not funded by the mortgage. This excludes any grant or loan.,"For example, service and management charges",,,,,,,This is 'Yes' if the mortgage includes borrowing beyond the purchase price of the property,Enter the total cash sum paid by the purchaser towards the property that was not funded by the mortgage. This excludes any grant or loan,"For example, service and management charges" -Values,Numeric,"Email format if using new CORE. -Alphanumeric, except for commas if using old CORE.",1 - 31,1 - 12,20 - 24,"Alphanumeric, max 9 characters",1 - 3,"2, 16, 18, 24, 28 or 30 - 32","8, 9, 14, 21, 22, 27 or 29",10 or 12,Alphanumeric,1 - 2,,,1 - 3,1 - 9,1 - 4 or 9,1 - 2,"Numeric, max 12 digits",Alphanumeric,,Text,,XX(XX),XXX,"ONS CODE: Alphanumeric, 9 characters beginning with 'E'",1 - 3,1 - 2,1,"16 - 110 - or R","F, M, X or R",1 - 19,"12 - 13, 17 - 19",Text,0 - 8 or 10,1 - 2,"P, C, X or R",1 - 110 or R,"F, M, X or R",1 - 19,"12 - 13, 17 - 19",Text,0 - 10,1 - 2,0 - 5,"P, C, X or R",1 - 110 or R,"F, M, X or R",0 - 10,"P, C, X or R",1 - 110 or R,"F, M, X or R",0 - 10,"P, C, X or R",1 - 110 or R,"F, M, X or R",0 - 10,"P, C, X or R",1 - 110 or R,"F, M, X or R",0 - 10,"1 - 7, 9 or R",1 - 2,XX(XX),XXX,"ONS CODE: Alphanumeric, 9 characters beginning with 'E'",1 or empty,,,,1 - 3,"1 - 7, 9 or R","1, 3, 7 or 8",4 - 6,4 - 7,1 - 3,,0 - 99999 or R,1 - 2,0 - 99999 or R,1 - 2,1 - 4,0 - 999990 or R,1 - 3,,Integer <= 80,1 - 3,1 - 100,,1 - 3,1 - 2,1 - 31,1 - 12,22 - 24,1 - 31,1 - 12,22 - 24,1 - 3,1 - 2,1 - 9,1 - 4 or 9,1 - 3 or 9 - 10,0 - 999999,0 - 100,1 - 2,0 - 999999,1 - 40,Alphanumeric,Integer <= 60,1 - 3,0 - 999999,,0 - 9999.99,,Integer <= 80,0 - 999999,,0 - 100,1 - 2,0 - 999999,1 - 40,Alphanumeric,Integer <= 60,1 - 3,0 - 999999,0 - 999.99,0 - 999999,1 - 2,0 - 999999,1 - 40,Alphanumeric,Integer <= 60,1 - 3,0 - 999999,0 - 9999.99 -Can be empty?,No,Yes,No,,,Yes,No,"Yes, if the purchase was not made through a shared ownership scheme (if field 7 = 2 or 3)","Yes, if the purchase was not made through a discounted ownership scheme (if field 7 = 1 or 3)","Yes, if the purchase was not an outright sale (if field 7 = 1 or 2)","Yes, if 'Other' is not selected for type of outright sale (if field 10 is not 12)","Yes, if the purchase was not an outright sale (if field 7 = 1 or 2)",,No,"Yes, if the sale is not a joint purchase (if field 14 = 2)",No,,,"Yes, if property's full address is known (if fields 20, 22, and 24 - 25 are not empty)","Yes, if property's UPRN is known (if field 19 is not empty)",Yes,"Yes, if property's UPRN is known (if field 19 is not empty)",Yes,"Yes, if property's UPRN and local authority are known (if fields 19 and 26 are not empty",,No,,Yes,No,"Yes, if buyer is a company (if field 12 = 1)",,,,"Yes, if buyer is a company (if field 12 = 1) or if ""Any other country"" is not selected for buyer 1's nationality (if field 33 is not 12)","Yes, if buyer is a company (if field 12 = 1)",,"Yes, if buyer is a company (if field 12 = 1), or if sale is not a joint purchase (if field 14 = 2) and the other fields about this person (fields 38, 39 and 43) are also empty","Yes, if buyer is a company (if field 12 = 1), or if sale is not a joint purchase (if field 14 = 2) and the other fields about this person (fields 37, 39 and 43) are also empty","Yes, if buyer is a company (if field 12 = 1), or if sale is not a joint purchase (if field 14 = 2) and the other fields about this person (fields 37, 38 and 43) are also empty","Yes, if buyer is a company (if field 12 = 1) or if sale is not a joint purchase (if field 14 = 2)",,"Yes, if buyer is a company (if field 12 = 1) or if ""Any other country"" is not selected for buyer 2's nationality (if field 41 is not 12)","Yes, if buyer is a company (if field 12 = 1), or if sale is not a joint purchase (if field 14 = 2) and the other fields about this person (fields 37, 38 and 39) are also empty","Yes, if buyer is a company (if field 12 = 1) or if sale is not a joint purchase (if field 14 = 2)","Yes, if buyer is a company (if field 12 = 1)","Yes, if the other fields about this person (fields 47, 48 and 49) are also empty","Yes, if the other fields about this person (fields 46, 48 and 49) are also empty","Yes, if the other fields about this person (fields 46, 47 and 49) are also empty","Yes, if the other fields about this person (fields 46, 47 and 48) are also empty","Yes, if the other fields about this person (fields 51, 52 and 53) are also empty","Yes, if the other fields about this person (fields 50, 52 and 53) are also empty","Yes, if the other fields about this person (fields 50, 51 and 53) are also empty","Yes, if the other fields about this person (fields 50, 51 and 52) are also empty","Yes, if the other fields about this person (fields 55, 56 and 57) are also empty","Yes, if the other fields about this person (fields 54, 56 and 57) are also empty","Yes, if the other fields about this person (fields 54, 55 and 57) are also empty","Yes, if the other fields about this person (fields 54, 55 and 56) are also empty","Yes, if the other fields about this person (fields 59, 60 and 61) are also empty","Yes, if the other fields about this person (fields 58, 60 and 61) are also empty","Yes, if the other fields about this person (fields 58, 59 and 61) are also empty","Yes, if the other fields about this person (fields 58, 59 and 60) are also empty",No,,"Yes, if postcode of buyer 1's last settled accommodation is unknown (if field 63 = 2)",,Yes,Yes,,,,"Yes, if sale is not a joint purchase (if field 14 = 2)","Yes, if sale is not a joint purchase (if field 14 = 2), or if buyer is not known to have been living at the same address as buyer 1 at the time of purchase (if field 71 = 1 or 3)",No,"Yes, if none of the buyers are known to have served as a regular in the UK armed forces (if field 73 = 7, 3 or 8)",No,,,No,"Yes, if buyer 1's income is not known (if field 78 = R)","Yes, if sale is not a joint purchase (if field 14 = 2)","Yes, if sale is not a joint purchase (if field 14 = 2) or if buyer 2's income is not known (if field 80 = R)",No,,,"Yes, if the purchasers did not previously own a property or if it is not known (if field 84 = 2 or 3)","Yes, if the purchase was not made through a shared ownership scheme (if field 7 = 2 or 3)",,"Yes, if the purchase was not made through a shared ownership scheme (if field 7 = 2 or 3) or if this is not known to be a staircasing transaction (if field 87 = 2 or 3)",,,"Yes, if the purchase was not made through a shared ownership scheme (if field 7 = 2 or 3) or if this is a staircasing transaction (if field 87 = 1)","Yes, if the purchase was not made through a shared ownership scheme (if field 7 = 2 or 3), if this is a resale (if field 91 = 1) or if this is a staircasing transaction (if field 87 = 1)",,,,,,"Yes, if the purchase was not made through a shared ownership scheme (if field 7 = 2 or 3)",,"Yes, if the purchase was not made through a shared ownership scheme (if field 7 = 2 or 3) or if the buyer was not a private registered provider, housing association or local authority tenant immediately before sale (if field 99 = 2)",,,"Yes, if the purchase was not made through a shared ownership scheme (if field 7 = 2 or 3)",,,"Yes, if the purchase was not made through a shared ownership scheme (if field 7 = 2 or 3) or if a mortgage was not used (if field 105 = 2)",,"Yes, if the purchase was not made through a shared ownership scheme (if field 7 = 2 or 3), if a mortgage was not used (if field 105 = 2) or if 'Other' is not selected for mortgage lender name (if field 107 is not 40)","Yes, if the purchase was not made through a shared ownership scheme (if field 7 = 2 or 3) or if a mortgage was not used (if field 105 = 2)",,"Yes, if the purchase was not made through a shared ownership scheme (if field 7 = 2 or 3)","Yes, if the purchase was not made through a shared ownership scheme (if field 7 = 2 or 3) or the type of shared ownership sale is not Social Homebuy (if field 8 is not 18)","Yes, if the purchase was not made through a shared ownership scheme (if field 7 = 2 or 3)",,"Yes, if the purchase was not made through a discounted ownership scheme (if field 7 = 1 or 3)",,"Yes, if the purchase was not made through a discounted ownership scheme (if field 7 = 1 or 3) or if the type of discounted sale is PRTB, VRTB, RTB, or Rent to Buy (if field 9 is null, 9, 14, 27 or 29)","Yes, if the purchase was not made through a discounted ownership scheme (if field 7 = 1 or 3 or if the type of discounted sale is not PRTB, VRTB, or RTB (if field 9 is null, 8, 29, 21, 22)","Yes, if the purchase was not made through a discounted ownership scheme (if field 7 = 1 or 3)","Yes, if the purchase was not made through a discounted ownership scheme (if field 7 = 1 or 3) or if a mortgage was not used (if field 119 = 2)",,"Yes, if the purchase was not made through a discounted ownership scheme (if field 7 = 1 or 3), if a mortgage was not used (if field 119 = 2) or if 'Other' is not selected for mortgage lender name (if field 121 is not 40)","Yes, if the purchase was not made through a discounted ownership scheme (if field 7 = 1 or 3) or if a mortgage was not used (if field 119 = 2)",,"Yes, if the purchase was not made through a discounted ownership scheme (if field 7 = 1 or 3)",,"Yes, if the purchase was not an outright sale (if field 7 = 1 or 2)",,"Yes, if the purchase was not an outright sale (if field 7 = 1 or 2) or if a mortgage was not used (if field 128 = 2)",,"Yes, if the purchase was not an outright sale (if field 7 = 1 or 2), if a mortgage was not used (if field 128 = 2), or if 'Other' is not selected for mortgage lender name (if field 130 is not 40)","Yes, if the purchase was not an outright sale (if field 7 = 1 or 2) or if a mortgage was not used (if field 128 = 2)",,"Yes, if the purchase was not an outright sale (if field 7 = 1 or 2)", -Types of sales the question applies to,,,,,,,,Shared ownership only,Discounted ownership only,Outright sale only,,,,,Joint purchase only,,,,,,,,,,,,,,,,,,,,,,,,,Joint purchase only,,,,Joint purchase only,,,,,,,,,,,,,,,,,,,,,,,,,,,Joint purchase only,,,,,,,,,Joint purchase only,,,,,Shared ownership only,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,Discounted ownership only,,,,,,,,,,,,Outright sale only,,,,,,,, -Duplicate check field?,Yes,,Yes,,,,,,,,,,,,,,,,,,,,,Yes,,,,,,Yes,,,,,Yes,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, -Field number,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135 -,,,2,10,23,23 test BU,1,2,,,,,M,1,2,1,1,1,,123,,123,,A1,1AA,E07000223,1,1,1,32,X,1,12,1,1,1,P,33,X,1,12,1,1,1,0,,,,,,,,,,,,,,,,,1,3,A1,1AA,1,1,250000,25,42500,3,21000,8,800,7,1,1,,1,,1,1,,1,1,,1,10,10,1,,123,,,3,,5,1,1,1,1,1,200000,25,1,200000,1,,2,1,50000,1,1,,1,1,1,1,0,10,10,1,1,,,,,,,,,,,, +Section,Setting up this sales log,,,,,,,,,,,,,,,Property information,,,,,,,,,,,,,,Household characteristics,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,Household situation,,,,,,,,,,,Other household information,,,,,"Income, benefits and outgoings",,,,,,,,Sale information - Shared ownership,,,,,,,,,,,,,,,,,,,,,,,,,,,,,Sale information - Discounted ownership,,,,,,,,,,,,Sale information - Outright sale,,,,,,,, +Question,Which organisation owned this property before the sale?,What is the CORE username of the account this sale log should be assigned to? ,What is the sale completion date? - day DD,What is the sale completion date? - month MM,What is the sale completion date? - year YY,What is the purchaser code?,Was this purchase made through an ownership scheme?,What is the type of shared ownership sale?,What is the type of discounted ownership sale?,What is the type of outright sale?,"If 'Other', what is the type of outright sale?",Is the buyer a company?,Will the buyer(s) live in the property?,Is this a joint purchase?,Are there more than 2 joint buyers of this property?,How many bedrooms does the property have?,What type of unit is the property?,Which type of building is the property?,"If known, enter this property’s UPRN",Address Line 1,Address Line 2,Town or city,County,Part 1 of the property's postcode,Part 2 of the property's postcode,What is the property's local authority?,Is the property built or adapted to wheelchair-user standards?,Did you interview the buyer to answer these questions?,Has the buyer seen the MHCLG privacy notice?,What is buyer 1’s age?,Which of these best describes buyer 1's gender identity?,Which of the following best describes buyer 1's ethnic background?,What is buyer 1's nationality?,"If ""Any other country"", what is buyer 1's nationality?",Which of these best describes buyer 1’s working situation? ,Will buyer 1 live in the property?,What is buyer 2 or person 2's relationship to buyer 1?,What is buyer 2 or person 2's age?,Which of these best describes buyer 2 or person 2's gender identity?,Which of the following best describes buyer 2's ethnic background?,What is buyer 2's nationality?,"If ""Any other country"", what is buyer 2's nationality?",Which of these best describes buyer 2 or person 2’s working situation? ,Will buyer 2 live in the property?,"Besides the buyer(s), how many other people live or will live in the property?",What is person 3's relationship to buyer 1?,What is person 3's age?,Which of these best describes person 3's gender identity?,Which of these best describes person 3’s working situation? ,What is person 4's relationship to buyer 1?,What is person 4's age?,Which of these best describes person 4's gender identity?,Which of these best describes person 4’s working situation? ,What is person 5's relationship to buyer 1?,What is person 5's age?,Which of these best describes person 5's gender identity?,Which of these best describes person 5’s working situation? ,What is person 6's relationship to buyer 1?,What is person 6's age?,Which of these best describes person 6's gender identity?,Which of these best describes person 6’s working situation? ,What was buyer 1's previous tenure?,Do you know the postcode of buyer 1's last settled accommodation?,Part 1 of postcode of buyer 1's last settled accommodation,Part 2 of postcode of buyer 1's last settled accommodation,What is the local authority of buyer 1's last settled accommodation?,Was the buyer registered with their PRP (HA)?,Was the buyer registered with another PRP (HA)?,Was the buyer registered with the local authority?,Was the buyer registered with a Help to Buy agent?,"At the time of purchase, was buyer 2 living at the same address as buyer 1?",What was buyer 2's previous tenure?,"Have any of the buyers ever served as a regular in the UK armed forces? +",Is the buyer still serving in the UK armed forces?,Are any of the buyers a spouse or civil partner of a UK armed forces regular who died in service within the last 2 years?,Does anyone in the household consider themselves to have a disability?,Does anyone in the household use a wheelchair?,What is buyer 1's annual income?,Was buyer 1's income used for a mortgage application?,What is buyer 2's annual income?,Was buyer 2's income used for a mortgage application?,Were the buyers receiving any of these housing-related benefits immediately before buying this property?,What is the total amount the buyers had in savings before they paid any deposit for the property?,Have any of the buyers previously owned a property?,Was the previous property under shared ownership?,How long did the buyer(s) live in the property before purchasing it?,Is this a staircasing transaction?,What percentage of the property has been bought in this staircasing transaction?,What percentage of the property do the buyers now own in total?,Was this transaction part of a back-to-back staircasing transaction to facilitate sale of the home on the open market?,Is this a resale?,What is the day of the exchange of contracts date? - DD,What is the month of the exchange of contracts date? - MM,What is the year of the exchange of contracts date? - YY,What is the day of the practical completion or handover date? - DD,What is the month of the practical completion or handover date? - MM,What is the year of the practical completion or handover date? - YY,Was the household rehoused under a ‘local authority nominations agreement’?,"Was the buyer a private registered provider, housing association or local authority tenant immediately before the sale?",How many bedrooms did the buyer's previous property have?,What was the previous property type?,What was the buyer’s previous tenure?,What is the full purchase price?,What was the initial percentage equity stake purchased?,Was a mortgage used to buy this property?,What is the mortgage amount?,What is the name of the mortgage lender?,"If 'Other', what is the name of the mortgage lender?",What is the length of the mortgage in years?,Does this include any extra borrowing?,How much was the cash deposit paid on the property?,How much cash discount was given through Social HomeBuy?,What is the basic monthly rent?,What are the total monthly leasehold charges for the property?,How long did the buyer(s) live in the property before purchasing it?,What is the full purchase price?,"What was the amount of any loan, grant, discount or subsidy given?",What was the percentage discount?,Was a mortgage used to buy this property?,What is the mortgage amount?,What is the name of the mortgage lender?,"If 'Other', what is the name mortgage lender?",What is the length of the mortgage in years?,Does this include any extra borrowing?,How much was the cash deposit paid on the property?,What are the total monthly leasehold charges for the property?,What is the full purchase price?,Was a mortgage used to buy this property?,What is the mortgage amount?,What is the name of the mortgage lender?,"If 'Other', what is the name of the mortgage lender?",What is the length of the mortgage in years?,Does this include any extra borrowing?,How much was the cash deposit paid on the property?,What are the total monthly leasehold charges for the property? +Additional info,Provide the owning organisation's CORE ID code,"If using new CORE then this will be the email address. If left empty, the sale log will be assigned to the account used to upload the log. ",,,,,A shared ownership sale is when the purchaser buys up to 75% of the property value and pays rent to the Private Registered Provider (PRP) on the remaining portion.,,,,,,,,,"For bedsits, enter ‘1’",,,"The UPRN is the Unique Property Reference Number. It's created by the Ordnance Survey so it's a unique number system used across all housing providers, all sectors (i.e. not just social housing) and all across the UK.",,,,,,,,,You should still try to answer all questions even if the buyer wasn't interviewed in person,You should show the privacy notice to the buyer before completing this log,,,,,,,,,,,,,,,,"You can provide details for a maximum of 4 other people if there are 2 buyers, or 5 other people if there is only one buyer",,,,,,,,,,,,,,,,,,This is also known as the household's 'last settled home',,,,,,,,,,"A regular is somebody who has served in the Royal Navy, the Royal Marines, the Royal Air Force or army full time and does not include reserve forces",,,This includes any long-term health condition that has an impact on the person's day-to-day life,This can be inside or outside the home,"Provide the gross annual income (i.e. salary before tax) plus the annual amount of benefits, Universal Credit or pensions, and income from investments",,"Provide the gross annual income (i.e. salary before tax) plus the annual amount of benefits, Universal Credit or pensions, and income from investments",,,Enter their total savings to the nearest £10,,For any buyer,"If the buyers haven't been living in the property, enter '0'","A staircasing transaction is when the household purchases more shares in their property, increasing the proportion they own and decreasing the proportion the housing association owns. Once the household purchases 100% of the shares, they own the property.",,,,"If the social landlord has previously sold the property to another buyer and is now reselling the property, enter 'yes'. If this is the first time the property has been sold, enter 'no'.","This is the date on which the sale becomes legally binding with an exchange of signed contracts between the vendor and the buyer. Where properties are sold 'off plan' (such as while the property is still being built), the exchange of contracts date may happen before the practical completion or handover date.",,,This is the date on which the building contractor hands over responsibility for the completed property to the private registered provider (PRP).,,,A local authority nominations agreement is a written agreement between a local authority and private registered provider (PRP) that some or all of its sales vacancies are offered to local authorities for rehousing.,,"For bedsits, enter ‘1’",,,"Enter the full purchase price of the property before any discounts are applied. For shared ownership, enter the full purchase price paid for 100% equity (this is equal to the value of the share owned by the PRP plus the value bought by the purchaser).","Enter the amount of initial equity held by the purchaser (for example, 25% or 50%)",,,,,,This is 'Yes' if the mortgage includes borrowing beyond the purchase price of the property,Enter the total cash sum paid by the buyer towards the property that was not funded by the mortgage,Enter the total cash discount given on the property being purchased through the Social HomeBuy scheme,Before any charges,"For example, service and management charges",,"For all schemes, including Right to Acquire (RTA), Right to Buy (RTB), Voluntary Right to Buy (VRTB) or Preserved Right to Buy (PRTB) sales, enter the full price of the property without any discount","For all schemes except Right to Buy (RTB), Preserved Right to Buy (PRTB), Voluntary Right to Buy (VRTB) and Rent to Buy","For Right to Buy (RTB), Preserved Right to Buy (PRTB) and Voluntary Right to Buy (VRTB). For capped discount, enter capped %. If property is sold to an existing tenant under RTB, PRTB or VRTB, enter % discount from full market value.",,,,,,This is 'Yes' if the mortgage includes borrowing beyond the purchase price of the property,Enter the total cash sum paid by the purchaser towards the property that was not funded by the mortgage. This excludes any grant or loan.,"For example, service and management charges",,,,,,,This is 'Yes' if the mortgage includes borrowing beyond the purchase price of the property,Enter the total cash sum paid by the purchaser towards the property that was not funded by the mortgage. This excludes any grant or loan,"For example, service and management charges" +Values,Numeric,"Email format if using new CORE. +Alphanumeric, except for commas if using old CORE.",1 - 31,1 - 12,20 - 24,"Alphanumeric, max 9 characters",1 - 3,"2, 16, 18, 24, 28 or 30 - 32","8, 9, 14, 21, 22, 27 or 29",10 or 12,Alphanumeric,1 - 2,,,1 - 3,1 - 9,1 - 4 or 9,1 - 2,"Numeric, max 12 digits",Alphanumeric,,Text,,XX(XX),XXX,"ONS CODE: Alphanumeric, 9 characters beginning with 'E'",1 - 3,1 - 2,1,"16 - 110 + or R","F, M, X or R",1 - 19,"12 - 13, 17 - 19",Text,0 - 8 or 10,1 - 2,"P, C, X or R",1 - 110 or R,"F, M, X or R",1 - 19,"12 - 13, 17 - 19",Text,0 - 10,1 - 2,0 - 5,"P, C, X or R",1 - 110 or R,"F, M, X or R",0 - 10,"P, C, X or R",1 - 110 or R,"F, M, X or R",0 - 10,"P, C, X or R",1 - 110 or R,"F, M, X or R",0 - 10,"P, C, X or R",1 - 110 or R,"F, M, X or R",0 - 10,"1 - 7, 9 or R",1 - 2,XX(XX),XXX,"ONS CODE: Alphanumeric, 9 characters beginning with 'E'",1 or empty,,,,1 - 3,"1 - 7, 9 or R","1, 3, 7 or 8",4 - 6,4 - 7,1 - 3,,0 - 99999 or R,1 - 2,0 - 99999 or R,1 - 2,1 - 4,0 - 999990 or R,1 - 3,,Integer <= 80,1 - 3,1 - 100,,1 - 3,1 - 2,1 - 31,1 - 12,22 - 24,1 - 31,1 - 12,22 - 24,1 - 3,1 - 2,1 - 9,1 - 4 or 9,1 - 3 or 9 - 10,0 - 999999,0 - 100,1 - 2,0 - 999999,1 - 40,Alphanumeric,Integer <= 60,1 - 3,0 - 999999,,0 - 9999.99,,Integer <= 80,0 - 999999,,0 - 100,1 - 2,0 - 999999,1 - 40,Alphanumeric,Integer <= 60,1 - 3,0 - 999999,0 - 999.99,0 - 999999,1 - 2,0 - 999999,1 - 40,Alphanumeric,Integer <= 60,1 - 3,0 - 999999,0 - 9999.99 +Can be empty?,No,Yes,No,,,Yes,No,"Yes, if the purchase was not made through a shared ownership scheme (if field 7 = 2 or 3)","Yes, if the purchase was not made through a discounted ownership scheme (if field 7 = 1 or 3)","Yes, if the purchase was not an outright sale (if field 7 = 1 or 2)","Yes, if 'Other' is not selected for type of outright sale (if field 10 is not 12)","Yes, if the purchase was not an outright sale (if field 7 = 1 or 2)",,No,"Yes, if the sale is not a joint purchase (if field 14 = 2)",No,,,"Yes, if property's full address is known (if fields 20, 22, and 24 - 25 are not empty)","Yes, if property's UPRN is known (if field 19 is not empty)",Yes,"Yes, if property's UPRN is known (if field 19 is not empty)",Yes,"Yes, if property's UPRN and local authority are known (if fields 19 and 26 are not empty",,No,,Yes,No,"Yes, if buyer is a company (if field 12 = 1)",,,,"Yes, if buyer is a company (if field 12 = 1) or if ""Any other country"" is not selected for buyer 1's nationality (if field 33 is not 12)","Yes, if buyer is a company (if field 12 = 1)",,"Yes, if buyer is a company (if field 12 = 1), or if sale is not a joint purchase (if field 14 = 2) and the other fields about this person (fields 38, 39 and 43) are also empty","Yes, if buyer is a company (if field 12 = 1), or if sale is not a joint purchase (if field 14 = 2) and the other fields about this person (fields 37, 39 and 43) are also empty","Yes, if buyer is a company (if field 12 = 1), or if sale is not a joint purchase (if field 14 = 2) and the other fields about this person (fields 37, 38 and 43) are also empty","Yes, if buyer is a company (if field 12 = 1) or if sale is not a joint purchase (if field 14 = 2)",,"Yes, if buyer is a company (if field 12 = 1) or if ""Any other country"" is not selected for buyer 2's nationality (if field 41 is not 12)","Yes, if buyer is a company (if field 12 = 1), or if sale is not a joint purchase (if field 14 = 2) and the other fields about this person (fields 37, 38 and 39) are also empty","Yes, if buyer is a company (if field 12 = 1) or if sale is not a joint purchase (if field 14 = 2)","Yes, if buyer is a company (if field 12 = 1)","Yes, if the other fields about this person (fields 47, 48 and 49) are also empty","Yes, if the other fields about this person (fields 46, 48 and 49) are also empty","Yes, if the other fields about this person (fields 46, 47 and 49) are also empty","Yes, if the other fields about this person (fields 46, 47 and 48) are also empty","Yes, if the other fields about this person (fields 51, 52 and 53) are also empty","Yes, if the other fields about this person (fields 50, 52 and 53) are also empty","Yes, if the other fields about this person (fields 50, 51 and 53) are also empty","Yes, if the other fields about this person (fields 50, 51 and 52) are also empty","Yes, if the other fields about this person (fields 55, 56 and 57) are also empty","Yes, if the other fields about this person (fields 54, 56 and 57) are also empty","Yes, if the other fields about this person (fields 54, 55 and 57) are also empty","Yes, if the other fields about this person (fields 54, 55 and 56) are also empty","Yes, if the other fields about this person (fields 59, 60 and 61) are also empty","Yes, if the other fields about this person (fields 58, 60 and 61) are also empty","Yes, if the other fields about this person (fields 58, 59 and 61) are also empty","Yes, if the other fields about this person (fields 58, 59 and 60) are also empty",No,,"Yes, if postcode of buyer 1's last settled accommodation is unknown (if field 63 = 2)",,Yes,Yes,,,,"Yes, if sale is not a joint purchase (if field 14 = 2)","Yes, if sale is not a joint purchase (if field 14 = 2), or if buyer is not known to have been living at the same address as buyer 1 at the time of purchase (if field 71 = 1 or 3)",No,"Yes, if none of the buyers are known to have served as a regular in the UK armed forces (if field 73 = 7, 3 or 8)",No,,,No,"Yes, if buyer 1's income is not known (if field 78 = R)","Yes, if sale is not a joint purchase (if field 14 = 2)","Yes, if sale is not a joint purchase (if field 14 = 2) or if buyer 2's income is not known (if field 80 = R)",No,,,"Yes, if the purchasers did not previously own a property or if it is not known (if field 84 = 2 or 3)","Yes, if the purchase was not made through a shared ownership scheme (if field 7 = 2 or 3)",,"Yes, if the purchase was not made through a shared ownership scheme (if field 7 = 2 or 3) or if this is not known to be a staircasing transaction (if field 87 = 2 or 3)",,,"Yes, if the purchase was not made through a shared ownership scheme (if field 7 = 2 or 3) or if this is a staircasing transaction (if field 87 = 1)","Yes, if the purchase was not made through a shared ownership scheme (if field 7 = 2 or 3), if this is a resale (if field 91 = 1) or if this is a staircasing transaction (if field 87 = 1)",,,,,,"Yes, if the purchase was not made through a shared ownership scheme (if field 7 = 2 or 3)",,"Yes, if the purchase was not made through a shared ownership scheme (if field 7 = 2 or 3) or if the buyer was not a private registered provider, housing association or local authority tenant immediately before sale (if field 99 = 2)",,,"Yes, if the purchase was not made through a shared ownership scheme (if field 7 = 2 or 3)",,,"Yes, if the purchase was not made through a shared ownership scheme (if field 7 = 2 or 3) or if a mortgage was not used (if field 105 = 2)",,"Yes, if the purchase was not made through a shared ownership scheme (if field 7 = 2 or 3), if a mortgage was not used (if field 105 = 2) or if 'Other' is not selected for mortgage lender name (if field 107 is not 40)","Yes, if the purchase was not made through a shared ownership scheme (if field 7 = 2 or 3) or if a mortgage was not used (if field 105 = 2)",,"Yes, if the purchase was not made through a shared ownership scheme (if field 7 = 2 or 3)","Yes, if the purchase was not made through a shared ownership scheme (if field 7 = 2 or 3) or the type of shared ownership sale is not Social Homebuy (if field 8 is not 18)","Yes, if the purchase was not made through a shared ownership scheme (if field 7 = 2 or 3)",,"Yes, if the purchase was not made through a discounted ownership scheme (if field 7 = 1 or 3)",,"Yes, if the purchase was not made through a discounted ownership scheme (if field 7 = 1 or 3) or if the type of discounted sale is PRTB, VRTB, RTB, or Rent to Buy (if field 9 is null, 9, 14, 27 or 29)","Yes, if the purchase was not made through a discounted ownership scheme (if field 7 = 1 or 3 or if the type of discounted sale is not PRTB, VRTB, or RTB (if field 9 is null, 8, 29, 21, 22)","Yes, if the purchase was not made through a discounted ownership scheme (if field 7 = 1 or 3)","Yes, if the purchase was not made through a discounted ownership scheme (if field 7 = 1 or 3) or if a mortgage was not used (if field 119 = 2)",,"Yes, if the purchase was not made through a discounted ownership scheme (if field 7 = 1 or 3), if a mortgage was not used (if field 119 = 2) or if 'Other' is not selected for mortgage lender name (if field 121 is not 40)","Yes, if the purchase was not made through a discounted ownership scheme (if field 7 = 1 or 3) or if a mortgage was not used (if field 119 = 2)",,"Yes, if the purchase was not made through a discounted ownership scheme (if field 7 = 1 or 3)",,"Yes, if the purchase was not an outright sale (if field 7 = 1 or 2)",,"Yes, if the purchase was not an outright sale (if field 7 = 1 or 2) or if a mortgage was not used (if field 128 = 2)",,"Yes, if the purchase was not an outright sale (if field 7 = 1 or 2), if a mortgage was not used (if field 128 = 2), or if 'Other' is not selected for mortgage lender name (if field 130 is not 40)","Yes, if the purchase was not an outright sale (if field 7 = 1 or 2) or if a mortgage was not used (if field 128 = 2)",,"Yes, if the purchase was not an outright sale (if field 7 = 1 or 2)", +Types of sales the question applies to,,,,,,,,Shared ownership only,Discounted ownership only,Outright sale only,,,,,Joint purchase only,,,,,,,,,,,,,,,,,,,,,,,,,Joint purchase only,,,,Joint purchase only,,,,,,,,,,,,,,,,,,,,,,,,,,,Joint purchase only,,,,,,,,,Joint purchase only,,,,,Shared ownership only,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,Discounted ownership only,,,,,,,,,,,,Outright sale only,,,,,,,, +Duplicate check field?,Yes,,Yes,,,,,,,,,,,,,,,,,,,,,Yes,,,,,,Yes,,,,,Yes,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Field number,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135 +,,,2,10,23,23 test BU,1,2,,,,,M,1,2,1,1,1,,123,,123,,A1,1AA,E07000223,1,1,1,32,X,1,12,1,1,1,P,33,X,1,12,1,1,1,0,,,,,,,,,,,,,,,,,1,3,A1,1AA,1,1,250000,25,42500,3,21000,8,800,7,1,1,,1,,1,1,,1,1,,1,10,10,1,,123,,,3,,5,1,1,1,1,1,200000,25,1,200000,1,,2,1,50000,1,1,,1,1,1,1,0,10,10,1,1,,,,,,,,,,,, diff --git a/spec/fixtures/files/blank_bulk_upload_sales.csv b/spec/fixtures/files/blank_bulk_upload_sales.csv index 4771d9fc9..d7245840c 100644 --- a/spec/fixtures/files/blank_bulk_upload_sales.csv +++ b/spec/fixtures/files/blank_bulk_upload_sales.csv @@ -100,9 +100,9 @@ Shared ownership","Was a mortgage used for the purchase of this property? Discounted ownership","Was a mortgage used for the purchase of this property? -Outright sale" +Outright sale" Values,Max 9 digits,1 - 31,1 - 12,19 - 23,,1 or null,"15 - 110 -or R",1 - 110 or R,,,,,"M, F, X or R",,,,,,"P, C, X or R",,,,,0 - 10,,,,,,1 - 19,"12 -13, 17 -19",0 - 99999,,1 or 2,1 or 2,0 - 999990,1 - 3,,1 - 7 or 9,ONS CODE - E + 9 digits,XXX(X),XXX,1 or null,,,,,1 - 3,1 - 3,1 - 9,1 - 4 or 9,1 or 2,ONS CODE E + 9 digits,XXX(X),XXX,1 - 3,"2, 16, 18, 24, 28 or 30-31",1 or 2,1 - 31,1 - 12,19 - 23,1 - 31,1 - 12,19 - 23,1 - 3,1 - 9,1 - 4 or 9,0 - 999999,0 - 100,0 - 999999,1 - 3,0 - 999999,,0 - 999.99,,"8, 9, 14, 21, 22, 27 or 29",0 - 999999,,0 - 100,0 - 999999,1 - 3,0 - 999999,0 - 999.99,10 or 12,,,0 - 999999,,1-3,0 - 999999,0-999.99,Up to 7 digits,Username of CORE account this sales log should be assigned to,,3 - 8,,4 - 7,1 - 40,,1 - 40,,1 - 40,,1 - 4, Integer <=60, Integer <=60, Integer <=60, Integer <=80,1 - 3, Integer <=80,1 - 3,1,1 - 3,1 - 2,1 - 2,1 - 2,1 - 2,1 - 2,0 - 5,1 - 100,1 - 100,1-3 or 9-10,1 - 2,1 - 2,1 - 2 +or R",1 - 110 or R,,,,,"M, F, X or R",,,,,,"P, C, X or R",,,,,0 - 10,,,,,,1 - 19,"12 -13, 17 -19",0 - 99999,,1 or 2,1 or 2,0 - 999990,1 - 3,,1 - 7 or 9,ONS CODE - E + 9 digits,XXX(X),XXX,1 or null,,,,,1 - 3,1 - 3,1 - 9,1 - 4 or 9,1 or 2,ONS CODE E + 9 digits,XXX(X),XXX,1 - 3,"2, 16, 18, 24, 28 or 30-31",1 or 2,1 - 31,1 - 12,19 - 23,1 - 31,1 - 12,19 - 23,1 - 3,1 - 9,1 - 4 or 9,0 - 999999,0 - 100,0 - 999999,1 - 3,0 - 999999,,0 - 999.99,,"8, 9, 14, 21, 22, 27 or 29",0 - 999999,,0 - 100,0 - 999999,1 - 3,0 - 999999,0 - 999.99,10 or 12,,,0 - 999999,,1-3,0 - 999999,0-999.99,Up to 7 digits,Username of CORE account this sales log should be assigned to,,3 - 8,,4 - 7,1 - 40,,1 - 40,,1 - 40,,1 - 4, Integer <=60, Integer <=60, Integer <=60, Integer <=80,1 - 3, Integer <=80,1 - 3,1,1 - 3,1 - 2,1 - 2,1 - 2,1 - 2,1 - 2,0 - 5,1 - 100,1 - 100,1-3 or 9-10,1 - 2,1 - 2,1 - 2 Can be Null?,No,,,,,No,No,"If fields 14, 19 and 25 are all also null","If fields 15, 20 and 26 are all also null","If fields 16, 21 and 27 are all also null","If fields 17, 22 and 28 are all also null","If fields 18, 23 and 29 are all also null",No,"If fields 8, 19 and 25 are all also null","If fields 9, 20 and 26 are also null","If fields 10, 21 and 27 are all also null","If fields 11, 22 and 28 are all also null","If fields 12, 23 and 29 are all also null","If fields 8, 14 and 25 are all also null","If fields 9, 15 and 26 are all also null","If fields 10, 16 and 27 are all also null","If fields 11, 17 and 28 are all also null","If fields 12, 18 and 29 are all also null",If field 6 = 1,"If fields 8, 14 and 19 are all also null","If fields 9, 15 and 20 are all also null","If fields 10, 16 and 21 are all also null","If fields 11, 17 and 22 are all also null","If fields 12, 18 and 23 are all also null",If field 6 = 1,,,If field 116 = 2,If field 32 is null,If field 116 = 2,If field 6 = 1,,,If field 6 = 1,No,If field 43 = 1,,If fields 41 and 42 BOTH have valid entries,Yes,,,,If field 6 = 1,,No,,,,,,,If field 113 = 2 or 3,,,,,,,,,"If field 113 = 2 or 3 OR field 39 = 3 - 7 or 9",,If field 113 = 2 or 3,,,,,"If field 57 is null, 2, 16, 24 or 28",If field 113 = 2 or 3,,If field 113 = 1 or 3,If field 76 is null,"If field 76 is null, 9 or 14","If field 76 is null, 8, 21 or 22",If field 113 = 1 or 3,,,,If field 113 = 1 or 2,If field 84 is null or 10,,If field 113 = 1 or 2,,,,,No,Yes,,No,,No,If field 113 = 2 or 3,"If field 113 = 2 or 3 @@ -113,6 +113,6 @@ If field 100 is not 40",If field 113 = 1 or 2,"If field 113 = 1 or 2 OR If field 102 is not 40",No,If field 113 = 2 or 3,If field 113 = 1 or 3,If field 113 = 1 or 2,If field 113 = 1 or 3,If field 116 = 2,If field 113 = 2 or 3,If field 113 = 2 or 3,No,No,If field 113 = 1 or 2,If field 113 = 1 or 2,No,No,If field 116 = 2,No,If field 113 = 2 or 3,If field 113 = 2 or 3,"If field 113 = 1 or 2 OR -If field 39 = 3 - 9",If field 113 = 2 or 3,If field 113 = 1 or 3,If field 113 = 1 or 2 -Bulk upload format and duplicate check,Yes,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, -Field number,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125 +If field 39 = 3 - 9",If field 113 = 2 or 3,If field 113 = 1 or 3,If field 113 = 1 or 2 +Bulk upload format and duplicate check,Yes,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Field number,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125 diff --git a/spec/fixtures/files/excel_as_csv.csv b/spec/fixtures/files/excel_as_csv.csv index f1b7de0bbd3a9f1cce894328a3c5e2df7c2760af..be73176652bdb553dc8fb6513c42d3b87218a64b 100644 GIT binary patch delta 46 zcmV+}0MY;Tzya{U0g$J$s1^dVzXHq>5(V`AjpyqD>WkO(hVU;Kpy1-{cwG%W6=I(}?DD9XEewy3Ww KP{E6+4psnJ;uTE* diff --git a/spec/fixtures/files/lettings_log_csv_export_codes_23.csv b/spec/fixtures/files/lettings_log_csv_export_codes_23.csv index 7415f59f4..326984a3b 100644 --- a/spec/fixtures/files/lettings_log_csv_export_codes_23.csv +++ b/spec/fixtures/files/lettings_log_csv_export_codes_23.csv @@ -1,2 +1,2 @@ id,status,duplicate_set_id,created_by,assigned_to,is_dpo,created_at,updated_by,updated_at,creation_method,old_id,old_form_id,collection_start_year,owning_organisation_name,managing_organisation_name,needstype,lettype,renewal,startdate,renttype,renttype_detail,irproduct,irproduct_other,lar,tenancycode,propcode,uprn_known,uprn,uprn_confirmed,address_line1,address_line2,town_or_city,county,postcode_full,is_la_inferred,la_label,la,first_time_property_let_as_social_housing,unitletas,rsnvac,newprop,offered,unittype_gn,builtype,wchair,beds,voiddate,vacdays,void_date_value_check,majorrepairs,mrcdate,major_repairs_date_value_check,joint,startertenancy,tenancy,tenancyother,tenancylength,sheltered,declaration,hhmemb,pregnancy_value_check,refused,hhtype,totchild,totelder,totadult,age1,retirement_value_check,sex1,ethnic_group,ethnic,national,ecstat1,details_known_2,relat2,age2,sex2,ecstat2,details_known_3,relat3,age3,sex3,ecstat3,details_known_4,relat4,age4,sex4,ecstat4,details_known_5,relat5,age5,sex5,ecstat5,details_known_6,relat6,age6,sex6,ecstat6,details_known_7,relat7,age7,sex7,ecstat7,details_known_8,relat8,age8,sex8,ecstat8,armedforces,leftreg,reservist,preg_occ,housingneeds,housingneeds_type,housingneeds_a,housingneeds_b,housingneeds_c,housingneeds_f,housingneeds_g,housingneeds_h,housingneeds_other,illness,illness_type_4,illness_type_5,illness_type_2,illness_type_6,illness_type_7,illness_type_3,illness_type_9,illness_type_8,illness_type_1,illness_type_10,layear,waityear,reason,reasonother,prevten,homeless,ppcodenk,ppostcode_full,previous_la_known,is_previous_la_inferred,prevloc_label,prevloc,reasonpref,rp_homeless,rp_insan_unsat,rp_medwel,rp_hardship,rp_dontknow,cbl,cap,chr,letting_allocation_none,referral,referral_value_check,net_income_known,incref,incfreq,earnings,net_income_value_check,hb,has_benefits,benefits,household_charge,nocharge,period,is_carehome,chcharge,wchchrg,carehome_charges_value_check,brent,wrent,rent_value_check,scharge,wscharge,pscharge,wpschrge,supcharg,wsupchrg,tcharge,wtcharge,scharge_value_check,pscharge_value_check,supcharg_value_check,hbrentshortfall,tshortfall_known,tshortfall,wtshortfall,scheme_code,scheme_service_name,scheme_confidential,SCHTYPE,scheme_registered_under_care_act,scheme_owning_organisation_name,scheme_primary_client_group,scheme_has_other_client_group,scheme_secondary_client_group,scheme_support_type,scheme_intended_stay,scheme_created_at,location_code,location_postcode,location_name,location_units,location_type_of_unit,location_mobility_type,location_local_authority,location_startdate -,completed,,s.port@jeemayle.com,s.port@jeemayle.com,false,2023-11-26T00:00:00+00:00,,2023-11-26T00:00:00+00:00,1,,,2023,DLUHC,DLUHC,1,7,0,2023-11-26,2,2,,,2,HIJKLMN,ABCDEFG,0,,,Address line 1,,London,,NW9 5LL,false,Barnet,E09000003,0,2,6,2,2,7,1,1,3,2023-11-24,1,,1,2023-11-25,,3,1,4,,2,,1,4,,1,4,0,0,2,35,,F,0,2,13,0,0,P,32,M,6,1,R,-9,R,10,0,R,-9,R,10,,,,,,,,,,,,,,,,,,,,,1,4,1,2,1,0,1,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,2,7,4,,6,1,0,TN23 6LZ,1,false,Ashford,E07000105,1,0,1,0,0,0,0,0,1,,2,,0,0,1,268,,6,1,1,,0,2,,,,,200.0,100.0,,50.0,25.0,40.0,20.0,35.0,17.5,325.0,162.5,,,,1,0,12.0,6.0,,,,,,,,,,,,,,,,,,,, +,completed,,s.port@jeemayle.com,s.port@jeemayle.com,false,2023-11-26T00:00:00+00:00,,2023-11-26T00:00:00+00:00,1,,,2023,MHCLG,MHCLG,1,7,0,2023-11-26,2,2,,,2,HIJKLMN,ABCDEFG,0,,,Address line 1,,London,,NW9 5LL,false,Barnet,E09000003,0,2,6,2,2,7,1,1,3,2023-11-24,1,,1,2023-11-25,,3,1,4,,2,,1,4,,1,4,0,0,2,35,,F,0,2,13,0,0,P,32,M,6,1,R,-9,R,10,0,R,-9,R,10,,,,,,,,,,,,,,,,,,,,,1,4,1,2,1,0,1,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,2,7,4,,6,1,0,TN23 6LZ,1,false,Ashford,E07000105,1,0,1,0,0,0,0,0,1,,2,,0,0,1,268,,6,1,1,,0,2,,,,,200.0,100.0,,50.0,25.0,40.0,20.0,35.0,17.5,325.0,162.5,,,,1,0,12.0,6.0,,,,,,,,,,,,,,,,,,,, diff --git a/spec/fixtures/files/lettings_log_csv_export_codes_24.csv b/spec/fixtures/files/lettings_log_csv_export_codes_24.csv index c3db1c8ec..de7bb5876 100644 --- a/spec/fixtures/files/lettings_log_csv_export_codes_24.csv +++ b/spec/fixtures/files/lettings_log_csv_export_codes_24.csv @@ -1,2 +1,2 @@ id,status,duplicate_set_id,created_by,assigned_to,is_dpo,created_at,updated_by,updated_at,creation_method,collection_start_year,bulk_upload_id,owning_organisation_name,managing_organisation_name,needstype,lettype,renewal,startdate,renttype,renttype_detail,irproduct,irproduct_other,lar,tenancycode,propcode,declaration,uprn,address_line1,address_line2,town_or_city,county,postcode_full,is_la_inferred,la_label,la,uprn_known,uprn_selection,address_search_value_check,address_line1_input,postcode_full_input,address_line1_as_entered,address_line2_as_entered,town_or_city_as_entered,county_as_entered,postcode_full_as_entered,la_as_entered,first_time_property_let_as_social_housing,unitletas,rsnvac,newprop,unittype_gn,builtype,wchair,beds,voiddate,vacdays,void_date_value_check,majorrepairs,mrcdate,major_repairs_date_value_check,joint,startertenancy,tenancy,tenancyother,tenancylength,sheltered,hhmemb,pregnancy_value_check,refused,hhtype,totchild,totelder,totadult,age1,retirement_value_check,sex1,ethnic_group,ethnic,nationality_all,ecstat1,details_known_2,relat2,partner_under_16_value_check,multiple_partners_value_check,age2,sex2,ecstat2,details_known_3,relat3,age3,sex3,ecstat3,details_known_4,relat4,age4,sex4,ecstat4,details_known_5,relat5,age5,sex5,ecstat5,details_known_6,relat6,age6,sex6,ecstat6,details_known_7,relat7,age7,sex7,ecstat7,details_known_8,relat8,age8,sex8,ecstat8,armedforces,leftreg,reservist,preg_occ,housingneeds,housingneeds_type,housingneeds_a,housingneeds_b,housingneeds_c,housingneeds_f,housingneeds_g,housingneeds_h,housingneeds_other,illness,illness_type_4,illness_type_5,illness_type_2,illness_type_6,illness_type_7,illness_type_3,illness_type_9,illness_type_8,illness_type_1,illness_type_10,layear,waityear,reason,reasonother,reasonother_value_check,prevten,homeless,ppcodenk,ppostcode_full,previous_la_known,is_previous_la_inferred,prevloc_label,prevloc,reasonpref,rp_homeless,rp_insan_unsat,rp_medwel,rp_hardship,rp_dontknow,cbl,cap,chr,accessible_register,letting_allocation_none,referral,referral_value_check,net_income_known,incref,incfreq,earnings,net_income_value_check,hb,has_benefits,benefits,household_charge,nocharge,period,is_carehome,chcharge,wchchrg,carehome_charges_value_check,brent,wrent,rent_value_check,scharge,wscharge,pscharge,wpschrge,supcharg,wsupchrg,tcharge,wtcharge,scharge_value_check,pscharge_value_check,supcharg_value_check,hbrentshortfall,tshortfall_known,tshortfall,wtshortfall,scheme_code,scheme_service_name,scheme_confidential,SCHTYPE,scheme_registered_under_care_act,scheme_owning_organisation_name,scheme_primary_client_group,scheme_has_other_client_group,scheme_secondary_client_group,scheme_support_type,scheme_intended_stay,scheme_created_at,location_code,location_postcode,location_name,location_units,location_type_of_unit,location_mobility_type,location_local_authority,location_startdate -,in_progress,,s.port@jeemayle.com,s.port@jeemayle.com,false,2024-04-01T00:00:00+01:00,,2024-04-01T00:00:00+01:00,1,2024,,DLUHC,DLUHC,1,7,0,2024-04-01,2,2,,,2,HIJKLMN,ABCDEFG,1,,Address line 1,,London,,NW9 5LL,false,Barnet,E09000003,0,,,,,address line 1 as entered,address line 2 as entered,town or city as entered,county as entered,AB1 2CD,la as entered,0,2,6,2,7,1,1,3,2024-03-30,1,,1,2024-03-31,,3,1,4,,2,,4,,1,4,0,0,2,35,,F,0,2,36,0,0,P,,,32,M,6,1,R,-9,R,10,0,R,-9,R,10,,,,,,,,,,,,,,,,,,,,,1,4,1,2,1,0,1,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,2,7,4,,,6,1,0,TN23 6LZ,1,false,Ashford,E07000105,1,0,1,0,0,0,0,0,1,0,,2,,0,0,1,268,,6,1,1,,0,2,,,,,200.0,100.0,,50.0,25.0,40.0,20.0,35.0,17.5,325.0,162.5,,,,1,0,12.0,6.0,,,,,,,,,,,,,,,,,,,, +,in_progress,,s.port@jeemayle.com,s.port@jeemayle.com,false,2024-04-01T00:00:00+01:00,,2024-04-01T00:00:00+01:00,1,2024,,MHCLG,MHCLG,1,7,0,2024-04-01,2,2,,,2,HIJKLMN,ABCDEFG,1,,Address line 1,,London,,NW9 5LL,false,Barnet,E09000003,0,,,,,address line 1 as entered,address line 2 as entered,town or city as entered,county as entered,AB1 2CD,la as entered,0,2,6,2,7,1,1,3,2024-03-30,1,,1,2024-03-31,,3,1,4,,2,,4,,1,4,0,0,2,35,,F,0,2,36,0,0,P,,,32,M,6,1,R,-9,R,10,0,R,-9,R,10,,,,,,,,,,,,,,,,,,,,,1,4,1,2,1,0,1,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,2,7,4,,,6,1,0,TN23 6LZ,1,false,Ashford,E07000105,1,0,1,0,0,0,0,0,1,0,,2,,0,0,1,268,,6,1,1,,0,2,,,,,200.0,100.0,,50.0,25.0,40.0,20.0,35.0,17.5,325.0,162.5,,,,1,0,12.0,6.0,,,,,,,,,,,,,,,,,,,, diff --git a/spec/fixtures/files/lettings_log_csv_export_labels_23.csv b/spec/fixtures/files/lettings_log_csv_export_labels_23.csv index 227f562b3..f14ca59c5 100644 --- a/spec/fixtures/files/lettings_log_csv_export_labels_23.csv +++ b/spec/fixtures/files/lettings_log_csv_export_labels_23.csv @@ -1,2 +1,2 @@ id,status,duplicate_set_id,created_by,assigned_to,is_dpo,created_at,updated_by,updated_at,creation_method,old_id,old_form_id,collection_start_year,owning_organisation_name,managing_organisation_name,needstype,lettype,renewal,startdate,renttype,renttype_detail,irproduct,irproduct_other,lar,tenancycode,propcode,uprn_known,uprn,uprn_confirmed,address_line1,address_line2,town_or_city,county,postcode_full,is_la_inferred,la_label,la,first_time_property_let_as_social_housing,unitletas,rsnvac,newprop,offered,unittype_gn,builtype,wchair,beds,voiddate,vacdays,void_date_value_check,majorrepairs,mrcdate,major_repairs_date_value_check,joint,startertenancy,tenancy,tenancyother,tenancylength,sheltered,declaration,hhmemb,pregnancy_value_check,refused,hhtype,totchild,totelder,totadult,age1,retirement_value_check,sex1,ethnic_group,ethnic,national,ecstat1,details_known_2,relat2,age2,sex2,ecstat2,details_known_3,relat3,age3,sex3,ecstat3,details_known_4,relat4,age4,sex4,ecstat4,details_known_5,relat5,age5,sex5,ecstat5,details_known_6,relat6,age6,sex6,ecstat6,details_known_7,relat7,age7,sex7,ecstat7,details_known_8,relat8,age8,sex8,ecstat8,armedforces,leftreg,reservist,preg_occ,housingneeds,housingneeds_type,housingneeds_a,housingneeds_b,housingneeds_c,housingneeds_f,housingneeds_g,housingneeds_h,housingneeds_other,illness,illness_type_4,illness_type_5,illness_type_2,illness_type_6,illness_type_7,illness_type_3,illness_type_9,illness_type_8,illness_type_1,illness_type_10,layear,waityear,reason,reasonother,prevten,homeless,ppcodenk,ppostcode_full,previous_la_known,is_previous_la_inferred,prevloc_label,prevloc,reasonpref,rp_homeless,rp_insan_unsat,rp_medwel,rp_hardship,rp_dontknow,cbl,cap,chr,letting_allocation_none,referral,referral_value_check,net_income_known,incref,incfreq,earnings,net_income_value_check,hb,has_benefits,benefits,household_charge,nocharge,period,is_carehome,chcharge,wchchrg,carehome_charges_value_check,brent,wrent,rent_value_check,scharge,wscharge,pscharge,wpschrge,supcharg,wsupchrg,tcharge,wtcharge,scharge_value_check,pscharge_value_check,supcharg_value_check,hbrentshortfall,tshortfall_known,tshortfall,wtshortfall,scheme_code,scheme_service_name,scheme_confidential,SCHTYPE,scheme_registered_under_care_act,scheme_owning_organisation_name,scheme_primary_client_group,scheme_has_other_client_group,scheme_secondary_client_group,scheme_support_type,scheme_intended_stay,scheme_created_at,location_code,location_postcode,location_name,location_units,location_type_of_unit,location_mobility_type,location_local_authority,location_startdate -,completed,,s.port@jeemayle.com,s.port@jeemayle.com,false,2023-11-26T00:00:00+00:00,,2023-11-26T00:00:00+00:00,single log,,,2023,DLUHC,DLUHC,General needs,Affordable rent general needs local authority,No,2023-11-26,Affordable Rent,Affordable Rent,,,No,HIJKLMN,ABCDEFG,No,,,Address line 1,,London,,NW9 5LL,No,Barnet,E09000003,No,Affordable rent basis,Tenant abandoned property,No,2,House,Purpose built,Yes,3,2023-11-24,1,,Yes,2023-11-25,,Don’t know,Yes,Assured Shorthold Tenancy (AST) – Fixed term,,2,,Yes,4,,Yes,4,0,0,2,35,,Female,White,Irish,Tenant prefers not to say,Other,Yes,Partner,32,Male,Not seeking work,No,Prefers not to say,Not known,Prefers not to say,Prefers not to say,Yes,Person prefers not to say,Not known,Person prefers not to say,Person prefers not to say,,,,,,,,,,,,,,,,,,,,,Yes – the person is a current or former regular,No – they left up to and including 5 years ago,Yes,No,Yes,Fully wheelchair accessible housing,Yes,No,No,No,No,No,No,Yes,No,No,Yes,No,No,No,No,No,No,No,Less than 1 year,1 year but under 2 years,Loss of tied accommodation,,Other supported housing,No,Yes,TN23 6LZ,Yes,No,Ashford,E07000105,Yes,,Yes,,,,No,No,Yes,,Tenant applied directly (no referral or nomination),,Yes,No,Weekly,268,,Universal Credit housing element,Yes,All,,No,Every 2 weeks,,,,,200.0,100.0,,50.0,25.0,40.0,20.0,35.0,17.5,325.0,162.5,,,,Yes,Yes,12.0,6.0,,,,,,,,,,,,,,,,,,,, +,completed,,s.port@jeemayle.com,s.port@jeemayle.com,false,2023-11-26T00:00:00+00:00,,2023-11-26T00:00:00+00:00,single log,,,2023,MHCLG,MHCLG,General needs,Affordable rent general needs local authority,No,2023-11-26,Affordable Rent,Affordable Rent,,,No,HIJKLMN,ABCDEFG,No,,,Address line 1,,London,,NW9 5LL,No,Barnet,E09000003,No,Affordable rent basis,Tenant abandoned property,No,2,House,Purpose built,Yes,3,2023-11-24,1,,Yes,2023-11-25,,Don’t know,Yes,Assured Shorthold Tenancy (AST) – Fixed term,,2,,Yes,4,,Yes,4,0,0,2,35,,Female,White,Irish,Tenant prefers not to say,Other,Yes,Partner,32,Male,Not seeking work,No,Prefers not to say,Not known,Prefers not to say,Prefers not to say,Yes,Person prefers not to say,Not known,Person prefers not to say,Person prefers not to say,,,,,,,,,,,,,,,,,,,,,Yes – the person is a current or former regular,No – they left up to and including 5 years ago,Yes,No,Yes,Fully wheelchair accessible housing,Yes,No,No,No,No,No,No,Yes,No,No,Yes,No,No,No,No,No,No,No,Less than 1 year,1 year but under 2 years,Loss of tied accommodation,,Other supported housing,No,Yes,TN23 6LZ,Yes,No,Ashford,E07000105,Yes,,Yes,,,,No,No,Yes,,Tenant applied directly (no referral or nomination),,Yes,No,Weekly,268,,Universal Credit housing element,Yes,All,,No,Every 2 weeks,,,,,200.0,100.0,,50.0,25.0,40.0,20.0,35.0,17.5,325.0,162.5,,,,Yes,Yes,12.0,6.0,,,,,,,,,,,,,,,,,,,, diff --git a/spec/fixtures/files/lettings_log_csv_export_labels_24.csv b/spec/fixtures/files/lettings_log_csv_export_labels_24.csv index 48e4e0f33..aeb09311c 100644 --- a/spec/fixtures/files/lettings_log_csv_export_labels_24.csv +++ b/spec/fixtures/files/lettings_log_csv_export_labels_24.csv @@ -1,2 +1,2 @@ id,status,duplicate_set_id,created_by,assigned_to,is_dpo,created_at,updated_by,updated_at,creation_method,collection_start_year,bulk_upload_id,owning_organisation_name,managing_organisation_name,needstype,lettype,renewal,startdate,renttype,renttype_detail,irproduct,irproduct_other,lar,tenancycode,propcode,declaration,uprn,address_line1,address_line2,town_or_city,county,postcode_full,is_la_inferred,la_label,la,uprn_known,uprn_selection,address_search_value_check,address_line1_input,postcode_full_input,address_line1_as_entered,address_line2_as_entered,town_or_city_as_entered,county_as_entered,postcode_full_as_entered,la_as_entered,first_time_property_let_as_social_housing,unitletas,rsnvac,newprop,unittype_gn,builtype,wchair,beds,voiddate,vacdays,void_date_value_check,majorrepairs,mrcdate,major_repairs_date_value_check,joint,startertenancy,tenancy,tenancyother,tenancylength,sheltered,hhmemb,pregnancy_value_check,refused,hhtype,totchild,totelder,totadult,age1,retirement_value_check,sex1,ethnic_group,ethnic,nationality_all,ecstat1,details_known_2,relat2,partner_under_16_value_check,multiple_partners_value_check,age2,sex2,ecstat2,details_known_3,relat3,age3,sex3,ecstat3,details_known_4,relat4,age4,sex4,ecstat4,details_known_5,relat5,age5,sex5,ecstat5,details_known_6,relat6,age6,sex6,ecstat6,details_known_7,relat7,age7,sex7,ecstat7,details_known_8,relat8,age8,sex8,ecstat8,armedforces,leftreg,reservist,preg_occ,housingneeds,housingneeds_type,housingneeds_a,housingneeds_b,housingneeds_c,housingneeds_f,housingneeds_g,housingneeds_h,housingneeds_other,illness,illness_type_4,illness_type_5,illness_type_2,illness_type_6,illness_type_7,illness_type_3,illness_type_9,illness_type_8,illness_type_1,illness_type_10,layear,waityear,reason,reasonother,reasonother_value_check,prevten,homeless,ppcodenk,ppostcode_full,previous_la_known,is_previous_la_inferred,prevloc_label,prevloc,reasonpref,rp_homeless,rp_insan_unsat,rp_medwel,rp_hardship,rp_dontknow,cbl,cap,chr,accessible_register,letting_allocation_none,referral,referral_value_check,net_income_known,incref,incfreq,earnings,net_income_value_check,hb,has_benefits,benefits,household_charge,nocharge,period,is_carehome,chcharge,wchchrg,carehome_charges_value_check,brent,wrent,rent_value_check,scharge,wscharge,pscharge,wpschrge,supcharg,wsupchrg,tcharge,wtcharge,scharge_value_check,pscharge_value_check,supcharg_value_check,hbrentshortfall,tshortfall_known,tshortfall,wtshortfall,scheme_code,scheme_service_name,scheme_confidential,SCHTYPE,scheme_registered_under_care_act,scheme_owning_organisation_name,scheme_primary_client_group,scheme_has_other_client_group,scheme_secondary_client_group,scheme_support_type,scheme_intended_stay,scheme_created_at,location_code,location_postcode,location_name,location_units,location_type_of_unit,location_mobility_type,location_local_authority,location_startdate -,in_progress,,s.port@jeemayle.com,s.port@jeemayle.com,false,2024-04-01T00:00:00+01:00,,2024-04-01T00:00:00+01:00,single log,2024,,DLUHC,DLUHC,General needs,Affordable rent general needs local authority,No,2024-04-01,Affordable Rent,Affordable Rent,,,No,HIJKLMN,ABCDEFG,Yes,,Address line 1,,London,,NW9 5LL,No,Barnet,E09000003,No,,,,,address line 1 as entered,address line 2 as entered,town or city as entered,county as entered,AB1 2CD,la as entered,No,Affordable rent basis,Tenant abandoned property,No,House,Purpose built,Yes,3,2024-03-30,1,,Yes,2024-03-31,,Don’t know,Yes,Assured Shorthold Tenancy (AST) – Fixed term,,2,,4,,Yes,4,0,0,2,35,,Female,White,Irish,Australia,Other,Yes,Partner,,,32,Male,Not seeking work,No,Prefers not to say,Not known,Prefers not to say,Prefers not to say,Yes,Person prefers not to say,Not known,Person prefers not to say,Person prefers not to say,,,,,,,,,,,,,,,,,,,,,Yes – the person is a current or former regular,No – they left up to and including 5 years ago,Yes,No,Yes,Fully wheelchair accessible housing,Yes,No,No,No,No,No,No,Yes,No,No,Yes,No,No,No,No,No,No,No,Less than 1 year,1 year but under 2 years,Loss of tied accommodation,,,Other supported housing,No,Yes,TN23 6LZ,Yes,No,Ashford,E07000105,Yes,,Yes,,,,No,No,Yes,No,,Tenant applied directly (no referral or nomination),,Yes,No,Weekly,268,,Universal Credit housing element,Yes,All,,No,Every 2 weeks,,,,,200.0,100.0,,50.0,25.0,40.0,20.0,35.0,17.5,325.0,162.5,,,,Yes,Yes,12.0,6.0,,,,,,,,,,,,,,,,,,,, +,in_progress,,s.port@jeemayle.com,s.port@jeemayle.com,false,2024-04-01T00:00:00+01:00,,2024-04-01T00:00:00+01:00,single log,2024,,MHCLG,MHCLG,General needs,Affordable rent general needs local authority,No,2024-04-01,Affordable Rent,Affordable Rent,,,No,HIJKLMN,ABCDEFG,Yes,,Address line 1,,London,,NW9 5LL,No,Barnet,E09000003,No,,,,,address line 1 as entered,address line 2 as entered,town or city as entered,county as entered,AB1 2CD,la as entered,No,Affordable rent basis,Tenant abandoned property,No,House,Purpose built,Yes,3,2024-03-30,1,,Yes,2024-03-31,,Don’t know,Yes,Assured Shorthold Tenancy (AST) – Fixed term,,2,,4,,Yes,4,0,0,2,35,,Female,White,Irish,Australia,Other,Yes,Partner,,,32,Male,Not seeking work,No,Prefers not to say,Not known,Prefers not to say,Prefers not to say,Yes,Person prefers not to say,Not known,Person prefers not to say,Person prefers not to say,,,,,,,,,,,,,,,,,,,,,Yes – the person is a current or former regular,No – they left up to and including 5 years ago,Yes,No,Yes,Fully wheelchair accessible housing,Yes,No,No,No,No,No,No,Yes,No,No,Yes,No,No,No,No,No,No,No,Less than 1 year,1 year but under 2 years,Loss of tied accommodation,,,Other supported housing,No,Yes,TN23 6LZ,Yes,No,Ashford,E07000105,Yes,,Yes,,,,No,No,Yes,No,,Tenant applied directly (no referral or nomination),,Yes,No,Weekly,268,,Universal Credit housing element,Yes,All,,No,Every 2 weeks,,,,,200.0,100.0,,50.0,25.0,40.0,20.0,35.0,17.5,325.0,162.5,,,,Yes,Yes,12.0,6.0,,,,,,,,,,,,,,,,,,,, diff --git a/spec/fixtures/files/lettings_log_csv_export_non_support_codes_23.csv b/spec/fixtures/files/lettings_log_csv_export_non_support_codes_23.csv index 23689ad52..e3e6a3ca6 100644 --- a/spec/fixtures/files/lettings_log_csv_export_non_support_codes_23.csv +++ b/spec/fixtures/files/lettings_log_csv_export_non_support_codes_23.csv @@ -1,2 +1,2 @@ id,status,duplicate_set_id,assigned_to,is_dpo,created_at,updated_by,updated_at,creation_method,collection_start_year,owning_organisation_name,managing_organisation_name,needstype,lettype,renewal,startdate,renttype,renttype_detail,irproduct,irproduct_other,lar,tenancycode,propcode,uprn_known,uprn,address_line1,address_line2,town_or_city,county,postcode_full,la_label,first_time_property_let_as_social_housing,unitletas,rsnvac,newprop,offered,unittype_gn,builtype,wchair,beds,voiddate,vacdays,majorrepairs,mrcdate,joint,startertenancy,tenancy,tenancyother,tenancylength,sheltered,declaration,hhmemb,refused,age1,sex1,ethnic_group,ethnic,national,ecstat1,relat2,age2,sex2,ecstat2,relat3,age3,sex3,ecstat3,relat4,age4,sex4,ecstat4,relat5,age5,sex5,ecstat5,relat6,age6,sex6,ecstat6,relat7,age7,sex7,ecstat7,relat8,age8,sex8,ecstat8,armedforces,leftreg,reservist,preg_occ,housingneeds,housingneeds_type,housingneeds_a,housingneeds_b,housingneeds_c,housingneeds_f,housingneeds_g,housingneeds_h,housingneeds_other,illness,illness_type_4,illness_type_5,illness_type_2,illness_type_6,illness_type_7,illness_type_3,illness_type_9,illness_type_8,illness_type_1,illness_type_10,layear,waityear,reason,reasonother,prevten,homeless,ppcodenk,ppostcode_full,prevloc_label,reasonpref,rp_homeless,rp_insan_unsat,rp_medwel,rp_hardship,rp_dontknow,cbl,cap,chr,letting_allocation_none,referral,incref,incfreq,earnings,hb,has_benefits,benefits,household_charge,nocharge,period,is_carehome,chcharge,wchchrg,brent,scharge,pscharge,supcharg,tcharge,hbrentshortfall,tshortfall,scheme_code,scheme_service_name,scheme_confidential,SCHTYPE,scheme_registered_under_care_act,scheme_owning_organisation_name,scheme_primary_client_group,scheme_has_other_client_group,scheme_secondary_client_group,scheme_support_type,scheme_intended_stay,scheme_created_at,location_code,location_postcode,location_name,location_units,location_type_of_unit,location_mobility_type,location_local_authority,location_startdate -,completed,,choreographer@owtluk.com,false,2023-11-26T00:00:00+00:00,,2023-11-26T00:00:00+00:00,1,2023,DLUHC,DLUHC,1,7,0,2023-11-26,2,2,,,2,HIJKLMN,ABCDEFG,0,,Address line 1,,London,,NW9 5LL,Barnet,0,2,6,2,2,7,1,1,3,2023-11-24,1,1,2023-11-25,3,1,4,,2,,1,4,1,35,F,0,2,13,0,P,32,M,6,R,-9,R,10,R,-9,R,10,,,,,,,,,,,,,,,,,1,4,1,2,1,0,1,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,2,7,4,,6,1,0,TN23 6LZ,Ashford,1,0,1,0,0,0,0,0,1,,2,0,1,268,6,1,1,,0,2,,,,200.0,50.0,40.0,35.0,325.0,1,12.0,,,,,,,,,,,,,,,,,,,, +,completed,,choreographer@owtluk.com,false,2023-11-26T00:00:00+00:00,,2023-11-26T00:00:00+00:00,1,2023,MHCLG,MHCLG,1,7,0,2023-11-26,2,2,,,2,HIJKLMN,ABCDEFG,0,,Address line 1,,London,,NW9 5LL,Barnet,0,2,6,2,2,7,1,1,3,2023-11-24,1,1,2023-11-25,3,1,4,,2,,1,4,1,35,F,0,2,13,0,P,32,M,6,R,-9,R,10,R,-9,R,10,,,,,,,,,,,,,,,,,1,4,1,2,1,0,1,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,2,7,4,,6,1,0,TN23 6LZ,Ashford,1,0,1,0,0,0,0,0,1,,2,0,1,268,6,1,1,,0,2,,,,200.0,50.0,40.0,35.0,325.0,1,12.0,,,,,,,,,,,,,,,,,,,, diff --git a/spec/fixtures/files/lettings_log_csv_export_non_support_codes_24.csv b/spec/fixtures/files/lettings_log_csv_export_non_support_codes_24.csv index b35d4dfc1..33793d5f6 100644 --- a/spec/fixtures/files/lettings_log_csv_export_non_support_codes_24.csv +++ b/spec/fixtures/files/lettings_log_csv_export_non_support_codes_24.csv @@ -1,2 +1,2 @@ id,status,duplicate_set_id,assigned_to,is_dpo,created_at,updated_by,updated_at,creation_method,collection_start_year,bulk_upload_id,owning_organisation_name,managing_organisation_name,needstype,lettype,renewal,startdate,renttype,renttype_detail,irproduct,irproduct_other,lar,tenancycode,propcode,declaration,uprn_known,uprn,address_line1,address_line2,town_or_city,county,postcode_full,la_label,first_time_property_let_as_social_housing,unitletas,rsnvac,newprop,unittype_gn,builtype,wchair,beds,voiddate,vacdays,majorrepairs,mrcdate,joint,startertenancy,tenancy,tenancyother,tenancylength,sheltered,hhmemb,refused,age1,sex1,ethnic_group,ethnic,nationality_all,ecstat1,relat2,age2,sex2,ecstat2,relat3,age3,sex3,ecstat3,relat4,age4,sex4,ecstat4,relat5,age5,sex5,ecstat5,relat6,age6,sex6,ecstat6,relat7,age7,sex7,ecstat7,relat8,age8,sex8,ecstat8,armedforces,leftreg,reservist,preg_occ,housingneeds,housingneeds_type,housingneeds_a,housingneeds_b,housingneeds_c,housingneeds_f,housingneeds_g,housingneeds_h,housingneeds_other,illness,illness_type_4,illness_type_5,illness_type_2,illness_type_6,illness_type_7,illness_type_3,illness_type_9,illness_type_8,illness_type_1,illness_type_10,layear,waityear,reason,reasonother,prevten,homeless,ppcodenk,ppostcode_full,prevloc_label,reasonpref,rp_homeless,rp_insan_unsat,rp_medwel,rp_hardship,rp_dontknow,cbl,cap,chr,accessible_register,letting_allocation_none,referral,incref,incfreq,earnings,hb,has_benefits,benefits,household_charge,nocharge,period,is_carehome,chcharge,wchchrg,brent,scharge,pscharge,supcharg,tcharge,hbrentshortfall,tshortfall,scheme_code,scheme_service_name,scheme_confidential,SCHTYPE,scheme_registered_under_care_act,scheme_owning_organisation_name,scheme_primary_client_group,scheme_has_other_client_group,scheme_secondary_client_group,scheme_support_type,scheme_intended_stay,scheme_created_at,location_code,location_postcode,location_name,location_units,location_type_of_unit,location_mobility_type,location_local_authority,location_startdate -,in_progress,,choreographer@owtluk.com,false,2024-04-01T00:00:00+01:00,,2024-04-01T00:00:00+01:00,1,2024,,DLUHC,DLUHC,1,7,0,2024-04-01,2,2,,,2,HIJKLMN,ABCDEFG,1,0,,Address line 1,,London,,NW9 5LL,Barnet,0,2,6,2,7,1,1,3,2024-03-30,1,1,2024-03-31,3,1,4,,2,,4,1,35,F,0,2,36,0,P,32,M,6,R,-9,R,10,R,-9,R,10,,,,,,,,,,,,,,,,,1,4,1,2,1,0,1,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,2,7,4,,6,1,0,TN23 6LZ,Ashford,1,0,1,0,0,0,0,0,1,0,,2,0,1,268,6,1,1,,0,2,,,,200.0,50.0,40.0,35.0,325.0,1,12.0,,,,,,,,,,,,,,,,,,,, +,in_progress,,choreographer@owtluk.com,false,2024-04-01T00:00:00+01:00,,2024-04-01T00:00:00+01:00,1,2024,,MHCLG,MHCLG,1,7,0,2024-04-01,2,2,,,2,HIJKLMN,ABCDEFG,1,0,,Address line 1,,London,,NW9 5LL,Barnet,0,2,6,2,7,1,1,3,2024-03-30,1,1,2024-03-31,3,1,4,,2,,4,1,35,F,0,2,36,0,P,32,M,6,R,-9,R,10,R,-9,R,10,,,,,,,,,,,,,,,,,1,4,1,2,1,0,1,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,2,7,4,,6,1,0,TN23 6LZ,Ashford,1,0,1,0,0,0,0,0,1,0,,2,0,1,268,6,1,1,,0,2,,,,200.0,50.0,40.0,35.0,325.0,1,12.0,,,,,,,,,,,,,,,,,,,, diff --git a/spec/fixtures/files/lettings_log_csv_export_non_support_labels_23.csv b/spec/fixtures/files/lettings_log_csv_export_non_support_labels_23.csv index 1bbbc2692..6c26d648f 100644 --- a/spec/fixtures/files/lettings_log_csv_export_non_support_labels_23.csv +++ b/spec/fixtures/files/lettings_log_csv_export_non_support_labels_23.csv @@ -1,2 +1,2 @@ id,status,duplicate_set_id,assigned_to,is_dpo,created_at,updated_by,updated_at,creation_method,collection_start_year,owning_organisation_name,managing_organisation_name,needstype,lettype,renewal,startdate,renttype,renttype_detail,irproduct,irproduct_other,lar,tenancycode,propcode,uprn_known,uprn,address_line1,address_line2,town_or_city,county,postcode_full,la_label,first_time_property_let_as_social_housing,unitletas,rsnvac,newprop,offered,unittype_gn,builtype,wchair,beds,voiddate,vacdays,majorrepairs,mrcdate,joint,startertenancy,tenancy,tenancyother,tenancylength,sheltered,declaration,hhmemb,refused,age1,sex1,ethnic_group,ethnic,national,ecstat1,relat2,age2,sex2,ecstat2,relat3,age3,sex3,ecstat3,relat4,age4,sex4,ecstat4,relat5,age5,sex5,ecstat5,relat6,age6,sex6,ecstat6,relat7,age7,sex7,ecstat7,relat8,age8,sex8,ecstat8,armedforces,leftreg,reservist,preg_occ,housingneeds,housingneeds_type,housingneeds_a,housingneeds_b,housingneeds_c,housingneeds_f,housingneeds_g,housingneeds_h,housingneeds_other,illness,illness_type_4,illness_type_5,illness_type_2,illness_type_6,illness_type_7,illness_type_3,illness_type_9,illness_type_8,illness_type_1,illness_type_10,layear,waityear,reason,reasonother,prevten,homeless,ppcodenk,ppostcode_full,prevloc_label,reasonpref,rp_homeless,rp_insan_unsat,rp_medwel,rp_hardship,rp_dontknow,cbl,cap,chr,letting_allocation_none,referral,incref,incfreq,earnings,hb,has_benefits,benefits,household_charge,nocharge,period,is_carehome,chcharge,wchchrg,brent,scharge,pscharge,supcharg,tcharge,hbrentshortfall,tshortfall,scheme_code,scheme_service_name,scheme_confidential,SCHTYPE,scheme_registered_under_care_act,scheme_owning_organisation_name,scheme_primary_client_group,scheme_has_other_client_group,scheme_secondary_client_group,scheme_support_type,scheme_intended_stay,scheme_created_at,location_code,location_postcode,location_name,location_units,location_type_of_unit,location_mobility_type,location_local_authority,location_startdate -,completed,,choreographer@owtluk.com,false,2023-11-26T00:00:00+00:00,,2023-11-26T00:00:00+00:00,single log,2023,DLUHC,DLUHC,General needs,Affordable rent general needs local authority,No,2023-11-26,Affordable Rent,Affordable Rent,,,No,HIJKLMN,ABCDEFG,No,,Address line 1,,London,,NW9 5LL,Barnet,No,Affordable rent basis,Tenant abandoned property,No,2,House,Purpose built,Yes,3,2023-11-24,1,Yes,2023-11-25,Don’t know,Yes,Assured Shorthold Tenancy (AST) – Fixed term,,2,,Yes,4,Yes,35,Female,White,Irish,Tenant prefers not to say,Other,Partner,32,Male,Not seeking work,Prefers not to say,Not known,Prefers not to say,Prefers not to say,Person prefers not to say,Not known,Person prefers not to say,Person prefers not to say,,,,,,,,,,,,,,,,,Yes – the person is a current or former regular,No – they left up to and including 5 years ago,Yes,No,Yes,Fully wheelchair accessible housing,Yes,No,No,No,No,No,No,Yes,No,No,Yes,No,No,No,No,No,No,No,Less than 1 year,1 year but under 2 years,Loss of tied accommodation,,Other supported housing,No,Yes,TN23 6LZ,Ashford,Yes,,Yes,,,,No,No,Yes,,Tenant applied directly (no referral or nomination),No,Weekly,268,Universal Credit housing element,Yes,All,,No,Every 2 weeks,,,,200.0,50.0,40.0,35.0,325.0,Yes,12.0,,,,,,,,,,,,,,,,,,,, +,completed,,choreographer@owtluk.com,false,2023-11-26T00:00:00+00:00,,2023-11-26T00:00:00+00:00,single log,2023,MHCLG,MHCLG,General needs,Affordable rent general needs local authority,No,2023-11-26,Affordable Rent,Affordable Rent,,,No,HIJKLMN,ABCDEFG,No,,Address line 1,,London,,NW9 5LL,Barnet,No,Affordable rent basis,Tenant abandoned property,No,2,House,Purpose built,Yes,3,2023-11-24,1,Yes,2023-11-25,Don’t know,Yes,Assured Shorthold Tenancy (AST) – Fixed term,,2,,Yes,4,Yes,35,Female,White,Irish,Tenant prefers not to say,Other,Partner,32,Male,Not seeking work,Prefers not to say,Not known,Prefers not to say,Prefers not to say,Person prefers not to say,Not known,Person prefers not to say,Person prefers not to say,,,,,,,,,,,,,,,,,Yes – the person is a current or former regular,No – they left up to and including 5 years ago,Yes,No,Yes,Fully wheelchair accessible housing,Yes,No,No,No,No,No,No,Yes,No,No,Yes,No,No,No,No,No,No,No,Less than 1 year,1 year but under 2 years,Loss of tied accommodation,,Other supported housing,No,Yes,TN23 6LZ,Ashford,Yes,,Yes,,,,No,No,Yes,,Tenant applied directly (no referral or nomination),No,Weekly,268,Universal Credit housing element,Yes,All,,No,Every 2 weeks,,,,200.0,50.0,40.0,35.0,325.0,Yes,12.0,,,,,,,,,,,,,,,,,,,, diff --git a/spec/fixtures/files/lettings_log_csv_export_non_support_labels_24.csv b/spec/fixtures/files/lettings_log_csv_export_non_support_labels_24.csv index e66b19f0b..785e55577 100644 --- a/spec/fixtures/files/lettings_log_csv_export_non_support_labels_24.csv +++ b/spec/fixtures/files/lettings_log_csv_export_non_support_labels_24.csv @@ -1,2 +1,2 @@ id,status,duplicate_set_id,assigned_to,is_dpo,created_at,updated_by,updated_at,creation_method,collection_start_year,bulk_upload_id,owning_organisation_name,managing_organisation_name,needstype,lettype,renewal,startdate,renttype,renttype_detail,irproduct,irproduct_other,lar,tenancycode,propcode,declaration,uprn_known,uprn,address_line1,address_line2,town_or_city,county,postcode_full,la_label,first_time_property_let_as_social_housing,unitletas,rsnvac,newprop,unittype_gn,builtype,wchair,beds,voiddate,vacdays,majorrepairs,mrcdate,joint,startertenancy,tenancy,tenancyother,tenancylength,sheltered,hhmemb,refused,age1,sex1,ethnic_group,ethnic,nationality_all,ecstat1,relat2,age2,sex2,ecstat2,relat3,age3,sex3,ecstat3,relat4,age4,sex4,ecstat4,relat5,age5,sex5,ecstat5,relat6,age6,sex6,ecstat6,relat7,age7,sex7,ecstat7,relat8,age8,sex8,ecstat8,armedforces,leftreg,reservist,preg_occ,housingneeds,housingneeds_type,housingneeds_a,housingneeds_b,housingneeds_c,housingneeds_f,housingneeds_g,housingneeds_h,housingneeds_other,illness,illness_type_4,illness_type_5,illness_type_2,illness_type_6,illness_type_7,illness_type_3,illness_type_9,illness_type_8,illness_type_1,illness_type_10,layear,waityear,reason,reasonother,prevten,homeless,ppcodenk,ppostcode_full,prevloc_label,reasonpref,rp_homeless,rp_insan_unsat,rp_medwel,rp_hardship,rp_dontknow,cbl,cap,chr,accessible_register,letting_allocation_none,referral,incref,incfreq,earnings,hb,has_benefits,benefits,household_charge,nocharge,period,is_carehome,chcharge,wchchrg,brent,scharge,pscharge,supcharg,tcharge,hbrentshortfall,tshortfall,scheme_code,scheme_service_name,scheme_confidential,SCHTYPE,scheme_registered_under_care_act,scheme_owning_organisation_name,scheme_primary_client_group,scheme_has_other_client_group,scheme_secondary_client_group,scheme_support_type,scheme_intended_stay,scheme_created_at,location_code,location_postcode,location_name,location_units,location_type_of_unit,location_mobility_type,location_local_authority,location_startdate -,in_progress,,choreographer@owtluk.com,false,2024-04-01T00:00:00+01:00,,2024-04-01T00:00:00+01:00,single log,2024,,DLUHC,DLUHC,General needs,Affordable rent general needs local authority,No,2024-04-01,Affordable Rent,Affordable Rent,,,No,HIJKLMN,ABCDEFG,Yes,No,,Address line 1,,London,,NW9 5LL,Barnet,No,Affordable rent basis,Tenant abandoned property,No,House,Purpose built,Yes,3,2024-03-30,1,Yes,2024-03-31,Don’t know,Yes,Assured Shorthold Tenancy (AST) – Fixed term,,2,,4,Yes,35,Female,White,Irish,Australia,Other,Partner,32,Male,Not seeking work,Prefers not to say,Not known,Prefers not to say,Prefers not to say,Person prefers not to say,Not known,Person prefers not to say,Person prefers not to say,,,,,,,,,,,,,,,,,Yes – the person is a current or former regular,No – they left up to and including 5 years ago,Yes,No,Yes,Fully wheelchair accessible housing,Yes,No,No,No,No,No,No,Yes,No,No,Yes,No,No,No,No,No,No,No,Less than 1 year,1 year but under 2 years,Loss of tied accommodation,,Other supported housing,No,Yes,TN23 6LZ,Ashford,Yes,,Yes,,,,No,No,Yes,No,,Tenant applied directly (no referral or nomination),No,Weekly,268,Universal Credit housing element,Yes,All,,No,Every 2 weeks,,,,200.0,50.0,40.0,35.0,325.0,Yes,12.0,,,,,,,,,,,,,,,,,,,, +,in_progress,,choreographer@owtluk.com,false,2024-04-01T00:00:00+01:00,,2024-04-01T00:00:00+01:00,single log,2024,,MHCLG,MHCLG,General needs,Affordable rent general needs local authority,No,2024-04-01,Affordable Rent,Affordable Rent,,,No,HIJKLMN,ABCDEFG,Yes,No,,Address line 1,,London,,NW9 5LL,Barnet,No,Affordable rent basis,Tenant abandoned property,No,House,Purpose built,Yes,3,2024-03-30,1,Yes,2024-03-31,Don’t know,Yes,Assured Shorthold Tenancy (AST) – Fixed term,,2,,4,Yes,35,Female,White,Irish,Australia,Other,Partner,32,Male,Not seeking work,Prefers not to say,Not known,Prefers not to say,Prefers not to say,Person prefers not to say,Not known,Person prefers not to say,Person prefers not to say,,,,,,,,,,,,,,,,,Yes – the person is a current or former regular,No – they left up to and including 5 years ago,Yes,No,Yes,Fully wheelchair accessible housing,Yes,No,No,No,No,No,No,Yes,No,No,Yes,No,No,No,No,No,No,No,Less than 1 year,1 year but under 2 years,Loss of tied accommodation,,Other supported housing,No,Yes,TN23 6LZ,Ashford,Yes,,Yes,,,,No,No,Yes,No,,Tenant applied directly (no referral or nomination),No,Weekly,268,Universal Credit housing element,Yes,All,,No,Every 2 weeks,,,,200.0,50.0,40.0,35.0,325.0,Yes,12.0,,,,,,,,,,,,,,,,,,,, diff --git a/spec/fixtures/files/original_schemes.csv b/spec/fixtures/files/original_schemes.csv index e482a1acf..f28bbedbb 100644 --- a/spec/fixtures/files/original_schemes.csv +++ b/spec/fixtures/files/original_schemes.csv @@ -1,6 +1,6 @@ scheme_code,scheme_service_name,scheme_status,scheme_confidential,scheme_type,scheme_registered_under_care_act,scheme_owning_organisation_name,scheme_support_services_provided_by,scheme_primary_client_group,scheme_has_other_client_group,scheme_secondary_client_group,scheme_support_type,scheme_intended_stay,scheme_created_at,scheme_active_dates -{id1},Test name,active,Yes,Housing for older people,Yes – registered care home providing nursing care,DLUHC,The same organisation that owns the housing stock,People with alcohol problems,Yes,Older people with support needs,High level,Medium stay,2021-04-01T00:00:00+01:00,"Active from 1 April 2020" -{id2},Test name,active,Yes,Housing for older people,Yes – registered care home providing nursing care,DLUHC,The same organisation that owns the housing stock,People with alcohol problems,Yes,Older people with support needs,High level,Medium stay,2021-04-01T00:00:00+01:00,"Active from 1 April 2020" -{id3},Test name,active,Yes,Housing for older people,Yes – registered care home providing nursing care,DLUHC,The same organisation that owns the housing stock,People with alcohol problems,Yes,Older people with support needs,High level,Medium stay,2021-04-01T00:00:00+01:00,"Active from 1 April 2020" -{id4},Incomplete scheme,incomplete,Yes,Housing for older people,Yes – registered care home providing nursing care,DLUHC,The same organisation that owns the housing stock,People with alcohol problems,,,,,2021-04-01T00:00:00+01:00,"Active from 1 April 2020" -SWrong_id,Incomplete scheme,incomplete,Yes,Housing for older people,Yes – registered care home providing nursing care,DLUHC,The same organisation that owns the housing stock,People with alcohol problems,,,,,2021-04-01T00:00:00+01:00,"Active from 1 April 2020" +{id1},Test name,active,Yes,Housing for older people,Yes – registered care home providing nursing care,MHCLG,The same organisation that owns the housing stock,People with alcohol problems,Yes,Older people with support needs,High level,Medium stay,2021-04-01T00:00:00+01:00,"Active from 1 April 2020" +{id2},Test name,active,Yes,Housing for older people,Yes – registered care home providing nursing care,MHCLG,The same organisation that owns the housing stock,People with alcohol problems,Yes,Older people with support needs,High level,Medium stay,2021-04-01T00:00:00+01:00,"Active from 1 April 2020" +{id3},Test name,active,Yes,Housing for older people,Yes – registered care home providing nursing care,MHCLG,The same organisation that owns the housing stock,People with alcohol problems,Yes,Older people with support needs,High level,Medium stay,2021-04-01T00:00:00+01:00,"Active from 1 April 2020" +{id4},Incomplete scheme,incomplete,Yes,Housing for older people,Yes – registered care home providing nursing care,MHCLG,The same organisation that owns the housing stock,People with alcohol problems,,,,,2021-04-01T00:00:00+01:00,"Active from 1 April 2020" +SWrong_id,Incomplete scheme,incomplete,Yes,Housing for older people,Yes – registered care home providing nursing care,MHCLG,The same organisation that owns the housing stock,People with alcohol problems,,,,,2021-04-01T00:00:00+01:00,"Active from 1 April 2020" diff --git a/spec/fixtures/files/sales_logs_csv_export_codes_23.csv b/spec/fixtures/files/sales_logs_csv_export_codes_23.csv index 6bc3ae6a4..162debef9 100644 --- a/spec/fixtures/files/sales_logs_csv_export_codes_23.csv +++ b/spec/fixtures/files/sales_logs_csv_export_codes_23.csv @@ -1,2 +1,2 @@ ID,STATUS,DUPLICATESET,CREATEDDATE,UPLOADDATE,FORM,COLLECTIONYEAR,CREATIONMETHOD,DATAPROTECT,OWNINGORGNAME,MANINGORGNAME,CREATEDBY,USERNAME,DAY,MONTH,YEAR,PURCHID,OWNERSHIP,TYPE,OTHTYPE,COMPANY,LIVEINBUYER,JOINT,JOINTMORE,BEDS,PROPTYPE,BUILTYPE,UPRN,UPRNCONFIRMED,ADDRESS1,ADDRESS2,TOWNCITY,COUNTY,PCODE1,PCODE2,LA,LANAME,WCHAIR,NOINT,PRIVACYNOTICE,AGE1,SEX1,ETHNICGROUP1,ETHNIC,NATIONAL,ECSTAT1,LIVEINBUYER1,RELAT2,AGE2,SEX2,ETHNICGROUP2,ETHNIC2,NATIONAL2,ECSTAT2,LIVEINBUYER2,HHTYPE,RELAT3,AGE3,SEX3,ECSTAT3,RELAT4,AGE4,SEX4,ECSTAT4,RELAT5,AGE5,SEX5,ECSTAT5,RELAT6,AGE6,SEX6,ECSTAT6,PREVTEN,PPCODENK,PPOSTC1,PPOSTC2,PREVIOUSLAKNOWN,PREVLOC,PREVLOCNAME,PREGYRHA,PREGOTHER,PREGLA,PREGGHB,PREGBLANK,BUY2LIVING,PREVTEN2,HHREGRES,HHREGRESSTILL,ARMEDFORCESSPOUSE,DISABLED,WHEEL,INC1NK,INCOME1,INC1MORT,INC2NK,INCOME2,INC2MORT,HB,SAVINGSNK,SAVINGS,PREVOWN,PREVSHARED,PROPLEN,STAIRCASE,STAIRBOUGHT,STAIROWNED,STAIRCASETOSALE,RESALE,EXDAY,EXMONTH,EXYEAR,HODAY,HOMONTH,HOYEAR,LANOMAGR,SOCTEN,FROMBEDS,FROMPROP,SOCPREVTEN,VALUE,VALUE_VALUE_CHECK,EQUITY,MORTGAGEUSED,MORTGAGE,MORTGAGELENDER,MORTGAGELENDEROTHER,MORTLEN1,EXTRABOR,DEPOSIT,CASHDIS,MRENT,HASMSCHARGE,MSCHARGE,MSCHARGE_VALUE_CHECK,DISCOUNT,GRANT -,completed,,2023-12-08T00:00:00+00:00,2024-01-01T00:00:00+00:00,,2023,1,false,DLUHC,DLUHC,billyboy@eyeklaud.com,billyboy@eyeklaud.com,8,12,2023,,2,8,,,,1,1,2,1,1,,,Address line 1,,Town or city,,SW1A,1AA,E09000033,Westminster,1,2,1,30,X,17,17,18,1,1,P,35,X,17,,13,1,1,3,C,14,X,,X,-9,X,3,R,-9,R,10,,,,,1,1,,,0,,,1,1,1,1,,3,,1,4,5,1,1,0,10000,1,0,10000,1,4,1,,1,2,10,,,,,,,,,,,,,,,,,110000.0,,,1,20000.0,5,,10,1,80000.0,,,1,100.0,,,10000.0 +,completed,,2023-12-08T00:00:00+00:00,2024-01-01T00:00:00+00:00,,2023,1,false,MHCLG,MHCLG,billyboy@eyeklaud.com,billyboy@eyeklaud.com,8,12,2023,,2,8,,,,1,1,2,1,1,,,Address line 1,,Town or city,,SW1A,1AA,E09000033,Westminster,1,2,1,30,X,17,17,18,1,1,P,35,X,17,,13,1,1,3,C,14,X,,X,-9,X,3,R,-9,R,10,,,,,1,1,,,0,,,1,1,1,1,,3,,1,4,5,1,1,0,10000,1,0,10000,1,4,1,,1,2,10,,,,,,,,,,,,,,,,,110000.0,,,1,20000.0,5,,10,1,80000.0,,,1,100.0,,,10000.0 diff --git a/spec/fixtures/files/sales_logs_csv_export_codes_24.csv b/spec/fixtures/files/sales_logs_csv_export_codes_24.csv index f1d8644a5..397b44b17 100644 --- a/spec/fixtures/files/sales_logs_csv_export_codes_24.csv +++ b/spec/fixtures/files/sales_logs_csv_export_codes_24.csv @@ -1,2 +1,2 @@ ID,STATUS,DUPLICATESET,CREATEDDATE,UPLOADDATE,COLLECTIONYEAR,CREATIONMETHOD,BULKUPLOADID,DATAPROTECT,OWNINGORGNAME,MANINGORGNAME,CREATEDBY,USERNAME,DAY,MONTH,YEAR,PURCHID,OWNERSHIP,TYPE,OTHTYPE,COMPANY,LIVEINBUYER,JOINT,JOINTMORE,NOINT,PRIVACYNOTICE,UPRN,ADDRESS1,ADDRESS2,TOWNCITY,COUNTY,POSTCODE,ISLAINFERRED,LANAME,LA,UPRNSELECTED,ADDRESS_SEARCH_VALUE_CHECK,ADDRESS1INPUT,POSTCODEINPUT,BULKADDRESS1,BULKADDRESS2,BULKTOWNCITY,BULKCOUNTY,BULKPOSTCODE,BULKLA,BEDS,PROPTYPE,BUILTYPE,WCHAIR,AGE1,SEX1,ETHNICGROUP1,ETHNIC,NATIONALITYALL1,ECSTAT1,LIVEINBUYER1,RELAT2,AGE2,SEX2,ETHNICGROUP2,ETHNIC2,NATIONALITYALL2,ECSTAT2,LIVEINBUYER2,HHTYPE,RELAT3,AGE3,SEX3,ECSTAT3,RELAT4,AGE4,SEX4,ECSTAT4,RELAT5,AGE5,SEX5,ECSTAT5,RELAT6,AGE6,SEX6,ECSTAT6,PREVTEN,PPCODENK,PPOSTC1,PPOSTC2,PREVIOUSLAKNOWN,PREVLOC,PREVLOCNAME,PREGYRHA,PREGOTHER,PREGLA,PREGGHB,PREGBLANK,BUY2LIVING,PREVTEN2,HHREGRES,HHREGRESSTILL,ARMEDFORCESSPOUSE,DISABLED,WHEEL,INC1NK,INCOME1,INC1MORT,INC2NK,INCOME2,INC2MORT,HB,SAVINGSNK,SAVINGS,PREVOWN,PREVSHARED,PROPLEN,STAIRCASE,STAIRBOUGHT,STAIROWNED,STAIRCASETOSALE,RESALE,EXDAY,EXMONTH,EXYEAR,HODAY,HOMONTH,HOYEAR,LANOMAGR,SOCTEN,FROMBEDS,FROMPROP,SOCPREVTEN,VALUE,VALUE_VALUE_CHECK,EQUITY,MORTGAGEUSED,MORTGAGE,MORTGAGELENDER,MORTGAGELENDEROTHER,MORTLEN1,EXTRABOR,DEPOSIT,CASHDIS,MRENT,HASMSCHARGE,MSCHARGE,MSCHARGE_VALUE_CHECK,DISCOUNT,GRANT -,completed,,2024-05-01T00:00:00+01:00,2024-05-01T00:00:00+01:00,2024,1,,false,DLUHC,DLUHC,billyboy@eyeklaud.com,billyboy@eyeklaud.com,1,5,2024,,2,8,,,,1,1,2,1,1,"1, Test Street",,Test Town,,AA1 1AA,true,Westminster,E09000033,,,Address line 1,SW1A 1AA,address line 1 as entered,address line 2 as entered,town or city as entered,county as entered,AB1 2CD,la as entered,2,1,1,1,30,X,17,17,826,1,1,P,35,X,17,,826,1,1,3,C,14,X,9,X,-9,X,3,R,-9,R,10,,,,,1,0,SW1A,1AA,1,E09000033,Westminster,1,1,1,1,,3,,1,4,5,1,1,0,10000,1,0,10000,1,4,1,,1,2,10,,,,,,,,,,,,,,,,,110000.0,,,1,20000.0,5,,10,1,80000.0,,,1,100.0,,,10000.0 +,completed,,2024-05-01T00:00:00+01:00,2024-05-01T00:00:00+01:00,2024,1,,false,MHCLG,MHCLG,billyboy@eyeklaud.com,billyboy@eyeklaud.com,1,5,2024,,2,8,,,,1,1,2,1,1,"1, Test Street",,Test Town,,AA1 1AA,true,Westminster,E09000033,,,Address line 1,SW1A 1AA,address line 1 as entered,address line 2 as entered,town or city as entered,county as entered,AB1 2CD,la as entered,2,1,1,1,30,X,17,17,826,1,1,P,35,X,17,,826,1,1,3,C,14,X,9,X,-9,X,3,R,-9,R,10,,,,,1,0,SW1A,1AA,1,E09000033,Westminster,1,1,1,1,,3,,1,4,5,1,1,0,10000,1,0,10000,1,4,1,,1,2,10,,,,,,,,,,,,,,,,,110000.0,,,1,20000.0,5,,10,1,80000.0,,,1,100.0,,,10000.0 diff --git a/spec/fixtures/files/sales_logs_csv_export_labels_23.csv b/spec/fixtures/files/sales_logs_csv_export_labels_23.csv index bd3736deb..0f62016dc 100644 --- a/spec/fixtures/files/sales_logs_csv_export_labels_23.csv +++ b/spec/fixtures/files/sales_logs_csv_export_labels_23.csv @@ -1,2 +1,2 @@ ID,STATUS,DUPLICATESET,CREATEDDATE,UPLOADDATE,FORM,COLLECTIONYEAR,CREATIONMETHOD,DATAPROTECT,OWNINGORGNAME,MANINGORGNAME,CREATEDBY,USERNAME,DAY,MONTH,YEAR,PURCHID,OWNERSHIP,TYPE,OTHTYPE,COMPANY,LIVEINBUYER,JOINT,JOINTMORE,BEDS,PROPTYPE,BUILTYPE,UPRN,UPRNCONFIRMED,ADDRESS1,ADDRESS2,TOWNCITY,COUNTY,PCODE1,PCODE2,LA,LANAME,WCHAIR,NOINT,PRIVACYNOTICE,AGE1,SEX1,ETHNICGROUP1,ETHNIC,NATIONAL,ECSTAT1,LIVEINBUYER1,RELAT2,AGE2,SEX2,ETHNICGROUP2,ETHNIC2,NATIONAL2,ECSTAT2,LIVEINBUYER2,HHTYPE,RELAT3,AGE3,SEX3,ECSTAT3,RELAT4,AGE4,SEX4,ECSTAT4,RELAT5,AGE5,SEX5,ECSTAT5,RELAT6,AGE6,SEX6,ECSTAT6,PREVTEN,PPCODENK,PPOSTC1,PPOSTC2,PREVIOUSLAKNOWN,PREVLOC,PREVLOCNAME,PREGYRHA,PREGOTHER,PREGLA,PREGGHB,PREGBLANK,BUY2LIVING,PREVTEN2,HHREGRES,HHREGRESSTILL,ARMEDFORCESSPOUSE,DISABLED,WHEEL,INC1NK,INCOME1,INC1MORT,INC2NK,INCOME2,INC2MORT,HB,SAVINGSNK,SAVINGS,PREVOWN,PREVSHARED,PROPLEN,STAIRCASE,STAIRBOUGHT,STAIROWNED,STAIRCASETOSALE,RESALE,EXDAY,EXMONTH,EXYEAR,HODAY,HOMONTH,HOYEAR,LANOMAGR,SOCTEN,FROMBEDS,FROMPROP,SOCPREVTEN,VALUE,VALUE_VALUE_CHECK,EQUITY,MORTGAGEUSED,MORTGAGE,MORTGAGELENDER,MORTGAGELENDEROTHER,MORTLEN1,EXTRABOR,DEPOSIT,CASHDIS,MRENT,HASMSCHARGE,MSCHARGE,MSCHARGE_VALUE_CHECK,DISCOUNT,GRANT -,completed,,2023-12-08T00:00:00+00:00,2024-01-01T00:00:00+00:00,,2023,single log,false,DLUHC,DLUHC,billyboy@eyeklaud.com,billyboy@eyeklaud.com,8,12,2023,,Yes - a discounted ownership scheme,Right to Acquire (RTA),,,,Yes,Yes,2,Flat or maisonette,Purpose built,,,Address line 1,,Town or city,,SW1A,1AA,E09000033,Westminster,Yes,Yes,1,30,Non-binary,Buyer prefers not to say,17,United Kingdom,Full-time - 30 hours or more,Yes,Partner,35,Non-binary,Buyer prefers not to say,,Buyer prefers not to say,Full-time - 30 hours or more,Yes,3,Child,14,Non-binary,,Other,Not known,Non-binary,In government training into work,Prefers not to say,Not known,Prefers not to say,Prefers not to say,,,,,Local authority tenant,No,,,No,,,1,1,1,1,,Don't know,,Yes,Yes,No,Yes,Yes,Yes,10000,Yes,Yes,10000,Yes,Don’t know ,No,,Yes,No,10,,,,,,,,,,,,,,,,,110000.0,,,Yes,20000.0,Cambridge Building Society,,10,Yes,80000.0,,,Yes,100.0,,,10000.0 +,completed,,2023-12-08T00:00:00+00:00,2024-01-01T00:00:00+00:00,,2023,single log,false,MHCLG,MHCLG,billyboy@eyeklaud.com,billyboy@eyeklaud.com,8,12,2023,,Yes - a discounted ownership scheme,Right to Acquire (RTA),,,,Yes,Yes,2,Flat or maisonette,Purpose built,,,Address line 1,,Town or city,,SW1A,1AA,E09000033,Westminster,Yes,Yes,1,30,Non-binary,Buyer prefers not to say,17,United Kingdom,Full-time - 30 hours or more,Yes,Partner,35,Non-binary,Buyer prefers not to say,,Buyer prefers not to say,Full-time - 30 hours or more,Yes,3,Child,14,Non-binary,,Other,Not known,Non-binary,In government training into work,Prefers not to say,Not known,Prefers not to say,Prefers not to say,,,,,Local authority tenant,No,,,No,,,1,1,1,1,,Don't know,,Yes,Yes,No,Yes,Yes,Yes,10000,Yes,Yes,10000,Yes,Don’t know ,No,,Yes,No,10,,,,,,,,,,,,,,,,,110000.0,,,Yes,20000.0,Cambridge Building Society,,10,Yes,80000.0,,,Yes,100.0,,,10000.0 diff --git a/spec/fixtures/files/sales_logs_csv_export_labels_24.csv b/spec/fixtures/files/sales_logs_csv_export_labels_24.csv index 07c84e8e1..9c4daf5a6 100644 --- a/spec/fixtures/files/sales_logs_csv_export_labels_24.csv +++ b/spec/fixtures/files/sales_logs_csv_export_labels_24.csv @@ -1,2 +1,2 @@ ID,STATUS,DUPLICATESET,CREATEDDATE,UPLOADDATE,COLLECTIONYEAR,CREATIONMETHOD,BULKUPLOADID,DATAPROTECT,OWNINGORGNAME,MANINGORGNAME,CREATEDBY,USERNAME,DAY,MONTH,YEAR,PURCHID,OWNERSHIP,TYPE,OTHTYPE,COMPANY,LIVEINBUYER,JOINT,JOINTMORE,NOINT,PRIVACYNOTICE,UPRN,ADDRESS1,ADDRESS2,TOWNCITY,COUNTY,POSTCODE,ISLAINFERRED,LANAME,LA,UPRNSELECTED,ADDRESS_SEARCH_VALUE_CHECK,ADDRESS1INPUT,POSTCODEINPUT,BULKADDRESS1,BULKADDRESS2,BULKTOWNCITY,BULKCOUNTY,BULKPOSTCODE,BULKLA,BEDS,PROPTYPE,BUILTYPE,WCHAIR,AGE1,SEX1,ETHNICGROUP1,ETHNIC,NATIONALITYALL1,ECSTAT1,LIVEINBUYER1,RELAT2,AGE2,SEX2,ETHNICGROUP2,ETHNIC2,NATIONALITYALL2,ECSTAT2,LIVEINBUYER2,HHTYPE,RELAT3,AGE3,SEX3,ECSTAT3,RELAT4,AGE4,SEX4,ECSTAT4,RELAT5,AGE5,SEX5,ECSTAT5,RELAT6,AGE6,SEX6,ECSTAT6,PREVTEN,PPCODENK,PPOSTC1,PPOSTC2,PREVIOUSLAKNOWN,PREVLOC,PREVLOCNAME,PREGYRHA,PREGOTHER,PREGLA,PREGGHB,PREGBLANK,BUY2LIVING,PREVTEN2,HHREGRES,HHREGRESSTILL,ARMEDFORCESSPOUSE,DISABLED,WHEEL,INC1NK,INCOME1,INC1MORT,INC2NK,INCOME2,INC2MORT,HB,SAVINGSNK,SAVINGS,PREVOWN,PREVSHARED,PROPLEN,STAIRCASE,STAIRBOUGHT,STAIROWNED,STAIRCASETOSALE,RESALE,EXDAY,EXMONTH,EXYEAR,HODAY,HOMONTH,HOYEAR,LANOMAGR,SOCTEN,FROMBEDS,FROMPROP,SOCPREVTEN,VALUE,VALUE_VALUE_CHECK,EQUITY,MORTGAGEUSED,MORTGAGE,MORTGAGELENDER,MORTGAGELENDEROTHER,MORTLEN1,EXTRABOR,DEPOSIT,CASHDIS,MRENT,HASMSCHARGE,MSCHARGE,MSCHARGE_VALUE_CHECK,DISCOUNT,GRANT -,completed,,2024-05-01T00:00:00+01:00,2024-05-01T00:00:00+01:00,2024,single log,,false,DLUHC,DLUHC,billyboy@eyeklaud.com,billyboy@eyeklaud.com,1,5,2024,,Yes - a discounted ownership scheme,Right to Acquire (RTA),,,,Yes,Yes,Yes,1,1,"1, Test Street",,Test Town,,AA1 1AA,Yes,Westminster,E09000033,,,Address line 1,SW1A 1AA,address line 1 as entered,address line 2 as entered,town or city as entered,county as entered,AB1 2CD,la as entered,2,Flat or maisonette,Purpose built,Yes,30,Non-binary,Buyer prefers not to say,17,United Kingdom,Full-time - 30 hours or more,Yes,Partner,35,Non-binary,Buyer prefers not to say,,United Kingdom,Full-time - 30 hours or more,Yes,3,Child,14,Non-binary,Child under 16,Other,Not known,Non-binary,In government training into work,Prefers not to say,Not known,Prefers not to say,Prefers not to say,,,,,Local authority tenant,Yes,AA1,1AA,Yes,E09000033,Westminster,1,1,1,1,,Don't know,,Yes,Yes,No,Yes,Yes,Yes,10000,Yes,Yes,10000,Yes,Don’t know ,No,,Yes,No,10,,,,,,,,,,,,,,,,,110000.0,,,Yes,20000.0,Cambridge Building Society,,10,Yes,80000.0,,,Yes,100.0,,,10000.0 +,completed,,2024-05-01T00:00:00+01:00,2024-05-01T00:00:00+01:00,2024,single log,,false,MHCLG,MHCLG,billyboy@eyeklaud.com,billyboy@eyeklaud.com,1,5,2024,,Yes - a discounted ownership scheme,Right to Acquire (RTA),,,,Yes,Yes,Yes,1,1,"1, Test Street",,Test Town,,AA1 1AA,Yes,Westminster,E09000033,,,Address line 1,SW1A 1AA,address line 1 as entered,address line 2 as entered,town or city as entered,county as entered,AB1 2CD,la as entered,2,Flat or maisonette,Purpose built,Yes,30,Non-binary,Buyer prefers not to say,17,United Kingdom,Full-time - 30 hours or more,Yes,Partner,35,Non-binary,Buyer prefers not to say,,United Kingdom,Full-time - 30 hours or more,Yes,3,Child,14,Non-binary,Child under 16,Other,Not known,Non-binary,In government training into work,Prefers not to say,Not known,Prefers not to say,Prefers not to say,,,,,Local authority tenant,Yes,AA1,1AA,Yes,E09000033,Westminster,1,1,1,1,,Don't know,,Yes,Yes,No,Yes,Yes,Yes,10000,Yes,Yes,10000,Yes,Don’t know ,No,,Yes,No,10,,,,,,,,,,,,,,,,,110000.0,,,Yes,20000.0,Cambridge Building Society,,10,Yes,80000.0,,,Yes,100.0,,,10000.0 diff --git a/spec/fixtures/files/sales_logs_csv_export_non_support_labels_24.csv b/spec/fixtures/files/sales_logs_csv_export_non_support_labels_24.csv index e6d1189ba..02f2b664c 100644 --- a/spec/fixtures/files/sales_logs_csv_export_non_support_labels_24.csv +++ b/spec/fixtures/files/sales_logs_csv_export_non_support_labels_24.csv @@ -1,2 +1,2 @@ id,status,duplicate_set_id,created_at,updated_at,collection_start_year,creation_method,bulk_upload_id,is_dpo,owning_organisation_name,managing_organisation_name,assigned_to,day,month,year,purchid,ownershipsch,type,othtype,companybuy,buylivein,jointpur,jointmore,noint,privacynotice,uprn,uprn_confirmed,address_line1_input,postcode_full_input,uprn_selection,address_line1,address_line2,town_or_city,county,pcode1,pcode2,la,la_label,beds,proptype,builtype,wchair,age1,sex1,ethnic_group,ethnic,nationality_all,ecstat1,buy1livein,relat2,age2,sex2,ethnic_group2,ethnicbuy2,nationality_all_buyer2,ecstat2,buy2livein,hholdcount,relat3,age3,sex3,ecstat3,relat4,age4,sex4,ecstat4,relat5,age5,sex5,ecstat5,relat6,age6,sex6,ecstat6,prevten,ppcodenk,ppostc1,ppostc2,previous_la_known,prevloc,prevloc_label,pregyrha,pregother,pregla,pregghb,pregblank,buy2living,prevtenbuy2,hhregres,hhregresstill,armedforcesspouse,disabled,wheel,income1nk,income1,inc1mort,income2nk,income2,inc2mort,hb,savingsnk,savings,prevown,prevshared,proplen,staircase,stairbought,stairowned,staircasesale,resale,exday,exmonth,exyear,hoday,homonth,hoyear,lanomagr,soctenant,frombeds,fromprop,socprevten,value,equity,mortgageused,mortgage,mortgagelender,mortgagelenderother,mortlen,extrabor,deposit,cashdis,mrent,has_mscharge,mscharge,discount,grant -,completed,,2024-05-01T00:00:00+01:00,2024-05-01T00:00:00+01:00,2024,single log,,false,DLUHC,DLUHC,billyboy@eyeklaud.com,1,5,2024,,Yes - a discounted ownership scheme,Right to Acquire (RTA),,,,Yes,Yes,Yes,1,1,Yes,Address line 1,SW1A 1AA,,"1, Test Street",,Test Town,,AA1,1AA,E09000033,Westminster,2,Flat or maisonette,Purpose built,Yes,30,Non-binary,Buyer prefers not to say,17,United Kingdom,Full-time - 30 hours or more,Yes,Partner,35,Non-binary,Buyer prefers not to say,,United Kingdom,Full-time - 30 hours or more,Yes,3,Child,14,Non-binary,Child under 16,Other,Not known,Non-binary,In government training into work,Prefers not to say,Not known,Prefers not to say,Prefers not to say,,,,,Local authority tenant,Yes,AA1,1AA,Yes,E09000033,Westminster,1,1,1,1,,Don't know,,Yes,Yes,No,Yes,Yes,Yes,10000,Yes,Yes,10000,Yes,Don’t know ,No,,Yes,No,10,,,,,,,,,,,,,,,,,110000.0,,Yes,20000.0,Cambridge Building Society,,10,Yes,80000.0,,,Yes,100.0,,10000.0 +,completed,,2024-05-01T00:00:00+01:00,2024-05-01T00:00:00+01:00,2024,single log,,false,MHCLG,MHCLG,billyboy@eyeklaud.com,1,5,2024,,Yes - a discounted ownership scheme,Right to Acquire (RTA),,,,Yes,Yes,Yes,1,1,Yes,Address line 1,SW1A 1AA,,"1, Test Street",,Test Town,,AA1,1AA,E09000033,Westminster,2,Flat or maisonette,Purpose built,Yes,30,Non-binary,Buyer prefers not to say,17,United Kingdom,Full-time - 30 hours or more,Yes,Partner,35,Non-binary,Buyer prefers not to say,,United Kingdom,Full-time - 30 hours or more,Yes,3,Child,14,Non-binary,Child under 16,Other,Not known,Non-binary,In government training into work,Prefers not to say,Not known,Prefers not to say,Prefers not to say,,,,,Local authority tenant,Yes,AA1,1AA,Yes,E09000033,Westminster,1,1,1,1,,Don't know,,Yes,Yes,No,Yes,Yes,Yes,10000,Yes,Yes,10000,Yes,Don’t know ,No,,Yes,No,10,,,,,,,,,,,,,,,,,110000.0,,Yes,20000.0,Cambridge Building Society,,10,Yes,80000.0,,,Yes,100.0,,10000.0 diff --git a/spec/fixtures/files/schemes_and_locations_csv_export.csv b/spec/fixtures/files/schemes_and_locations_csv_export.csv index 020c8c5ab..79c9132f6 100644 --- a/spec/fixtures/files/schemes_and_locations_csv_export.csv +++ b/spec/fixtures/files/schemes_and_locations_csv_export.csv @@ -1,2 +1,2 @@ scheme_code,scheme_service_name,scheme_status,scheme_confidential,scheme_type,scheme_registered_under_care_act,scheme_owning_organisation_name,scheme_support_services_provided_by,scheme_primary_client_group,scheme_has_other_client_group,scheme_secondary_client_group,scheme_support_type,scheme_intended_stay,scheme_created_at,scheme_active_dates,location_code,location_postcode,location_name,location_status,location_local_authority,location_units,location_type_of_unit,location_mobility_type,location_active_dates -,Test name,active,Yes,Housing for older people,No,DLUHC,The same organisation that owns the housing stock,People with alcohol problems,Yes,Older people with support needs,High level,Medium stay,2021-04-01T00:00:00+01:00,"Active from 1 April 2020 to 31 March 2022, Deactivated on 1 April 2022, Active from 1 April 2023",,SW1A 2AA,Downing Street,deactivating_soon,Westminster,20,Self-contained house,Fitted with equipment and adaptations,"Active from 1 April 2022 to 25 December 2023, Deactivated on 26 December 2023" +,Test name,active,Yes,Housing for older people,No,MHCLG,The same organisation that owns the housing stock,People with alcohol problems,Yes,Older people with support needs,High level,Medium stay,2021-04-01T00:00:00+01:00,"Active from 1 April 2020 to 31 March 2022, Deactivated on 1 April 2022, Active from 1 April 2023",,SW1A 2AA,Downing Street,deactivating_soon,Westminster,20,Self-contained house,Fitted with equipment and adaptations,"Active from 1 April 2022 to 25 December 2023, Deactivated on 26 December 2023" diff --git a/spec/fixtures/files/schemes_csv_export.csv b/spec/fixtures/files/schemes_csv_export.csv index d2225b799..93825de2c 100644 --- a/spec/fixtures/files/schemes_csv_export.csv +++ b/spec/fixtures/files/schemes_csv_export.csv @@ -1,2 +1,2 @@ scheme_code,scheme_service_name,scheme_status,scheme_confidential,scheme_type,scheme_registered_under_care_act,scheme_owning_organisation_name,scheme_support_services_provided_by,scheme_primary_client_group,scheme_has_other_client_group,scheme_secondary_client_group,scheme_support_type,scheme_intended_stay,scheme_created_at,scheme_active_dates -,Test name,active,Yes,Housing for older people,No,DLUHC,The same organisation that owns the housing stock,People with alcohol problems,Yes,Older people with support needs,High level,Medium stay,2021-04-01T00:00:00+01:00,"Active from 1 April 2020 to 31 March 2022, Deactivated on 1 April 2022, Active from 1 April 2023" +,Test name,active,Yes,Housing for older people,No,MHCLG,The same organisation that owns the housing stock,People with alcohol problems,Yes,Older people with support needs,High level,Medium stay,2021-04-01T00:00:00+01:00,"Active from 1 April 2020 to 31 March 2022, Deactivated on 1 April 2022, Active from 1 April 2023" diff --git a/spec/fixtures/files/updated_schemes.csv b/spec/fixtures/files/updated_schemes.csv index 2fa9cef63..5f4631a02 100644 --- a/spec/fixtures/files/updated_schemes.csv +++ b/spec/fixtures/files/updated_schemes.csv @@ -1,6 +1,6 @@ scheme_code,scheme_service_name,scheme_status,scheme_confidential,scheme_type,scheme_registered_under_care_act,scheme_owning_organisation_name,scheme_support_services_provided_by,scheme_primary_client_group,scheme_has_other_client_group,scheme_secondary_client_group,scheme_support_type,scheme_intended_stay,scheme_created_at,scheme_active_dates {id1},Updated test name,incomplete,No,Direct Access Hostel,No,Different organisation,Another registered stock owner,People with drug problems,No,Older people with support needs,Low level,Permanent,2022-04-01T00:00:00+01:00,"Active from 2 April 2020" -{id2},Test name,active,Yes,Housing for older people,Yes – registered care home providing nursing care,DLUHC,The same organisation that owns the housing stock,People with alcohol problems,Yes,Older people with support needs,High level,Medium stay,2021-04-01T00:00:00+01:00,"Active from 1 April 2020" +{id2},Test name,active,Yes,Housing for older people,Yes – registered care home providing nursing care,MHCLG,The same organisation that owns the housing stock,People with alcohol problems,Yes,Older people with support needs,High level,Medium stay,2021-04-01T00:00:00+01:00,"Active from 1 April 2020" {id3}, ,active,Yse,Direct access Hostel,Yes – registered care home providing nursing care,non existing org,wrong answer,FD,no,lder people with support needs,high,Permanent ,2021-04-01T00:00:00+01:00,"Active from 1 April 2020" -Wrong_id,Incomplete scheme,incomplete,Yes,Housing for older people,No,DLUHC,The same organisation that owns the housing stock,People with alcohol problems,,,,,2021-04-01T00:00:00+01:00,"Active from 1 April 2020" -SWrong_id,Incomplete scheme,incomplete,Yes,Housing for older people,No,DLUHC,The same organisation that owns the housing stock,People with alcohol problems,,,,,2021-04-01T00:00:00+01:00,"Active from 1 April 2020" +Wrong_id,Incomplete scheme,incomplete,Yes,Housing for older people,No,MHCLG,The same organisation that owns the housing stock,People with alcohol problems,,,,,2021-04-01T00:00:00+01:00,"Active from 1 April 2020" +SWrong_id,Incomplete scheme,incomplete,Yes,Housing for older people,No,MHCLG,The same organisation that owns the housing stock,People with alcohol problems,,,,,2021-04-01T00:00:00+01:00,"Active from 1 April 2020" diff --git a/spec/fixtures/forms/2021_2022.json b/spec/fixtures/forms/2021_2022.json index 9f4195223..2667dff4b 100644 --- a/spec/fixtures/forms/2021_2022.json +++ b/spec/fixtures/forms/2021_2022.json @@ -1216,7 +1216,7 @@ "type": "checkbox", "answer_options": { "declaration": { - "value": "The tenant has seen the Department for Levelling Up, Housing & Communities (DLUHC) privacy notice" + "value": "The tenant has seen the Ministry of Housing, Communities and Local Government (MHCLG) privacy notice" } } } diff --git a/spec/helpers/tab_nav_helper_spec.rb b/spec/helpers/tab_nav_helper_spec.rb index 173a58b54..4a2d13377 100644 --- a/spec/helpers/tab_nav_helper_spec.rb +++ b/spec/helpers/tab_nav_helper_spec.rb @@ -15,7 +15,7 @@ RSpec.describe TabNavHelper do describe "#org_cell" do it "returns the users org name and role separated by a newline character" do - expected_html = "DLUHC\nData provider" + expected_html = "MHCLG\nData provider" expect(org_cell(current_user)).to match(expected_html) end end diff --git a/spec/models/form/lettings/questions/declaration_spec.rb b/spec/models/form/lettings/questions/declaration_spec.rb index 7b90a964e..ab9bcebef 100644 --- a/spec/models/form/lettings/questions/declaration_spec.rb +++ b/spec/models/form/lettings/questions/declaration_spec.rb @@ -50,7 +50,7 @@ RSpec.describe Form::Lettings::Questions::Declaration, type: :model do it "has the correct answer_options" do expect(question.answer_options).to eq({ - "declaration" => { "value" => "The tenant has seen the DLUHC privacy notice" }, + "declaration" => { "value" => "The tenant has seen the MHCLG privacy notice" }, }) end @@ -63,7 +63,7 @@ RSpec.describe Form::Lettings::Questions::Declaration, type: :model do end it "returns correct unanswered_error_message" do - expect(question.unanswered_error_message).to eq("You must show the DLUHC privacy notice to the tenant before you can submit this log.") + expect(question.unanswered_error_message).to eq("You must show the MHCLG privacy notice to the tenant before you can submit this log.") end end @@ -74,7 +74,7 @@ RSpec.describe Form::Lettings::Questions::Declaration, type: :model do it "has the correct answer_options" do expect(question.answer_options).to eq({ - "declaration" => { "value" => "The tenant has seen or been given access to the DLUHC privacy notice" }, + "declaration" => { "value" => "The tenant has seen or been given access to the MHCLG privacy notice" }, }) end @@ -87,7 +87,7 @@ RSpec.describe Form::Lettings::Questions::Declaration, type: :model do end it "returns correct unanswered_error_message" do - expect(question.unanswered_error_message).to eq("You must show or give access to the DLUHC privacy notice to the tenant before you can submit this log.") + expect(question.unanswered_error_message).to eq("You must show or give access to the MHCLG privacy notice to the tenant before you can submit this log.") end end end diff --git a/spec/models/form/sales/pages/privacy_notice_spec.rb b/spec/models/form/sales/pages/privacy_notice_spec.rb index db560407d..fc34d42de 100644 --- a/spec/models/form/sales/pages/privacy_notice_spec.rb +++ b/spec/models/form/sales/pages/privacy_notice_spec.rb @@ -26,7 +26,7 @@ RSpec.describe Form::Sales::Pages::PrivacyNotice, type: :model do end it "has the correct header" do - expect(page.header).to eq("Department for Levelling Up, Housing and Communities privacy notice") + expect(page.header).to eq("Ministry of Housing, Communities and Local Government privacy notice") end it "has the correct description" do diff --git a/spec/models/form/sales/questions/privacy_notice_spec.rb b/spec/models/form/sales/questions/privacy_notice_spec.rb index 263623ea9..4be918c5c 100644 --- a/spec/models/form/sales/questions/privacy_notice_spec.rb +++ b/spec/models/form/sales/questions/privacy_notice_spec.rb @@ -51,7 +51,7 @@ RSpec.describe Form::Sales::Questions::PrivacyNotice, type: :model do context "and there is a single buyer" do it "has the correct answer_options" do expect(question.answer_options).to eq({ - "privacynotice" => { "value" => "The buyer has seen the DLUHC privacy notice" }, + "privacynotice" => { "value" => "The buyer has seen the MHCLG privacy notice" }, }) end @@ -60,7 +60,7 @@ RSpec.describe Form::Sales::Questions::PrivacyNotice, type: :model do end it "returns correct unanswered_error_message" do - expect(question.unanswered_error_message).to eq("You must show the DLUHC privacy notice to the buyer before you can submit this log.") + expect(question.unanswered_error_message).to eq("You must show the MHCLG privacy notice to the buyer before you can submit this log.") end end @@ -69,7 +69,7 @@ RSpec.describe Form::Sales::Questions::PrivacyNotice, type: :model do it "has the correct answer_options" do expect(question.answer_options).to eq({ - "privacynotice" => { "value" => "The buyers have seen the DLUHC privacy notice" }, + "privacynotice" => { "value" => "The buyers have seen the MHCLG privacy notice" }, }) end @@ -78,7 +78,7 @@ RSpec.describe Form::Sales::Questions::PrivacyNotice, type: :model do end it "returns correct unanswered_error_message" do - expect(question.unanswered_error_message).to eq("You must show the DLUHC privacy notice to the buyers before you can submit this log.") + expect(question.unanswered_error_message).to eq("You must show the MHCLG privacy notice to the buyers before you can submit this log.") end end end @@ -91,7 +91,7 @@ RSpec.describe Form::Sales::Questions::PrivacyNotice, type: :model do context "and there is a single buyer" do it "has the correct answer_options" do expect(question.answer_options).to eq({ - "privacynotice" => { "value" => "The buyer has seen or been given access to the DLUHC privacy notice" }, + "privacynotice" => { "value" => "The buyer has seen or been given access to the MHCLG privacy notice" }, }) end @@ -100,7 +100,7 @@ RSpec.describe Form::Sales::Questions::PrivacyNotice, type: :model do end it "returns correct unanswered_error_message" do - expect(question.unanswered_error_message).to eq("You must show or give access to the DLUHC privacy notice to the buyer before you can submit this log.") + expect(question.unanswered_error_message).to eq("You must show or give access to the MHCLG privacy notice to the buyer before you can submit this log.") end end @@ -109,7 +109,7 @@ RSpec.describe Form::Sales::Questions::PrivacyNotice, type: :model do it "has the correct answer_options" do expect(question.answer_options).to eq({ - "privacynotice" => { "value" => "The buyers have seen or been given access to the DLUHC privacy notice" }, + "privacynotice" => { "value" => "The buyers have seen or been given access to the MHCLG privacy notice" }, }) end @@ -118,7 +118,7 @@ RSpec.describe Form::Sales::Questions::PrivacyNotice, type: :model do end it "returns correct unanswered_error_message" do - expect(question.unanswered_error_message).to eq("You must show or give access to the DLUHC privacy notice to the buyers before you can submit this log.") + expect(question.unanswered_error_message).to eq("You must show or give access to the MHCLG privacy notice to the buyers before you can submit this log.") end end end diff --git a/spec/models/organisation_spec.rb b/spec/models/organisation_spec.rb index 3964923f0..2cd3351d5 100644 --- a/spec/models/organisation_spec.rb +++ b/spec/models/organisation_spec.rb @@ -20,8 +20,8 @@ RSpec.describe Organisation, type: :model do end context "with parent/child associations", :aggregate_failures do - let!(:child_organisation) { create(:organisation, name: "DLUHC Child") } - let!(:grandchild_organisation) { create(:organisation, name: "DLUHC Grandchild") } + let!(:child_organisation) { create(:organisation, name: "MHCLG Child") } + let!(:grandchild_organisation) { create(:organisation, name: "MHCLG Grandchild") } before do create( @@ -49,8 +49,8 @@ RSpec.describe Organisation, type: :model do end context "with owning association", :aggregate_failures do - let!(:child_organisation) { create(:organisation, name: "DLUHC Child") } - let!(:grandchild_organisation) { create(:organisation, name: "DLUHC Grandchild") } + let!(:child_organisation) { create(:organisation, name: "MHCLG Child") } + let!(:grandchild_organisation) { create(:organisation, name: "MHCLG Grandchild") } before do create( @@ -73,8 +73,8 @@ RSpec.describe Organisation, type: :model do end context "with managing association", :aggregate_failures do - let!(:child_organisation) { create(:organisation, name: "DLUHC Child") } - let!(:grandchild_organisation) { create(:organisation, name: "DLUHC Grandchild") } + let!(:child_organisation) { create(:organisation, name: "MHCLG Child") } + let!(:grandchild_organisation) { create(:organisation, name: "MHCLG Grandchild") } before do create( @@ -208,7 +208,7 @@ RSpec.describe Organisation, type: :model do it "allows lettings logs to be restored to a previous version" do organisation.update!(name: "new test name") - expect(organisation.paper_trail.previous_version.name).to eq("DLUHC") + expect(organisation.paper_trail.previous_version.name).to eq("MHCLG") end end diff --git a/spec/requests/organisations_controller_spec.rb b/spec/requests/organisations_controller_spec.rb index 4b6cefe5f..13879a38c 100644 --- a/spec/requests/organisations_controller_spec.rb +++ b/spec/requests/organisations_controller_spec.rb @@ -1513,7 +1513,7 @@ RSpec.describe OrganisationsController, type: :request do end context "when search results require pagination" do - let(:search_param) { "DLUHC" } + let(:search_param) { "MHCLG" } it "has search and pagination in the title" do expect(page).to have_title("Organisations (27 organisations matching ‘#{search_param}’) (page 1 of 2) - Submit social housing lettings and sales data (CORE) - GOV.UK") 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 a75d928ac..6d0801293 100644 --- a/spec/services/bulk_upload/lettings/year2023/row_parser_spec.rb +++ b/spec/services/bulk_upload/lettings/year2023/row_parser_spec.rb @@ -694,7 +694,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do let(:attributes) { valid_attributes.merge({ field_45: nil }) } it "cannot be nulled" do - expect(parser.errors[:field_45]).to eq(["You must show the DLUHC privacy notice to the tenant before you can submit this log."]) + expect(parser.errors[:field_45]).to eq(["You must show the MHCLG privacy notice to the tenant before you can submit this log."]) end end end diff --git a/spec/views/organisations/data_sharing_agreement.html.erb_spec.rb b/spec/views/organisations/data_sharing_agreement.html.erb_spec.rb index 8bcb29c9d..a2c7a5dd1 100644 --- a/spec/views/organisations/data_sharing_agreement.html.erb_spec.rb +++ b/spec/views/organisations/data_sharing_agreement.html.erb_spec.rb @@ -28,7 +28,7 @@ RSpec.describe "organisations/data_sharing_agreement.html.erb", :aggregate_failu # org details expect(fragment).to have_content("#{organisation.name} of #{organisation.address_row} (“CORE Data Provider”)") # header - expect(fragment).to have_css("h2", text: "#{organisation.name} and Department for Levelling Up, Housing and Communities") + expect(fragment).to have_css("h2", text: "#{organisation.name} and Ministry of Housing, Communities and Local Government") # action buttons expect(fragment).to have_button(text: "Accept this agreement") expect(fragment).to have_link(text: "Cancel", href: "/organisations/#{organisation.id}/details") @@ -56,7 +56,7 @@ RSpec.describe "organisations/data_sharing_agreement.html.erb", :aggregate_failu # org details expect(fragment).to have_content("#{organisation.name} of #{organisation.address_row} (“CORE Data Provider”)") # header - expect(fragment).to have_css("h2", text: "#{organisation.name} and Department for Levelling Up, Housing and Communities") + expect(fragment).to have_css("h2", text: "#{organisation.name} and Ministry of Housing, Communities and Local Government") # does not show action buttons expect(fragment).not_to have_button(text: "Accept this agreement") expect(fragment).not_to have_link(text: "Cancel", href: "/organisations/#{organisation.id}/details") @@ -99,7 +99,7 @@ RSpec.describe "organisations/data_sharing_agreement.html.erb", :aggregate_failu # org details expect(fragment).to have_content("#{organisation.name} of #{organisation.address_row} (“CORE Data Provider”)") # header - expect(fragment).to have_css("h2", text: "#{organisation.name} and Department for Levelling Up, Housing and Communities") + expect(fragment).to have_css("h2", text: "#{organisation.name} and Ministry of Housing, Communities and Local Government") # does not show action buttons expect(fragment).not_to have_button(text: "Accept this agreement") expect(fragment).not_to have_link(text: "Cancel", href: "/organisations/#{organisation.id}/details") @@ -124,7 +124,7 @@ RSpec.describe "organisations/data_sharing_agreement.html.erb", :aggregate_failu # org details expect(fragment).to have_content("#{organisation.name} of #{organisation.address_row} (“CORE Data Provider”)") # header - expect(fragment).to have_css("h2", text: "#{organisation.name} and Department for Levelling Up, Housing and Communities") + expect(fragment).to have_css("h2", text: "#{organisation.name} and Ministry of Housing, Communities and Local Government") # does not show action buttons expect(fragment).not_to have_button(text: "Accept this agreement") expect(fragment).not_to have_link(text: "Cancel", href: "/organisations/#{organisation.id}/details") @@ -152,7 +152,7 @@ RSpec.describe "organisations/data_sharing_agreement.html.erb", :aggregate_failu # org details expect(fragment).to have_content("#{organisation.name} of #{organisation.address_row} (“CORE Data Provider”)") # header - expect(fragment).to have_css("h2", text: "#{organisation.name} and Department for Levelling Up, Housing and Communities") + expect(fragment).to have_css("h2", text: "#{organisation.name} and Ministry of Housing, Communities and Local Government") # does not show action buttons expect(fragment).not_to have_button(text: "Accept this agreement") expect(fragment).not_to have_link(text: "Cancel", href: "/organisations/#{organisation.id}/details") From 201ce23906297eab10708aac21e1d288fde12dfc Mon Sep 17 00:00:00 2001 From: kosiakkatrina <54268893+kosiakkatrina@users.noreply.github.com> Date: Thu, 25 Jul 2024 11:39:10 +0100 Subject: [PATCH 6/9] CLDC-1718 Update numeric questions to text fields (#2527) * Update numeric questions to text fields * Add test case --- app/models/validations/shared_validations.rb | 10 ++++++ app/views/form/_numeric_question.html.erb | 4 ++- config/locales/en.yml | 1 + .../validations/shared_validations_spec.rb | 32 +++++++++++++++++++ 4 files changed, 46 insertions(+), 1 deletion(-) diff --git a/app/models/validations/shared_validations.rb b/app/models/validations/shared_validations.rb index 79fc95158..f3b0a9c34 100644 --- a/app/models/validations/shared_validations.rb +++ b/app/models/validations/shared_validations.rb @@ -16,6 +16,16 @@ module Validations::SharedValidations end end + def validate_numeric_input(record) + record.form.numeric_questions.each do |question| + next unless record[question.id] && question.page.routed_to?(record, nil) + next if record.send("#{question.id}_before_type_cast").to_s.match?(/\A\d+(\.\d+)?\z/) + + field = question.check_answer_label || question.id + record.errors.add question.id.to_sym, I18n.t("validations.numeric.format", field:) + end + end + def validate_numeric_min_max(record) record.form.numeric_questions.each do |question| next unless question.min || question.max diff --git a/app/views/form/_numeric_question.html.erb b/app/views/form/_numeric_question.html.erb index aafa68d93..aa147767b 100644 --- a/app/views/form/_numeric_question.html.erb +++ b/app/views/form/_numeric_question.html.erb @@ -1,6 +1,6 @@ <%= render partial: "form/guidance/#{question.top_guidance_partial}" if question.top_guidance? %> -<%= f.govuk_number_field( +<%= f.govuk_text_field( question.id.to_sym, caption: caption(caption_text, page_header, conditional), label: legend(question, page_header, conditional), @@ -13,6 +13,8 @@ prefix_text: question.prefix.to_s, suffix_text: question.suffix_label(@log), value: format_money_input(log: @log, question:), + inputmode: "numeric", + pattern: "\d*\.?\d*", **stimulus_html_attributes(question), ) %> diff --git a/config/locales/en.yml b/config/locales/en.yml index 51ddfdc36..35e2fcd96 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -231,6 +231,7 @@ en: nearest_ten: "%{field} must be given to the nearest ten" nearest_hundredth: "%{field} must be given to the nearest hundredth" normal_format: "Enter a number" + format: "%{field} must be a number" date: invalid_date: "Enter a date in the correct format, for example 31 1 2022" diff --git a/spec/models/validations/shared_validations_spec.rb b/spec/models/validations/shared_validations_spec.rb index 97cb621cb..fb389d175 100644 --- a/spec/models/validations/shared_validations_spec.rb +++ b/spec/models/validations/shared_validations_spec.rb @@ -215,4 +215,36 @@ RSpec.describe Validations::SharedValidations do end end end + + describe "validate numeric question input" do + it "does not allow letters" do + sales_log.income1 = "abc" + shared_validator.validate_numeric_input(sales_log) + expect(sales_log.errors[:income1]).to include I18n.t("validations.numeric.format", field: "Buyer 1’s gross annual income") + end + + it "does not allow special characters" do + sales_log.income1 = "3%5" + shared_validator.validate_numeric_input(sales_log) + expect(sales_log.errors[:income1]).to include I18n.t("validations.numeric.format", field: "Buyer 1’s gross annual income") + end + + it "allows a digit" do + sales_log.income1 = "300" + shared_validator.validate_numeric_input(sales_log) + expect(sales_log.errors[:income1]).to be_empty + end + + it "allows a decimal point" do + sales_log.income1 = "300.78" + shared_validator.validate_numeric_input(sales_log) + expect(sales_log.errors[:income1]).to be_empty + end + + it "does not allow decimal point in a wrong format" do + sales_log.income1 = "300.09.78" + shared_validator.validate_numeric_input(sales_log) + expect(sales_log.errors[:income1]).to include I18n.t("validations.numeric.format", field: "Buyer 1’s gross annual income") + end + end end From 0f4bc32d6ea325a1be4c30d0f3726f708d846cf9 Mon Sep 17 00:00:00 2001 From: kosiakkatrina <54268893+kosiakkatrina@users.noreply.github.com> Date: Thu, 25 Jul 2024 12:04:04 +0100 Subject: [PATCH 7/9] CLDC-3465 Update hard validations flow (#2472) * Add check your errors page with clear links * Update answer links * Link to check your errors page * Refactor check errors page * Allow clearing answers * Update styling and lint * Add routing for sales * lint * Update page routing test * Remove unused code * CLDC-3465 Handle additional errors (#2480) * Keep check errors query params * Add success banner * Update confirm and continue button * CLDC-3465 Allow clearing all error questions (#2483) * Allow clearing all error questions * Update setup question link * Update clear all to ignore setup questions * Update correct_validation_action_href * Extract some vriables * CLDC-3465 Do not display non persisted values in check errors page (#2484) * Do not display non persisted values on check_errors page * Remove govuk button styling from link * Update warning message * Update copy --- ...swers_summary_list_card_component.html.erb | 4 +- ...eck_answers_summary_list_card_component.rb | 13 +- app/controllers/check_errors_controller.rb | 37 ++ app/controllers/form_controller.rb | 64 ++- app/frontend/styles/_button.scss | 8 + app/helpers/check_errors_helper.rb | 11 + app/helpers/form_page_error_helper.rb | 4 + app/models/form/question.rb | 6 +- .../confirm_clear_all_answers.html.erb | 32 ++ .../confirm_clear_answer.html.erb | 31 ++ app/views/form/check_errors.html.erb | 66 +++ app/views/form/page.html.erb | 12 + config/routes.rb | 4 + spec/features/form/page_routing_spec.rb | 27 ++ spec/requests/check_errors_controller_spec.rb | 455 ++++++++++++++++++ 15 files changed, 766 insertions(+), 8 deletions(-) create mode 100644 app/controllers/check_errors_controller.rb create mode 100644 app/helpers/check_errors_helper.rb create mode 100644 app/views/check_errors/confirm_clear_all_answers.html.erb create mode 100644 app/views/check_errors/confirm_clear_answer.html.erb create mode 100644 app/views/form/check_errors.html.erb create mode 100644 spec/requests/check_errors_controller_spec.rb diff --git a/app/components/check_answers_summary_list_card_component.html.erb b/app/components/check_answers_summary_list_card_component.html.erb index 4a26b8c8d..4c1f9aa2d 100644 --- a/app/components/check_answers_summary_list_card_component.html.erb +++ b/app/components/check_answers_summary_list_card_component.html.erb @@ -35,8 +35,8 @@ <% if @log.collection_period_open_for_editing? %> <% row.with_action( - text: question.action_text(log), - href: action_href(question, log), + text: question.action_text(log, correcting_hard_validation: @correcting_hard_validation), + href: correct_validation_action_href(question, log, applicable_questions.map(&:id), @correcting_hard_validation), visually_hidden_text: question.check_answer_label.to_s.downcase, ) %> <% end %> diff --git a/app/components/check_answers_summary_list_card_component.rb b/app/components/check_answers_summary_list_card_component.rb index 205a8516e..5242c7f41 100644 --- a/app/components/check_answers_summary_list_card_component.rb +++ b/app/components/check_answers_summary_list_card_component.rb @@ -1,10 +1,11 @@ class CheckAnswersSummaryListCardComponent < ViewComponent::Base attr_reader :questions, :log, :user - def initialize(questions:, log:, user:) + def initialize(questions:, log:, user:, correcting_hard_validation: false) @questions = questions @log = log @user = user + @correcting_hard_validation = correcting_hard_validation super end @@ -33,6 +34,16 @@ class CheckAnswersSummaryListCardComponent < ViewComponent::Base send("#{log.model_name.param_key}_#{question.page.id}_path", log, referrer:) end + def correct_validation_action_href(question, log, _related_question_ids, correcting_hard_validation) + return action_href(question, log) unless correcting_hard_validation + + if question.displayed_as_answered?(log) + send("#{log.model_name.param_key}_confirm_clear_answer_path", log, question_id: question.id) + else + send("#{log.model_name.param_key}_#{question.page.id}_path", log, referrer: "check_errors", related_question_ids: request.query_parameters["related_question_ids"], original_page_id: request.query_parameters["original_page_id"]) + end + end + private def unanswered_value(question) diff --git a/app/controllers/check_errors_controller.rb b/app/controllers/check_errors_controller.rb new file mode 100644 index 000000000..f246e0b01 --- /dev/null +++ b/app/controllers/check_errors_controller.rb @@ -0,0 +1,37 @@ +class CheckErrorsController < ApplicationController + include DuplicateLogsHelper + + before_action :authenticate_user! + before_action :find_resource_by_named_id + + def confirm_clear_answer + return render_not_found unless @log + + @related_question_ids = params[@log.model_name.param_key].keys.reject { |id| id == "page_id" } + @page = @log.form.get_page(params[@log.model_name.param_key]["page_id"]) + + if params["clear_all"] + @questions_to_clear = @related_question_ids.map { |id| + question = @log.form.get_question(id, @log) + next if question.subsection.id == "setup" + + question.page.questions.map(&:id) + }.flatten.compact + + render :confirm_clear_all_answers + else + question_id = @related_question_ids.find { |id| !params[id].nil? } + @question = @log.form.get_question(question_id, @log) + end + end + +private + + def find_resource_by_named_id + @log = if params[:sales_log_id].present? + current_user.sales_logs.visible.find_by(id: params[:sales_log_id]) + else + current_user.lettings_logs.visible.find_by(id: params[:lettings_log_id]) + end + end +end diff --git a/app/controllers/form_controller.rb b/app/controllers/form_controller.rb index a8d8fca48..d84f8642a 100644 --- a/app/controllers/form_controller.rb +++ b/app/controllers/form_controller.rb @@ -9,6 +9,8 @@ class FormController < ApplicationController def submit_form if @log @page = form.get_page(params[@log.model_name.param_key][:page]) + return render_check_errors_page if params["check_errors"] + shown_page_ids_with_unanswered_questions_before_update = @page.subsection.pages .select { |page| page.routed_to?(@log, current_user) } .select { |page| page.has_unanswered_questions?(@log) } @@ -30,7 +32,8 @@ class FormController < ApplicationController mandatory_questions_with_no_response.map do |question| @log.errors.add question.id.to_sym, question.unanswered_error_message, category: :not_answered end - Rails.logger.info "User triggered validation(s) on: #{@log.errors.map(&:attribute).join(', ')}" + error_attributes = @log.errors.map(&:attribute) + Rails.logger.info "User triggered validation(s) on: #{error_attributes.join(', ')}" @subsection = form.subsection_for_page(@page) restore_error_field_values(@page&.questions) render "form/page" @@ -64,12 +67,23 @@ class FormController < ApplicationController @interruption_page_referrer_type = from_referrer_query("referrer") end + if adding_answer_from_check_errors_page? + @related_question_ids = request.params["related_question_ids"] + @original_page_id = request.params["original_page_id"] + @check_errors = true + end + if @log page_id = request.path.split("/")[-1].underscore @page = form.get_page(page_id) @subsection = form.subsection_for_page(@page) - if @page.routed_to?(@log, current_user) || is_referrer_type?("interruption_screen") - render "form/page" + if @page.routed_to?(@log, current_user) || is_referrer_type?("interruption_screen") || adding_answer_from_check_errors_page? + if updated_answer_from_check_errors_page? + @questions = request.params["related_question_ids"].map { |id| @log.form.get_question(id, @log) } + render "form/check_errors" + else + render "form/page" + end else redirect_to @log.lettings? ? lettings_log_path(@log) : sales_log_path(@log) end @@ -213,6 +227,20 @@ private return send("#{@log.class.name.underscore}_#{previous_interruption_screen_page_id}_path", @log, { referrer: previous_interruption_screen_referrer, original_log_id: original_duplicate_log_id_from_query }.compact) end + if params[@log.model_name.param_key]["check_errors"] + @page = form.get_page(params[@log.model_name.param_key]["page"]) + flash[:notice] = "You have successfully updated #{@page.questions.map(&:check_answer_label).to_sentence}" + original_page_id = params[@log.model_name.param_key]["original_page_id"] + related_question_ids = params[@log.model_name.param_key]["related_question_ids"].split(" ") + return send("#{@log.class.name.underscore}_#{original_page_id}_path", @log, { check_errors: true, related_question_ids: }.compact) + end + + if params["referrer"] == "check_errors" + @page = form.get_page(params[@log.model_name.param_key]["page"]) + flash[:notice] = "You have successfully updated #{@page.questions.map(&:check_answer_label).to_sentence}" + return send("#{@log.class.name.underscore}_#{params['original_page_id']}_path", @log, { check_errors: true, related_question_ids: params["related_question_ids"] }.compact) + end + is_new_answer_from_check_answers = is_referrer_type?("check_answers_new_answer") redirect_path = form.next_page_redirect_path(@page, @log, current_user, ignore_answered: is_new_answer_from_check_answers) referrer = is_new_answer_from_check_answers ? "check_answers_new_answer" : nil @@ -374,4 +402,34 @@ private true end + + def render_check_errors_page + if params[@log.model_name.param_key]["clear_question_ids"].present? + question_ids = params[@log.model_name.param_key]["clear_question_ids"].split(" ") + question_ids.each do |question_id| + question = @log.form.get_question(question_id, @log) + next if question.subsection.id == "setup" + + question.page.questions.map(&:id).each { |id| @log[id] = nil } + end + @log.save! + @questions = params[@log.model_name.param_key].keys.reject { |id| %w[clear_question_ids page].include?(id) }.map { |id| @log.form.get_question(id, @log) } + else + responses_for_page = responses_for_page(@page) + @log.assign_attributes(responses_for_page) + @log.valid? + @log.reload + error_attributes = @log.errors.map(&:attribute) + @questions = @log.form.questions.select { |q| error_attributes.include?(q.id.to_sym) } + end + render "form/check_errors" + end + + def adding_answer_from_check_errors_page? + request.params["referrer"] == "check_errors" + end + + def updated_answer_from_check_errors_page? + params["check_errors"] + end end diff --git a/app/frontend/styles/_button.scss b/app/frontend/styles/_button.scss index 5975da0cb..4cd815b5b 100644 --- a/app/frontend/styles/_button.scss +++ b/app/frontend/styles/_button.scss @@ -29,3 +29,11 @@ $app-button-inverse-hover-background-colour: govuk-tint($app-button-inverse-fore background-color: $app-button-inverse-hover-background-colour; box-shadow: inset 0 0 0 2px $govuk-focus-colour; } + +.submit-button-link { + background: none; + border: none; + color: #1d70b8; + text-decoration: underline; + cursor: pointer; +} diff --git a/app/helpers/check_errors_helper.rb b/app/helpers/check_errors_helper.rb new file mode 100644 index 000000000..6d1ff0166 --- /dev/null +++ b/app/helpers/check_errors_helper.rb @@ -0,0 +1,11 @@ +module CheckErrorsHelper + include GovukLinkHelper + + def check_errors_answer_text(question, log) + question.displayed_as_answered?(log) ? "Change" : "Answer" + end + + def check_errors_answer_link(log, question, page, applicable_questions) + send("#{log.model_name.param_key}_#{question.page.id}_path", log, referrer: "check_errors", original_page_id: page.id, related_question_ids: applicable_questions.map(&:id)) + end +end diff --git a/app/helpers/form_page_error_helper.rb b/app/helpers/form_page_error_helper.rb index 4bfda9eee..8a46accca 100644 --- a/app/helpers/form_page_error_helper.rb +++ b/app/helpers/form_page_error_helper.rb @@ -3,4 +3,8 @@ module FormPageErrorHelper other_page_error_ids = lettings_log.errors.map(&:attribute) - page.questions.map { |q| q.id.to_sym }.concat([:base]) other_page_error_ids.each { |id| lettings_log.errors.delete(id) } end + + def all_questions_affected_by_errors(log) + log.errors.map(&:attribute) - [:base] + end end diff --git a/app/models/form/question.rb b/app/models/form/question.rb index a692574dd..960af8909 100644 --- a/app/models/form/question.rb +++ b/app/models/form/question.rb @@ -111,8 +111,10 @@ class Form::Question end end - def action_text(log) - displayed_as_answered?(log) ? "Change" : "Answer" + def action_text(log, correcting_hard_validation: false) + return "Answer" unless displayed_as_answered?(log) + + correcting_hard_validation ? "Clear" : "Change" end def displayed_as_answered?(log) diff --git a/app/views/check_errors/confirm_clear_all_answers.html.erb b/app/views/check_errors/confirm_clear_all_answers.html.erb new file mode 100644 index 000000000..85e936aef --- /dev/null +++ b/app/views/check_errors/confirm_clear_all_answers.html.erb @@ -0,0 +1,32 @@ +<% content_for :before_content do %> + <% content_for :title, "Are you sure you want to clear all?" %> +<% end %> + +
      +
      +

      + <%= content_for(:title) %> +

      +

      You've selected <%= @questions_to_clear.count %> answers to clear

      + + <%= govuk_warning_text(text: "Dependent answers related to this question may also get cleared. You will not be able to undo this action") %> + <%= form_with model: @log, url: send("#{@log.model_name.param_key}_#{@page.id}_path", @log), method: "post", local: true do |f| %> + + <% @related_question_ids.each do |id| %> + <%= f.hidden_field id, value: @log[id] %> + <% end %> + + <%= f.hidden_field :clear_question_ids, value: @questions_to_clear %> + <%= f.hidden_field :page, value: @page.id %> + +
      + <%= f.govuk_submit "Confirm and continue", name: "check_errors" %> + <%= govuk_button_link_to( + "Cancel", + "javascript:history.back()", + secondary: true, + ) %> +
      + <% end %> +
      +
      diff --git a/app/views/check_errors/confirm_clear_answer.html.erb b/app/views/check_errors/confirm_clear_answer.html.erb new file mode 100644 index 000000000..9dba77fae --- /dev/null +++ b/app/views/check_errors/confirm_clear_answer.html.erb @@ -0,0 +1,31 @@ +<% content_for :before_content do %> + <% content_for :title, "Are you sure you want to clear #{@question.check_answer_label}?" %> +<% end %> + +
      +
      +

      + <%= content_for(:title) %> +

      + + <%= govuk_warning_text(text: "Dependent answers related to this question may also get cleared. You will not be able to undo this action.") %> + <%= form_with model: @log, url: send("#{@log.model_name.param_key}_#{@page.id}_path", @log), method: "post", local: true do |f| %> + + <% @related_question_ids.each do |id| %> + <%= f.hidden_field id, value: @log[id] %> + <% end %> + + <%= f.hidden_field :clear_question_ids, value: [@question.id] %> + <%= f.hidden_field :page, value: @page.id %> + +
      + <%= f.govuk_submit "Confirm and continue", name: "check_errors" %> + <%= govuk_button_link_to( + "Cancel", + "javascript:history.back()", + secondary: true, + ) %> +
      + <% end %> +
      +
      diff --git a/app/views/form/check_errors.html.erb b/app/views/form/check_errors.html.erb new file mode 100644 index 000000000..27fa3ea0c --- /dev/null +++ b/app/views/form/check_errors.html.erb @@ -0,0 +1,66 @@ +
      +
      + + <%= form_with model: @log, url: send("#{@log.model_name.param_key}_confirm_clear_answer_path", @log), method: "post", local: true do |f| %> + <%= f.govuk_error_summary %> + <%= f.hidden_field :page_id, value: @page.id %> + +

      +
      + + Make sure these answers are correct: + + + + +
      +

      + +
      +
      + <% applicable_questions = @questions.reject { |q| q.hidden_in_check_answers?(@log, current_user) } %> +
      + <% applicable_questions.each do |question| %> + <%= f.hidden_field question.id, value: @log[question.id] %> +
      +
      + <%= get_question_label(question) %> +
      +
      + <%= simple_format( + get_answer_label(question, @log), + wrapper_tag: "span", + class: "govuk-!-margin-right-4", + ) %> + + <% extra_value = question.get_extra_check_answer_value(@log) %> + + <% if extra_value && question.answer_label(@log).present? %> + <%= simple_format( + extra_value, + wrapper_tag: "span", + class: "govuk-!-font-weight-regular app-!-colour-muted", + ) %> + <% end %> + + <% question.get_inferred_answers(@log).each do |inferred_answer| %> + <%= inferred_answer %> + <% end %> +
      +
      + <% if !question.displayed_as_answered?(@log) || question.subsection.id == "setup" %> + <%= govuk_link_to check_errors_answer_text(question, @log), check_errors_answer_link(@log, question, @page, applicable_questions) %> + <% else %> + + <% end %> +
      +
      + <% end %> +
      +
      +
      + <% end %> + + <%= govuk_button_link_to "Confirm and continue", @original_page_id ? send("#{@log.model_name.param_key}_#{@original_page_id}_path", @log) : send("#{@log.model_name.param_key}_#{@page.id}_path", @log) %> +
      +
      diff --git a/app/views/form/page.html.erb b/app/views/form/page.html.erb index fffc22411..95dc38ec6 100644 --- a/app/views/form/page.html.erb +++ b/app/views/form/page.html.erb @@ -16,6 +16,7 @@ <%= form_with model: @log, url: request.original_url, method: "post", local: true do |f| %>
      + <% all_questions_with_errors = all_questions_affected_by_errors(@log) %> <% remove_other_page_errors(@log, @page) %> <%= f.govuk_error_summary %> @@ -69,6 +70,17 @@ <%= f.hidden_field :page, value: @page.id %> <%= f.hidden_field :interruption_page_id, value: @interruption_page_id %> <%= f.hidden_field :interruption_page_referrer_type, value: @interruption_page_referrer_type %> + <%= f.hidden_field :related_question_ids, value: @related_question_ids %> + <%= f.hidden_field :original_page_id, value: @original_page_id %> + <% if @check_errors %> + <%= f.hidden_field :check_errors, value: @check_errors %> + <% end %> + + <% if all_questions_with_errors.count > 1 %> +
      + <%= f.submit "See all related answers", name: "check_errors", class: "govuk-body govuk-link submit-button-link" %> +
      + <% end %>
      <% if !@page.interruption_screen? %> diff --git a/config/routes.rb b/config/routes.rb index e8932ea45..a6de59a65 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -214,6 +214,8 @@ Rails.application.routes.draw do get "delete-confirmation", to: "lettings_logs#delete_confirmation" get "duplicate-logs", to: "duplicate_logs#show" get "delete-duplicates", to: "duplicate_logs#delete_duplicates" + post "confirm-clear-answer", to: "check_errors#confirm_clear_answer" + post "confirm-clear-all-answers", to: "check_errors#confirm_clear_all_answers" collection do get "csv-download", to: "lettings_logs#download_csv" @@ -284,6 +286,8 @@ Rails.application.routes.draw do get "delete-confirmation", to: "sales_logs#delete_confirmation" get "duplicate-logs", to: "duplicate_logs#show" get "delete-duplicates", to: "duplicate_logs#delete_duplicates" + post "confirm-clear-answer", to: "check_errors#confirm_clear_answer" + post "confirm-clear-all-answers", to: "check_errors#confirm_clear_all_answers" collection do get "csv-download", to: "sales_logs#download_csv" diff --git a/spec/features/form/page_routing_spec.rb b/spec/features/form/page_routing_spec.rb index 8ee63de03..42a2c25fb 100644 --- a/spec/features/form/page_routing_spec.rb +++ b/spec/features/form/page_routing_spec.rb @@ -119,6 +119,16 @@ RSpec.describe "Form Page Routing" do expect(find_field("lettings_log[startdate(2i)]").value).to eq(nil) expect(find_field("lettings_log[startdate(1i)]").value).to eq(nil) end + + it "does not show see all related answers link if only 1 field has an error" do + visit("/lettings-logs/#{id}/tenancy-start-date") + fill_in("lettings_log[startdate(1i)]", with: "202") + fill_in("lettings_log[startdate(2i)]", with: "32") + fill_in("lettings_log[startdate(3i)]", with: "0") + click_button("Save and continue") + + expect(page).not_to have_link("See all related answers") + end end end @@ -262,4 +272,21 @@ RSpec.describe "Form Page Routing" do end end end + + describe "composite validations" do + context "when error is added to multiple fields" do + before do + lettings_log.update(needstype: 1, declaration: 1, ecstat1: 10, hhmemb: 2, net_income_known: 0, incfreq: 1, earnings: 1000) + end + + it "does shows see all related answers link" do + visit("/lettings-logs/#{id}/income-amount") + fill_in("lettings-log-earnings-field", with: "100000") + click_button("Save and continue") + + expect(page).to have_current_path("/lettings-logs/#{id}/income-amount") + expect(page).to have_button("See all related answers") + end + end + end end diff --git a/spec/requests/check_errors_controller_spec.rb b/spec/requests/check_errors_controller_spec.rb new file mode 100644 index 000000000..c101e7959 --- /dev/null +++ b/spec/requests/check_errors_controller_spec.rb @@ -0,0 +1,455 @@ +require "rails_helper" + +RSpec.describe CheckErrorsController, type: :request do + let(:page) { Capybara::Node::Simple.new(response.body) } + let(:user) { create(:user, :data_coordinator) } + let(:lettings_log) { create(:lettings_log, :setup_completed, assigned_to: user) } + let(:sales_log) { create(:sales_log, :shared_ownership_setup_complete, assigned_to: user) } + + describe "check errors page" do + context "when user is not signed in" do + it "redirects to sign in page for lettings" do + post "/lettings-logs/#{lettings_log.id}/net-income", params: {} + expect(response).to redirect_to("/account/sign-in") + end + + it "redirects to sign in page for sales" do + post "/sales-logs/#{sales_log.id}/buyer-1-income", params: {} + expect(response).to redirect_to("/account/sign-in") + end + end + + context "when the user is from different organisation" do + let(:other_user) { create(:user) } + + before do + sign_in other_user + end + + it "renders page not found for lettings" do + post "/lettings-logs/#{lettings_log.id}/net-income", params: {} + expect(response).to have_http_status(:not_found) + end + + it "renders page not found for sales" do + post "/sales-logs/#{sales_log.id}/buyer-1-income", params: {} + expect(response).to have_http_status(:not_found) + end + end + + context "when user is signed in" do + context "with multiple error fields and answered questions for lettings" do + let(:params) do + { + id: lettings_log.id, + lettings_log: { + page: "income_amount", + earnings: "100000", + incfreq: "1", + }, + check_errors: "", + } + end + + before do + lettings_log.update!(needstype: 1, declaration: 1, ecstat1: 10, hhmemb: 2, net_income_known: 0, incfreq: nil, earnings: nil) + sign_in user + post "/lettings-logs/#{lettings_log.id}/income-amount", params: params + end + + it "displays correct clear links" do + expect(page).to have_selector("input[type=submit][value='Clear']", count: 2) + expect(page).to have_button("Clear all") + end + end + + context "with multiple error fields and answered questions for sales" do + let(:params) do + { + id: sales_log.id, + sales_log: { + page: "buyer_1_income", + income1: "100000", + la: "E09000001", + ownershipsch: "1", + }, + check_errors: "", + } + end + + before do + sales_log.update!(income1: 1000, la: "E09000001") + sign_in user + post "/sales-logs/#{sales_log.id}/buyer-1-income", params: params + end + + it "displays correct clear and change links" do + expect(page.all(:button, value: "Clear").count).to eq(2) + expect(page).to have_link("Change", count: 1) + expect(page).to have_button("Clear all") + end + end + end + end + + describe "confirm clear answer page" do + context "when user is not signed in" do + it "redirects to sign in page for lettings" do + post "/lettings-logs/#{lettings_log.id}/confirm-clear-answer", params: {} + expect(response).to redirect_to("/account/sign-in") + end + + it "redirects to sign in page for sales" do + post "/sales-logs/#{sales_log.id}/confirm-clear-answer", params: {} + expect(response).to redirect_to("/account/sign-in") + end + end + + context "when the user is from different organisation" do + let(:other_user) { create(:user) } + + before do + sign_in other_user + end + + it "renders page not found for lettings" do + post "/lettings-logs/#{lettings_log.id}/confirm-clear-answer", params: {} + expect(response).to have_http_status(:not_found) + end + + it "renders page not found for sales" do + post "/sales-logs/#{sales_log.id}/confirm-clear-answer", params: {} + expect(response).to have_http_status(:not_found) + end + end + + context "when user is signed in" do + context "and clearing specific lettings question" do + let(:params) do + { + id: lettings_log.id, + lettings_log: { + earnings: "100000", + incfreq: "1", + hhmemb: "2", + page_id: "income_amount", + }, + hhmemb: "", + } + end + + before do + sign_in user + post "/lettings-logs/#{lettings_log.id}/confirm-clear-answer", params: + end + + it "displays correct clear links" do + expect(page).to have_content("Are you sure you want to clear Number of household members?") + expect(page).to have_content("Dependent answers related to this question may also get cleared. You will not be able to undo this action.") + expect(page).to have_link("Cancel") + expect(page).to have_button("Confirm and continue") + end + end + + context "and clearing specific sales question" do + let(:params) do + { + id: sales_log.id, + sales_log: { + income1: "100000", + la: "E09000001", + ownershipsch: "1", + page_id: "buyer_1_income", + }, + income1: "", + } + end + + before do + sign_in user + post "/sales-logs/#{sales_log.id}/confirm-clear-answer", params: + end + + it "displays correct clear links" do + expect(page).to have_content("Are you sure you want to clear Buyer 1’s gross annual income?") + expect(page).to have_content("Dependent answers related to this question may also get cleared. You will not be able to undo this action.") + expect(page).to have_link("Cancel") + expect(page).to have_button("Confirm and continue") + end + end + end + end + + describe "confirm clear all answers" do + context "when user is signed in" do + context "and clearing all lettings questions" do + let(:params) do + { + id: lettings_log.id, + clear_all: "Clear all", + lettings_log: { + earnings: "100000", + incfreq: "1", + hhmemb: "2", + page_id: "income_amount", + }, + } + end + + before do + sign_in user + post "/lettings-logs/#{lettings_log.id}/confirm-clear-answer", params: + end + + it "displays correct clear links" do + expect(page).to have_content("Are you sure you want to clear all") + expect(page).to have_content("You've selected 5 answers to clear") + expect(page).to have_content("You will not be able to undo this action") + expect(page).to have_link("Cancel") + expect(page).to have_button("Confirm and continue") + end + end + + context "and clearing all sales question" do + let(:params) do + { + id: sales_log.id, + clear_all: "Clear all", + sales_log: { + income1: "100000", + la: "E09000001", + ownershipsch: "1", + page_id: "buyer_1_income", + }, + } + end + + before do + sign_in user + post "/sales-logs/#{sales_log.id}/confirm-clear-answer", params: + end + + it "displays correct clear links" do + expect(page).to have_content("Are you sure you want to clear all") + expect(page).to have_content("You've selected 3 answers to clear") + expect(page).to have_content("You will not be able to undo this action") + expect(page).to have_link("Cancel") + expect(page).to have_button("Confirm and continue") + end + end + end + end + + describe "clear answer" do + context "when user is not signed in" do + it "redirects to sign in page for lettings" do + post "/lettings-logs/#{lettings_log.id}/income-amount", params: {} + expect(response).to redirect_to("/account/sign-in") + end + + it "redirects to sign in page for sales" do + post "/sales-logs/#{sales_log.id}/buyer-1-income", params: {} + expect(response).to redirect_to("/account/sign-in") + end + end + + context "when the user is from different organisation" do + let(:other_user) { create(:user) } + + before do + sign_in other_user + end + + it "renders page not found for lettings" do + post "/lettings-logs/#{lettings_log.id}/income-amount", params: {} + expect(response).to have_http_status(:not_found) + end + + it "renders page not found for sales" do + post "/sales-logs/#{lettings_log.id}/buyer-1-income", params: {} + expect(response).to have_http_status(:not_found) + end + end + + context "when user is signed in" do + context "and clearing specific lettings question" do + let(:params) do + { + id: lettings_log.id, + lettings_log: { + earnings: "100000", + incfreq: "1", + hhmemb: "2", + clear_question_ids: "hhmemb", + page: "income_amount", + }, + check_errors: "", + } + end + + before do + sign_in user + post "/lettings-logs/#{lettings_log.id}/income-amount", params: + end + + it "displays correct clear links" do + expect(page).to have_content("Make sure these answers are correct") + expect(page).to have_content("You didn’t answer this question") + expect(page).to have_link("Answer") + expect(lettings_log.reload.earnings).to eq(nil) + end + end + + context "and clearing specific sales question" do + let(:params) do + { + id: sales_log.id, + sales_log: { + income1: "100000", + la: "E09000001", + ownershipsch: "1", + clear_question_ids: "income1", + page: "buyer_1_income", + }, + check_errors: "", + } + end + + before do + sign_in user + post "/sales-logs/#{sales_log.id}/buyer-1-income", params: + end + + it "displays correct clear links" do + expect(page).to have_content("Make sure these answers are correct") + expect(page).to have_content("You didn’t answer this question") + expect(page).to have_link("Answer") + expect(sales_log.reload.income1).to eq(nil) + end + end + end + end + + describe "answer incomplete question" do + context "when user is signed in" do + context "and answering specific lettings question" do + let(:params) do + { + original_page_id: "household_members", + referrer: "check_errors", + related_question_ids: %w[hhmemb ecstat1 earnings], + lettings_log: { + page: "household_members", + hhmemb: "2", + }, + } + end + + before do + sign_in user + post "/lettings-logs/#{lettings_log.id}/household-members", params: + end + + it "maintains original check_errors data in query params" do + follow_redirect! + expect(request.query_parameters["check_errors"]).to eq("true") + expect(request.query_parameters["related_question_ids"]).to eq(%w[hhmemb ecstat1 earnings]) + expect(page).to have_content("You have successfully updated Number of household members") + expect(page).to have_link("Confirm and continue", href: "/lettings-logs/#{lettings_log.id}/household-members") + end + end + + context "and answering specific sales question" do + let(:params) do + { + original_page_id: "buyer_1_income", + referrer: "check_errors", + related_question_ids: %w[income1 la ownershipsch], + sales_log: { + page: "buyer_1_income", + income1: "1000", + income1nk: "0", + }, + } + end + + before do + sign_in user + post "/sales-logs/#{sales_log.id}/buyer-1-income", params: + end + + it "maintains original check_errors data in query params" do + follow_redirect! + expect(request.query_parameters["check_errors"]).to eq("true") + expect(request.query_parameters["related_question_ids"]).to eq(%w[income1 la ownershipsch]) + expect(page).to have_content("You have successfully updated Buyer 1’s gross annual income known? and Buyer 1’s gross annual income") + expect(page).to have_link("Confirm and continue", href: "/sales-logs/#{sales_log.id}/buyer-1-income") + end + end + end + end + + describe "clear all answers" do + context "when user is signed in" do + context "and clearing all lettings question" do + let(:params) do + { + id: lettings_log.id, + lettings_log: { + earnings: "100000", + incfreq: "1", + hhmemb: "2", + clear_question_ids: "earnings incfreq hhmemb", + page: "income_amount", + }, + check_errors: "", + } + end + + before do + sign_in user + post "/lettings-logs/#{lettings_log.id}/income-amount", params: + end + + it "correctly clears the values" do + expect(page).to have_content("Make sure these answers are correct") + expect(page).to have_content("You didn’t answer this question") + expect(page.all(:button, value: "Clear").count).to eq(0) + expect(lettings_log.reload.earnings).to eq(nil) + expect(lettings_log.reload.incfreq).to eq(nil) + expect(lettings_log.reload.hhmemb).to eq(nil) + end + end + + context "and clearing all sales question" do + let(:params) do + { + id: sales_log.id, + sales_log: { + income1: "100000", + la: "E09000001", + ownershipsch: "1", + clear_question_ids: "income1 la ownershipsch", + page: "buyer_1_income", + }, + check_errors: "", + } + end + + before do + sign_in user + post "/sales-logs/#{sales_log.id}/buyer-1-income", params: + end + + it "displays correct clear links" do + expect(page).to have_content("Make sure these answers are correct") + expect(page).to have_content("You didn’t answer this question") + expect(page.all(:button, value: "Clear").count).to eq(0) + expect(sales_log.reload.income1).to eq(nil) + expect(sales_log.reload.la).to eq(nil) + expect(sales_log.reload.ownershipsch).not_to eq(nil) + end + end + end + end +end From bb270d34c01282093e2ffe2729736071e6056f7f Mon Sep 17 00:00:00 2001 From: kosiakkatrina <54268893+kosiakkatrina@users.noreply.github.com> Date: Thu, 25 Jul 2024 12:24:56 +0100 Subject: [PATCH 8/9] Remove noint_fix_status from the database (#2508) --- db/migrate/20240715082338_remove_noint_fix_status.rb | 5 +++++ db/schema.rb | 3 +-- 2 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 db/migrate/20240715082338_remove_noint_fix_status.rb diff --git a/db/migrate/20240715082338_remove_noint_fix_status.rb b/db/migrate/20240715082338_remove_noint_fix_status.rb new file mode 100644 index 000000000..e6b247361 --- /dev/null +++ b/db/migrate/20240715082338_remove_noint_fix_status.rb @@ -0,0 +1,5 @@ +class RemoveNointFixStatus < ActiveRecord::Migration[7.0] + def change + remove_column :bulk_uploads, :noint_fix_status, :string, default: "not_applied" + end +end diff --git a/db/schema.rb b/db/schema.rb index 8aeca4b3d..50073d2d6 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.0].define(version: 2024_07_15_072421) do +ActiveRecord::Schema[7.0].define(version: 2024_07_15_082338) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -41,7 +41,6 @@ ActiveRecord::Schema[7.0].define(version: 2024_07_15_072421) do t.integer "needstype" t.text "choice" t.integer "total_logs_count" - t.string "noint_fix_status", default: "not_applied" t.string "rent_type_fix_status", default: "not_applied" t.index ["identifier"], name: "index_bulk_uploads_on_identifier", unique: true t.index ["user_id"], name: "index_bulk_uploads_on_user_id" From 975f072d2f7cfc8f07f6034ff9e8c1189e3ce00b Mon Sep 17 00:00:00 2001 From: Rachael Booth Date: Thu, 25 Jul 2024 14:03:59 +0100 Subject: [PATCH 9/9] CLDC-3547: Validate against incomplete schemes being used in logs (#2498) * CLDC-3547: Validate against incomplete schemes being used in logs * Fix ordering issue in tests --- app/models/validations/setup_validations.rb | 4 + config/locales/en.yml | 2 + .../validations/setup_validations_spec.rb | 10 + .../lettings/year2023/row_parser_spec.rb | 178 +++++++++++++++--- 4 files changed, 169 insertions(+), 25 deletions(-) diff --git a/app/models/validations/setup_validations.rb b/app/models/validations/setup_validations.rb index df2a2fc5e..b06217ad5 100644 --- a/app/models/validations/setup_validations.rb +++ b/app/models/validations/setup_validations.rb @@ -90,6 +90,10 @@ module Validations::SetupValidations end def validate_scheme(record) + if record.scheme&.status == :incomplete + record.errors.add :scheme_id, :incomplete, message: I18n.t("validations.setup.scheme.incomplete") + end + scheme_during_startdate_validation(record) end diff --git a/config/locales/en.yml b/config/locales/en.yml index 35e2fcd96..326e92732 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -325,6 +325,8 @@ en: lettype_not_supported_housing: This letting type is general needs, but the needs type is supported housing. Change either the needs type or the letting type. location: incomplete: "This location is incomplete. Select another location or update this one" + scheme: + incomplete: "This scheme is incomplete. Select another scheme or update this one" property: uprn: diff --git a/spec/models/validations/setup_validations_spec.rb b/spec/models/validations/setup_validations_spec.rb index 7fc4dd982..14a9b45ae 100644 --- a/spec/models/validations/setup_validations_spec.rb +++ b/spec/models/validations/setup_validations_spec.rb @@ -511,6 +511,16 @@ RSpec.describe Validations::SetupValidations do expect(record.errors["scheme_id"]).to be_empty end end + + context "with an incomplete scheme" do + let(:scheme) { create(:scheme, :incomplete) } + + it "adds an error to scheme_id" do + record.scheme = scheme + setup_validator.validate_scheme(record) + expect(record.errors["scheme_id"]).to include(I18n.t("validations.setup.scheme.incomplete")) + end + end end describe "#validate_location" do 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 6d0801293..a8cfd0a79 100644 --- a/spec/services/bulk_upload/lettings/year2023/row_parser_spec.rb +++ b/spec/services/bulk_upload/lettings/year2023/row_parser_spec.rb @@ -83,8 +83,6 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do before do stub_request(:get, /api\.postcodes\.io/) .to_return(status: 200, body: "{\"status\":200,\"result\":{\"admin_district\":\"Manchester\", \"codes\":{\"admin_district\": \"E08000003\"}}}", headers: {}) - - parser.valid? end describe "#valid?" do @@ -100,6 +98,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do let(:attributes) { { bulk_upload:, field_134: 2 } } it "does not add keep adding errors to the pile" do + parser.valid? expect { parser.valid? }.not_to change(parser.errors, :count) end end @@ -255,7 +254,6 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do before do parser.log.save! - parser.instance_variable_set(:@valid, nil) end it "is not a valid row" do @@ -293,7 +291,6 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do before do parser.log.save! - parser.instance_variable_set(:@valid, nil) end it "is not a valid row" do @@ -332,7 +329,6 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do before do parser.log.save! - parser.instance_variable_set(:@valid, nil) end it "is not a valid row" do @@ -380,7 +376,6 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do before do parser.log.save! - parser.instance_variable_set(:@valid, nil) end it "is not a valid row" do @@ -440,7 +435,6 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do before do parser.log.save! - parser.instance_variable_set(:@valid, nil) end it "is a valid row" do @@ -476,7 +470,6 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do before do parser.log.save! - parser.instance_variable_set(:@valid, nil) end it "is not a valid row" do @@ -524,7 +517,6 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do before do parser.log.save! - parser.instance_variable_set(:@valid, nil) end it "is not a valid row" do @@ -584,7 +576,6 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do before do parser.log.save! - parser.instance_variable_set(:@valid, nil) end it "is a valid row" do @@ -694,6 +685,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do let(:attributes) { valid_attributes.merge({ field_45: nil }) } it "cannot be nulled" do + parser.valid? expect(parser.errors[:field_45]).to eq(["You must show the MHCLG privacy notice to the tenant before you can submit this log."]) end end @@ -716,8 +708,9 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do let(:attributes) { { bulk_upload:, field_13: "123" } } it "has errors on setup fields" do - errors = parser.errors.select { |e| e.options[:category] == :setup }.map(&:attribute).sort + parser.valid? + errors = parser.errors.select { |e| e.options[:category] == :setup }.map(&:attribute).sort expect(errors).to eql(%i[field_1 field_2 field_4 field_45 field_5 field_6 field_7 field_8 field_9]) end end @@ -727,14 +720,17 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do let(:attributes) { { bulk_upload:, field_3: "", field_4: 1 } } it "is permitted" do + parser.valid? expect(parser.errors[:field_3]).to be_blank end it "sets assigned to to bulk upload user" do + parser.valid? expect(parser.log.assigned_to).to eq(bulk_upload.user) end it "sets created by to bulk upload user" do + parser.valid? expect(parser.log.created_by).to eq(bulk_upload.user) end end @@ -743,6 +739,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do let(:attributes) { { bulk_upload:, field_3: "idonotexist@example.com" } } it "is not permitted" do + parser.valid? expect(parser.errors[:field_3]).to be_present end end @@ -753,10 +750,12 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do let(:attributes) { { bulk_upload:, field_1: owning_org.old_visible_id, field_3: other_user.email, field_2: managing_org.old_visible_id } } it "is not permitted" do + parser.valid? expect(parser.errors[:field_3]).to be_present end it "blocks log creation" do + parser.valid? expect(parser).to be_block_log_creation end end @@ -767,6 +766,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do let(:attributes) { { bulk_upload:, field_1: owning_org.old_visible_id, field_3: other_user.email, field_2: managing_org.old_visible_id } } it "is permitted" do + parser.valid? expect(parser.errors[:field_3]).to be_blank end @@ -785,6 +785,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do let(:attributes) { { bulk_upload:, field_1: owning_org.old_visible_id, field_3: other_user.email.upcase!, field_2: managing_org.old_visible_id } } it "is permitted" do + parser.valid? expect(parser.errors[:field_3]).to be_blank end end @@ -795,6 +796,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do let(:attributes) { { bulk_upload:, field_1: owning_org.old_visible_id, field_3: other_user.email, field_2: managing_org.old_visible_id } } it "is permitted" do + parser.valid? expect(parser.errors[:field_3]).to be_blank end end @@ -805,6 +807,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do let(:attributes) { { bulk_upload:, field_5: nil, field_15: "1" } } it "returns an error" do + parser.valid? expect(parser.errors[:field_5]).to be_present end end @@ -813,6 +816,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do let(:attributes) { { bulk_upload:, field_5: "foo" } } it "returns an error" do + parser.valid? expect(parser.errors[:field_5]).to be_present end end @@ -821,6 +825,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do let(:attributes) { { bulk_upload:, field_5: "101" } } it "returns an error" do + parser.valid? expect(parser.errors[:field_5]).to be_present end end @@ -829,6 +834,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do let(:attributes) { { bulk_upload:, field_5: "1", field_4: "1" } } it "does not return any errors" do + parser.valid? expect(parser.errors[:field_5]).to be_blank end end @@ -837,6 +843,8 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do let(:attributes) { { bulk_upload:, field_5: "9", field_11: nil } } it "adds error on field_11" do + parser.valid? + expect(parser.errors[:field_5]).to be_present expect(parser.errors[:field_11]).to eq(["You must answer intermediate rent type"]) end @@ -846,6 +854,8 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do let(:attributes) { { bulk_upload:, field_5: "9", field_11: "Intermediate rent" } } it "adds error on field_11" do + parser.valid? + expect(parser.errors[:field_5]).to be_present expect(parser.errors[:field_11]).to eq(["You must answer intermediate rent type"]) end @@ -855,6 +865,8 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do let(:attributes) { { bulk_upload:, field_5: "5", field_10: nil } } it "adds error on field_10" do + parser.valid? + expect(parser.errors[:field_5]).to be_present expect(parser.errors[:field_10]).to eq(["You must answer is this a London Affordable Rent letting"]) end @@ -864,6 +876,8 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do let(:attributes) { { bulk_upload:, field_5: "5", field_10: "Intermediate rent" } } it "adds error on field_10" do + parser.valid? + expect(parser.errors[:field_5]).to be_present expect(parser.errors[:field_10]).to eq(["You must answer is this a London Affordable Rent letting"]) end @@ -873,6 +887,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do let(:attributes) { { bulk_upload:, field_5: "9", field_11: "3", field_12: nil } } it "adds error on field_12" do + parser.valid? expect(parser.errors[:field_12]).to eq(["You must answer product name"]) end end @@ -882,6 +897,8 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do let(:attributes) { { bulk_upload:, field_5: "1", field_4: "1" } } it "is permitted" do + parser.valid? + expect(parser.errors[:field_4]).to be_blank expect(parser.errors[:field_5]).to be_blank end @@ -891,6 +908,8 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do let(:attributes) { { bulk_upload:, field_5: "2", field_4: "1" } } it "is not permitted" do + parser.valid? + expect(parser.errors[:field_4]).to include("This letting type is supported housing, but the needs type is general needs. Change either the needs type or the letting type.") expect(parser.errors[:field_5]).to include("This needs type is general needs, but the letting type is supported housing. Change either the needs type or the letting type.") end @@ -904,6 +923,8 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do let(:attributes) { { bulk_upload:, field_5: "1", field_4: "2" } } it "is not permitted" do + parser.valid? + expect(parser.errors[:field_4]).to include("This letting type is general needs, but the needs type is supported housing. Change either the needs type or the letting type.") expect(parser.errors[:field_5]).to include("This needs type is supported housing, but the letting type is general needs. Change either the needs type or the letting type.") end @@ -913,6 +934,8 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do let(:attributes) { { bulk_upload:, field_5: "2", field_4: "2" } } it "is permitted" do + parser.valid? + expect(parser.errors[:field_4]).to be_blank expect(parser.errors[:field_5]).to be_blank end @@ -925,6 +948,8 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do let(:attributes) { { bulk_upload:, field_4: "2", field_5: "2", field_15: nil, field_16: nil, field_17: nil } } it "cannot be nulled" do + parser.valid? + expect(parser.errors[:field_15]).to be_blank expect(parser.errors[:field_16]).to eq(["You must answer scheme code"]) expect(parser.errors[:field_17]).to be_blank @@ -935,6 +960,8 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do let(:attributes) { { bulk_upload:, field_4: "1", field_5: "1", field_15: nil, field_16: nil, field_17: nil } } it "can be nulled" do + parser.valid? + expect(parser.errors[:field_15]).to be_blank expect(parser.errors[:field_16]).to be_blank expect(parser.errors[:field_17]).to be_blank @@ -945,14 +972,12 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do let(:scheme) { create(:scheme, :with_old_visible_id, owning_organisation: owning_org) } let!(:location) { create(:location, :with_old_visible_id, scheme:) } - before do - parser.valid? - end - context "when matching scheme cannot be found" do let(:attributes) { { bulk_upload:, field_1: owning_org.old_visible_id, field_2: owning_org.old_visible_id, field_4: "2", field_5: "2", field_16: "S123", field_17: location.id } } it "returns a setup error" do + parser.valid? + expect(parser.errors[:field_15]).to be_blank expect(parser.errors.where(:field_16, category: :setup).map(&:message)).to eq(["This scheme code does not belong to the owning organisation or managing organisation"]) expect(parser.errors[:field_17]).to be_blank @@ -963,6 +988,8 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do let(:attributes) { { bulk_upload:, field_1: owning_org.old_visible_id, field_2: owning_org.old_visible_id, field_4: "2", field_5: "2", field_16: "S#{scheme.id}", field_17: nil } } it "returns a setup error" do + parser.valid? + expect(parser.errors[:field_15]).to be_blank expect(parser.errors[:field_16]).to be_blank expect(parser.errors.where(:field_17, category: :setup).map(&:message)).to eq(["You must answer location code"]) @@ -974,6 +1001,8 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do let(:attributes) { { bulk_upload:, field_1: owning_org.old_visible_id, field_2: owning_org.old_visible_id, field_4: "2", field_5: "2", field_16: scheme.old_visible_id.to_s, field_15: nil, field_17: nil } } it "returns a setup error" do + parser.valid? + expect(parser.errors[:field_16]).to be_blank expect(parser.errors[:field_17]).to be_blank expect(parser.errors.where(:field_15, category: :setup).map(&:message)).to eq(["You must answer management group code"]) @@ -985,6 +1014,8 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do let(:attributes) { { bulk_upload:, field_1: owning_org.old_visible_id, field_2: owning_org.old_visible_id, field_4: "2", field_5: "2", field_16: "S#{scheme.id}", field_17: "123" } } it "returns a setup error" do + parser.valid? + expect(parser.errors[:field_15]).to be_blank expect(parser.errors[:field_16]).to be_blank expect(parser.errors.where(:field_17, category: :setup).map(&:message)).to eq(["Location code must relate to a location that is owned by the owning organisation or managing organisation"]) @@ -995,6 +1026,8 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do let(:attributes) { { bulk_upload:, field_1: owning_org.old_visible_id, field_2: owning_org.old_visible_id, field_4: "2", field_5: "2", field_16: "S#{scheme.id}", field_17: location.id } } it "does not return an error" do + parser.valid? + expect(parser.errors[:field_15]).to be_blank expect(parser.errors[:field_16]).to be_blank expect(parser.errors[:field_17]).to be_blank @@ -1017,6 +1050,8 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do let(:attributes) { { bulk_upload:, field_1: owning_org.old_visible_id, field_2: owning_org.old_visible_id, field_4: "2", field_5: "2", field_16: "S#{scheme.id}", field_17: other_location.id } } it "returns a setup error" do + parser.valid? + expect(parser.errors[:field_15]).to be_blank expect(parser.errors[:field_16]).to be_blank expect(parser.errors.where(:field_17, category: :setup).map(&:message)).to eq(["Location code must relate to a location that is owned by the owning organisation or managing organisation"]) @@ -1029,6 +1064,8 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do let(:attributes) { { bulk_upload:, field_4: "2", field_5: "2", field_16: "S#{other_scheme.id}", field_17: other_location.id, field_1: owning_org.old_visible_id, field_2: owning_org.old_visible_id } } it "returns a setup error" do + parser.valid? + expect(parser.errors[:field_15]).to be_blank expect(parser.errors.where(:field_16, category: :setup).map(&:message)).to eq(["This scheme code does not belong to the owning organisation or managing organisation"]) expect(parser.errors[:field_17]).to be_blank @@ -1039,6 +1076,8 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do let(:attributes) { { bulk_upload:, field_4: "2", field_5: "2", field_16: "S#{scheme.id}", field_17: location.id, field_1: owning_org.old_visible_id, field_2: owning_org.old_visible_id } } it "does not return an error" do + parser.valid? + expect(parser.errors[:field_15]).to be_blank expect(parser.errors[:field_16]).to be_blank expect(parser.errors[:field_17]).to be_blank @@ -1051,6 +1090,8 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do let(:attributes) { { bulk_upload:, field_4: "2", field_5: "2", field_16: "S#{managing_org_scheme.id}", field_17: managing_org_location.id, field_2: managing_org.old_visible_id } } it "clears the scheme answer" do + parser.valid? + expect(parser.errors[:field_15]).to be_blank expect(parser.errors[:field_16]).to include("You must answer scheme name") expect(parser.errors[:field_17]).to be_blank @@ -1062,6 +1103,8 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do let(:attributes) { { bulk_upload:, field_1: owning_org.old_visible_id, field_2: owning_org.old_visible_id, field_4: "2", field_5: "2", field_16: "S#{scheme.id}", field_17: incomplete_location.id } } it "returns a setup error for scheme" do + parser.valid? + expect(parser.errors[:field_15]).to be_blank expect(parser.errors.where(:field_16).map(&:message)).to eq(["This location is incomplete. Select another location or update this one"]) expect(parser.errors.where(:field_17).map(&:message)).to eq(["This location is incomplete. Select another location or update this one"]) @@ -1073,14 +1116,12 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do let(:scheme) { create(:scheme, :with_old_visible_id, owning_organisation: owning_org) } let!(:location) { create(:location, :with_old_visible_id, scheme:) } - before do - parser.valid? - end - context "when matching scheme cannot be found" do let(:attributes) { { bulk_upload:, field_1: owning_org.old_visible_id, field_2: owning_org.old_visible_id, field_4: "2", field_5: "2", field_15: "123", field_16: location.old_visible_id } } it "returns a setup error" do + parser.valid? + expect(parser.errors.where(:field_15, category: :setup).map(&:message)).to eq(["This management group code does not belong to the owning organisation or managing organisation"]) expect(parser.errors[:field_16]).to be_blank expect(parser.errors[:field_17]).to be_blank @@ -1091,6 +1132,8 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do let(:attributes) { { bulk_upload:, field_1: owning_org.old_visible_id, field_2: owning_org.old_visible_id, field_4: "2", field_5: "2", field_15: scheme.old_visible_id, field_16: nil } } it "returns a setup error" do + parser.valid? + expect(parser.errors[:field_15]).to be_blank expect(parser.errors.where(:field_16, category: :setup).map(&:message)).to eq(["You must answer scheme code"]) expect(parser.errors[:field_17]).to be_blank @@ -1101,6 +1144,8 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do let(:attributes) { { bulk_upload:, field_1: owning_org.old_visible_id, field_2: owning_org.old_visible_id, field_4: "2", field_5: "2", field_15: scheme.old_visible_id, field_16: "123" } } it "returns a setup error" do + parser.valid? + expect(parser.errors[:field_15]).to be_blank expect(parser.errors.where(:field_16, category: :setup).map(&:message)).to eq(["Scheme code must relate to a scheme that is owned by the owning organisation or managing organisation"]) expect(parser.errors[:field_17]).to be_blank @@ -1111,6 +1156,8 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do let(:attributes) { { bulk_upload:, field_1: owning_org.old_visible_id, field_2: owning_org.old_visible_id, field_4: "2", field_5: "2", field_15: scheme.old_visible_id, field_16: location.old_visible_id } } it "does not return an error" do + parser.valid? + expect(parser.errors[:field_15]).to be_blank expect(parser.errors[:field_16]).to be_blank expect(parser.errors[:field_17]).to be_blank @@ -1123,6 +1170,8 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do let(:attributes) { { bulk_upload:, field_1: owning_org.old_visible_id, field_2: owning_org.old_visible_id, field_4: "2", field_5: "2", field_15: scheme.old_visible_id, field_16: other_location.old_visible_id } } it "returns a setup error" do + parser.valid? + expect(parser.errors[:field_15]).to be_blank expect(parser.errors.where(:field_16, category: :setup).map(&:message)).to eq(["Scheme code must relate to a scheme that is owned by the owning organisation or managing organisation"]) expect(parser.errors[:field_17]).to be_blank @@ -1135,6 +1184,8 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do let(:attributes) { { bulk_upload:, field_4: "2", field_5: "2", field_15: other_scheme.old_visible_id, field_16: other_location.old_visible_id, field_1: owning_org.old_visible_id, field_2: owning_org.old_visible_id } } it "returns a setup error" do + parser.valid? + expect(parser.errors.where(:field_15, category: :setup).map(&:message)).to eq(["This management group code does not belong to the owning organisation or managing organisation"]) expect(parser.errors[:field_16]).to be_blank expect(parser.errors[:field_17]).to be_blank @@ -1145,6 +1196,8 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do let(:attributes) { { bulk_upload:, field_4: "2", field_5: "2", field_15: scheme.old_visible_id, field_16: location.old_visible_id, field_1: owning_org.old_visible_id, field_2: owning_org.old_visible_id } } it "does not return an error" do + parser.valid? + expect(parser.errors[:field_15]).to be_blank expect(parser.errors[:field_16]).to be_blank expect(parser.errors[:field_17]).to be_blank @@ -1157,6 +1210,8 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do let(:attributes) { { bulk_upload:, field_4: "2", field_5: "2", field_15: managing_org_scheme.old_visible_id, field_16: managing_org_location.old_visible_id, field_2: managing_org.old_visible_id } } it "clears the scheme answer" do + parser.valid? + expect(parser.errors[:field_15]).to include("You must answer scheme name") expect(parser.errors[:field_16]).to be_blank expect(parser.errors[:field_17]).to be_blank @@ -1171,6 +1226,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do let(:attributes) { { bulk_upload:, field_102: "40", field_6: "1" } } it "is permitted" do + parser.valid? expect(parser.errors[:field_102]).to be_blank end end @@ -1179,6 +1235,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do let(:attributes) { { bulk_upload:, field_102: "42", field_6: "1" } } it "is permitted" do + parser.valid? expect(parser.errors[:field_102]).to be_blank end end @@ -1187,6 +1244,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do let(:attributes) { { bulk_upload:, field_102: "1", field_6: "1" } } it "is not permitted" do + parser.valid? expect(parser.errors[:field_102]).to be_present end end @@ -1196,6 +1254,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do let(:attributes) { setup_section_params.merge({ field_102: "7" }) } it "returns an error" do + parser.valid? expect(parser.errors[:field_102]).to include("Enter a valid value for What is the tenant’s main reason for the household leaving their last settled home?") end end @@ -1206,6 +1265,8 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do let(:attributes) { { bulk_upload:, field_83: "1" } } it "is permitted" do + parser.valid? + expect(parser.errors[:field_83]).to be_blank expect(parser.errors[:field_84]).to be_blank expect(parser.errors[:field_85]).to be_blank @@ -1216,6 +1277,8 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do let(:attributes) { { bulk_upload:, field_83: "1", field_84: "1" } } it "is not permitted" do + parser.valid? + expect(parser.errors[:field_83]).to be_present expect(parser.errors[:field_84]).to be_present end @@ -1227,6 +1290,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do let(:attributes) { { bulk_upload:, field_87: "1", field_86: "1" } } it "is not permitted" do + parser.valid? expect(parser.errors[:field_87]).to be_present end end @@ -1237,6 +1301,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do let(:attributes) { { bulk_upload:, field_88: "1", field_86: "1" } } it "is not permitted" do + parser.valid? expect(parser.errors[:field_88]).to be_present end end @@ -1247,6 +1312,8 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do let(:attributes) { { bulk_upload:, field_87: "1", field_88: "1" } } it "is not permitted" do + parser.valid? + expect(parser.errors[:field_87]).to be_present expect(parser.errors[:field_88]).to be_present end @@ -1258,6 +1325,8 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do let(:attributes) { setup_section_params.merge({ field_83: nil, field_84: nil, field_85: nil, field_86: nil, field_87: nil, field_88: nil }) } it "adds errors to correct fields" do + parser.valid? + expect(parser.errors[:field_83]).to be_present expect(parser.errors[:field_84]).to be_present expect(parser.errors[:field_85]).to be_present @@ -1270,6 +1339,8 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do let(:attributes) { setup_section_params.merge({ field_83: "1", field_86: nil }) } it "sets other disabled access needs as no" do + parser.valid? + expect(parser.errors[:field_83]).to be_blank expect(parser.errors[:field_86]).to be_blank expect(parser.log.housingneeds_other).to eq(0) @@ -1282,6 +1353,8 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do let(:attributes) { { bulk_upload:, field_89: "2", field_90: "1", field_91: "1", field_92: "1" } } it "errors added to correct fields" do + parser.valid? + expect(parser.errors[:field_90]).to be_present expect(parser.errors[:field_91]).to be_present expect(parser.errors[:field_92]).to be_present @@ -1299,6 +1372,8 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do let(:attributes) { { bulk_upload:, field_89: "1", field_90: nil, field_91: nil, field_92: nil, field_93: nil, field_94: nil, field_95: nil, field_96: nil, field_97: nil, field_98: nil, field_99: nil } } it "errors added to correct fields" do + parser.valid? + expect(parser.errors[:field_90]).to be_present expect(parser.errors[:field_91]).to be_present expect(parser.errors[:field_92]).to be_present @@ -1323,6 +1398,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do end it "adds an error to #{field}" do + parser.valid? expect(parser.errors[field]).to be_present end end @@ -1334,6 +1410,8 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do let(:attributes) { { bulk_upload:, field_110: "1", field_111: nil, field_112: nil, field_113: nil, field_114: nil, field_115: nil } } it "is not permitted" do + parser.valid? + expect(parser.errors[:field_111]).to be_present expect(parser.errors[:field_112]).to be_present expect(parser.errors[:field_113]).to be_present @@ -1348,6 +1426,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do let(:attributes) { { bulk_upload:, field_119: "3", field_1: owning_org.old_visible_id, field_2: owning_org.old_visible_id } } it "is not permitted" do + parser.valid? expect(parser.errors[:field_119]).to be_present end end @@ -1356,6 +1435,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do let(:attributes) { { bulk_upload:, field_119: "4", field_1: owning_org.old_visible_id, field_2: owning_org.old_visible_id, field_4: "1" } } it "is not permitted" do + parser.valid? expect(parser.errors[:field_119]).to be_present end end @@ -1366,6 +1446,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do let(:attributes) { { bulk_upload:, field_119: "4", field_1: owning_org.old_visible_id, field_2: owning_org.old_visible_id } } it "is permitted" do + parser.valid? expect(parser.errors[:field_119]).to be_blank end end @@ -1375,6 +1456,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do let(:attributes) { { bulk_upload:, field_119: "4", field_4: "2" } } it "is permitted" do + parser.valid? expect(parser.errors[:field_119]).to be_blank end end @@ -1385,6 +1467,8 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do let(:attributes) { { bulk_upload:, field_5: "1", field_7: nil, field_8: nil, field_9: nil } } it "returns an error" do + parser.valid? + expect(parser.errors[:field_7]).to be_present expect(parser.errors[:field_8]).to be_present expect(parser.errors[:field_9]).to be_present @@ -1395,6 +1479,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do let(:attributes) { { bulk_upload:, field_9: "2022" } } it "returns an error" do + parser.valid? expect(parser.errors[:field_9]).to include("Tenancy start year must be 2 digits") end end @@ -1413,6 +1498,8 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do let(:bulk_upload) { create(:bulk_upload, :lettings, user:, year: 2023) } it "does not return errors" do + parser.valid? + expect(parser.errors[:field_7]).not_to be_present expect(parser.errors[:field_8]).not_to be_present expect(parser.errors[:field_9]).not_to be_present @@ -1425,6 +1512,8 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do let(:bulk_upload) { create(:bulk_upload, :lettings, user:, year: 2023) } it "returns setup errors" do + parser.valid? + expect(parser.errors.where(:field_7, category: :setup)).to be_present expect(parser.errors.where(:field_8, category: :setup)).to be_present expect(parser.errors.where(:field_9, category: :setup)).to be_present @@ -1437,10 +1526,12 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do let(:attributes) { { bulk_upload:, field_1: "", field_4: 1 } } it "is not permitted as setup error" do + parser.valid? expect(parser.errors.where(:field_1, category: :setup).map(&:message)).to eql(["You must answer owning organisation"]) end it "blocks log creation" do + parser.valid? expect(parser).to be_block_log_creation end end @@ -1449,12 +1540,14 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do let(:attributes) { { bulk_upload:, field_1: "donotexist" } } it "is not permitted as setup error" do - setup_errors = parser.errors.select { |e| e.options[:category] == :setup } + parser.valid? + setup_errors = parser.errors.select { |e| e.options[:category] == :setup } expect(setup_errors.find { |e| e.attribute == :field_1 }.message).to eql("The owning organisation code is incorrect") end it "blocks log creation" do + parser.valid? expect(parser).to be_block_log_creation end end @@ -1465,12 +1558,14 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do let(:attributes) { { bulk_upload:, field_1: owning_org.old_visible_id, field_2: owning_org.old_visible_id } } it "is not permitted as setup error" do - setup_errors = parser.errors.select { |e| e.options[:category] == :setup } + parser.valid? + setup_errors = parser.errors.select { |e| e.options[:category] == :setup } expect(setup_errors.find { |e| e.attribute == :field_1 }.message).to eql("The owning organisation code provided is for an organisation that does not own stock") end it "blocks log creation" do + parser.valid? expect(parser).to be_block_log_creation end end @@ -1481,12 +1576,14 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do let(:attributes) { { bulk_upload:, field_1: unaffiliated_org.old_visible_id } } it "is not permitted as setup error" do - setup_errors = parser.errors.select { |e| e.options[:category] == :setup } + parser.valid? + setup_errors = parser.errors.select { |e| e.options[:category] == :setup } expect(setup_errors.find { |e| e.attribute == :field_1 }.message).to eql("You do not have permission to add logs for this owning organisation") end it "blocks log creation" do + parser.valid? expect(parser).to be_block_log_creation end end @@ -1542,12 +1639,14 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do let(:attributes) { { bulk_upload:, field_2: "", field_4: 1 } } it "is not permitted as setup error" do - setup_errors = parser.errors.select { |e| e.options[:category] == :setup } + parser.valid? + setup_errors = parser.errors.select { |e| e.options[:category] == :setup } expect(setup_errors.find { |e| e.attribute == :field_2 }.message).to eql("The managing organisation code is incorrect") end it "blocks log creation" do + parser.valid? expect(parser).to be_block_log_creation end end @@ -1556,12 +1655,14 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do let(:attributes) { { bulk_upload:, field_2: "donotexist" } } it "is not permitted as setup error" do - setup_errors = parser.errors.select { |e| e.options[:category] == :setup } + parser.valid? + setup_errors = parser.errors.select { |e| e.options[:category] == :setup } expect(setup_errors.find { |e| e.attribute == :field_2 }.message).to eql("The managing organisation code is incorrect") end it "blocks log creation" do + parser.valid? expect(parser).to be_block_log_creation end end @@ -1572,12 +1673,14 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do let(:attributes) { { bulk_upload:, field_1: owning_org.old_visible_id, field_2: unaffiliated_org.old_visible_id } } it "is not permitted as setup error" do - setup_errors = parser.errors.select { |e| e.options[:category] == :setup } + parser.valid? + setup_errors = parser.errors.select { |e| e.options[:category] == :setup } expect(setup_errors.find { |e| e.attribute == :field_2 }.message).to eql("This managing organisation does not have a relationship with the owning organisation") end it "blocks log creation" do + parser.valid? expect(parser).to be_block_log_creation end end @@ -1588,6 +1691,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do let(:attributes) { { bulk_upload:, field_4: nil, field_13: "123" } } it "is reported as a setup error" do + parser.valid? expect(parser.errors.where(:field_4, category: :setup).map(&:message)).to eql(["You must answer needs type"]) end end @@ -1598,6 +1702,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do let(:attributes) { { bulk_upload:, field_1: owning_org.old_visible_id, field_2: owning_org.old_visible_id, field_6: "" } } it "has setup errors on the field" do + parser.valid? expect(parser.errors.where(:field_6, category: :setup).map(&:message)).to eql(["You must answer property renewal"]) end end @@ -1606,6 +1711,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do let(:attributes) { setup_section_params.merge({ field_6: "101" }) } it "adds a setup error" do + parser.valid? expect(parser.errors.where(:field_6, category: :setup).map(&:message)).to include("Enter a valid value for Is this letting a renewal?") end end @@ -1616,6 +1722,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do let(:attributes) { setup_section_params.merge({ field_18: "1234567890123" }) } it "adds an appropriate error" do + parser.valid? expect(parser.errors[:field_18]).to eql(["UPRN is not recognised. Check the number, or enter the address"]) end end @@ -1624,6 +1731,8 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do let(:attributes) { setup_section_params } it "adds appropriate errors" do + parser.valid? + expect(parser.errors[:field_18]).to eql(["You must answer UPRN"]) expect(parser.errors[:field_19]).to eql(["You must answer address line 1"]) expect(parser.errors[:field_21]).to eql(["You must answer town or city"]) @@ -1642,6 +1751,8 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do end it "does not add UPRN errors" do + parser.valid? + expect(parser.errors[:field_18]).to be_empty expect(parser.errors[:field_19]).to be_empty expect(parser.errors[:field_21]).to be_empty @@ -1657,6 +1768,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do end it "doesn't add an error" do + parser.valid? expect(parser.errors[:field_18]).to be_empty end end @@ -1671,6 +1783,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do end it "doesn't add an error" do + parser.valid? expect(parser.errors[:field_18]).to be_empty end end @@ -1681,6 +1794,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do let(:attributes) { setup_section_params.merge({ field_26: "4" }) } it "returns an error" do + parser.valid? expect(parser.errors[:field_26]).to be_present end end @@ -1691,10 +1805,12 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do let(:attributes) { setup_section_params.merge({ field_30: nil }) } it "returns an error" do + parser.valid? expect(parser.errors[:field_30]).to be_present end it "populates with correct error message" do + parser.valid? expect(parser.errors[:field_30]).to eql(["You must answer type of building"]) end end @@ -1705,6 +1821,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do let(:attributes) { setup_section_params.merge({ field_52: "", field_53: "F" }) } it "returns an error" do + parser.valid? expect(parser.errors[:field_52]).to be_present end end @@ -1715,11 +1832,15 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do let(:attributes) { setup_section_params.merge({ field_46: 22, field_50: 5 }) } it "adds an error to the relevant fields" do + parser.valid? + expect(parser.errors.where(:field_46, category: :soft_validation)).to be_present expect(parser.errors.where(:field_50, category: :soft_validation)).to be_present end it "populates with correct error message" do + parser.valid? + expect(parser.errors.where(:field_46, category: :soft_validation).first.message).to eql("You told us this person is aged 22 years and retired.") expect(parser.errors.where(:field_50, category: :soft_validation).first.message).to eql("You told us this person is aged 22 years and retired.") end @@ -1729,11 +1850,15 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do let(:attributes) { setup_section_params.merge({ field_82: "1", field_47: "M", field_53: "M", field_57: "M" }) } it "adds errors to fields that are routed to" do + parser.valid? + expect(parser.errors.where(:field_53, category: :soft_validation)).to be_present expect(parser.errors.where(:field_57, category: :soft_validation)).to be_present end it "does not add errors to fields that are not routed to" do + parser.valid? + expect(parser.errors.where(:field_61, category: :soft_validation)).not_to be_present expect(parser.errors.where(:field_65, category: :soft_validation)).not_to be_present end @@ -1743,10 +1868,13 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do let(:attributes) { setup_section_params.merge({ field_128: 120, field_126: 1, field_32: 1, field_4: 1, field_5: "3", field_25: "E09000008" }) } it "adds an error to the relevant fields" do + parser.valid? expect(parser.errors.where(:field_128, category: :soft_validation)).to be_present end it "populates with correct error message" do + parser.valid? + expect(parser.errors.where(:field_128, category: :soft_validation).count).to be(1) expect(parser.errors.where(:field_128, category: :soft_validation).first.message).to eql("You told us the rent is £120.00 every week. This is higher than we would expect.") end