diff --git a/app/frontend/styles/_unread-notification.scss b/app/frontend/styles/_unread-notification.scss index d76b36fa2..a42cd2d05 100644 --- a/app/frontend/styles/_unread-notification.scss +++ b/app/frontend/styles/_unread-notification.scss @@ -5,3 +5,7 @@ .app-unread-notification p { color: govuk-colour("white"); } + +.app-unread-notification a { + color: govuk-colour("white"); +} diff --git a/app/models/form/lettings/questions/letting_allocation.rb b/app/models/form/lettings/questions/letting_allocation.rb index 18c0a3042..09fd82121 100644 --- a/app/models/form/lettings/questions/letting_allocation.rb +++ b/app/models/form/lettings/questions/letting_allocation.rb @@ -7,15 +7,27 @@ class Form::Lettings::Questions::LettingAllocation < ::Form::Question @type = "checkbox" @check_answers_card_number = 0 @hint_text = "Select all that apply." - @answer_options = ANSWER_OPTIONS @question_number = 84 end - ANSWER_OPTIONS = { - "cbl" => { "value" => "Choice-based lettings (CBL)" }, - "cap" => { "value" => "Common Allocation Policy (CAP)" }, - "chr" => { "value" => "Common housing register (CHR)" }, - "divider" => { "value" => true }, - "letting_allocation_unknown" => { "value" => "None of these allocation systems" }, - }.freeze + def answer_options + if form.start_year_after_2024? + { + "cbl" => { "value" => "Choice-based lettings (CBL)", "hint" => "Where available vacant properties are advertised and applicants are able to bid for specific properties." }, + "cap" => { "value" => "Common Allocation Policy (CAP)", "hint" => "Where a common system agreed between a group of housing providers is used to determine applicant’s priority for housing." }, + "chr" => { "value" => "Common housing register (CHR)", "hint" => "Where a single waiting list is used by a group of housing providers to receive and process housing applications. Providers may use different approaches to determine priority." }, + "accessible_register" => { "value" => "Accessible housing register", "hint" => "Where the ‘access category’ or another descriptor of whether an available vacant property meets a range of access needs is displayed to applicants during the allocations process." }, + "divider" => { "value" => true }, + "letting_allocation_unknown" => { "value" => "None of these allocation systems" }, + }.freeze + else + { + "cbl" => { "value" => "Choice-based lettings (CBL)" }, + "cap" => { "value" => "Common Allocation Policy (CAP)" }, + "chr" => { "value" => "Common housing register (CHR)" }, + "divider" => { "value" => true }, + "letting_allocation_unknown" => { "value" => "None of these allocation systems" }, + }.freeze + end + end end diff --git a/app/models/form/sales/questions/mortgage_lender.rb b/app/models/form/sales/questions/mortgage_lender.rb index e2f57306e..ee78ca639 100644 --- a/app/models/form/sales/questions/mortgage_lender.rb +++ b/app/models/form/sales/questions/mortgage_lender.rb @@ -7,7 +7,6 @@ class Form::Sales::Questions::MortgageLender < ::Form::Question @type = "select" @hint_text = "" @page = page - @answer_options = ANSWER_OPTIONS @bottom_guidance_partial = "mortgage_lender" @ownershipsch = ownershipsch @question_number = question_number @@ -54,54 +53,24 @@ class Form::Sales::Questions::MortgageLender < ::Form::Question "37" => "Virgin Money", "38" => "West Bromwich Building Society", "39" => "Yorkshire Building Society", + "41" => "Kent Reliance", "40" => "Other", "0" => "Don’t know", }.freeze + OPTIONS_INTRODUCED_2024 = %w[41].freeze + OPTIONS_NOT_DISPLAYED = %w[0].freeze + + def answer_options + if form.start_year_after_2024? + ANSWER_OPTIONS + else + ANSWER_OPTIONS.dup.reject { |k, _v| OPTIONS_INTRODUCED_2024.include?(k) } + end + end + def displayed_answer_options(_log, _user = nil) - { - "" => "Select an option", - "1" => "Atom Bank", - "2" => "Barclays Bank PLC", - "3" => "Bath Building Society", - "4" => "Buckinghamshire Building Society", - "5" => "Cambridge Building Society", - "6" => "Coventry Building Society", - "7" => "Cumberland Building Society", - "8" => "Darlington Building Society", - "9" => "Dudley Building Society", - "10" => "Ecology Building Society", - "11" => "Halifax", - "12" => "Hanley Economic Building Society", - "13" => "Hinckley and Rugby Building Society", - "14" => "Holmesdale Building Society", - "15" => "Ipswich Building Society", - "16" => "Leeds Building Society", - "17" => "Lloyds Bank", - "18" => "Mansfield Building Society", - "19" => "Market Harborough Building Society", - "20" => "Melton Mowbray Building Society", - "21" => "Nationwide Building Society", - "22" => "Natwest", - "23" => "Nedbank Private Wealth", - "24" => "Newbury Building Society", - "25" => "OneSavings Bank", - "26" => "Parity Trust", - "27" => "Penrith Building Society", - "28" => "Pepper Homeloans", - "29" => "Royal Bank of Scotland", - "30" => "Santander", - "31" => "Skipton Building Society", - "32" => "Teachers Building Society", - "33" => "The Co-operative Bank", - "34" => "Tipton & Coseley Building Society", - "35" => "TSB", - "36" => "Ulster Bank", - "37" => "Virgin Money", - "38" => "West Bromwich Building Society", - "39" => "Yorkshire Building Society", - "40" => "Other", - } + answer_options.reject { |k, _v| OPTIONS_NOT_DISPLAYED.include?(k) } end def question_number diff --git a/app/models/validations/financial_validations.rb b/app/models/validations/financial_validations.rb index a1d799624..890c28284 100644 --- a/app/models/validations/financial_validations.rb +++ b/app/models/validations/financial_validations.rb @@ -24,7 +24,7 @@ module Validations::FinancialValidations end def validate_net_income(record) - if record.ecstat1 && record.hhmemb && record.weekly_net_income + if record.ecstat1 && record.hhmemb && record.weekly_net_income && record.startdate && record.form.start_date.year >= 2023 if record.weekly_net_income > record.applicable_income_range.hard_max frequency = record.form.get_question("incfreq", record).label_from_value(record.incfreq).downcase hard_max = format_as_currency(record.applicable_income_range.hard_max) diff --git a/app/services/bulk_upload/lettings/year2024/row_parser.rb b/app/services/bulk_upload/lettings/year2024/row_parser.rb index 28cfc1ca8..34823ee91 100644 --- a/app/services/bulk_upload/lettings/year2024/row_parser.rb +++ b/app/services/bulk_upload/lettings/year2024/row_parser.rb @@ -651,10 +651,11 @@ private end def validate_lettings_allocation - if cbl.blank? && cap.blank? && chr.blank? + if cbl.blank? && cap.blank? && chr.blank? && accessible_register.blank? errors.add(:field_112, I18n.t("validations.not_answered", question: "was the letting made under the Choice-Based Lettings (CBL)?")) errors.add(:field_113, I18n.t("validations.not_answered", question: "was the letting made under the Common Allocation Policy (CAP)?")) errors.add(:field_114, I18n.t("validations.not_answered", question: "was the letting made under the Common Housing Register (CHR)?")) + errors.add(:field_115, I18n.t("validations.not_answered", question: "was the letting made under the Accessible Register?")) end end @@ -945,9 +946,10 @@ private rp_dontknow: %i[field_111], cbl: %i[field_112], - chr: %i[field_114], cap: %i[field_113], - letting_allocation: %i[field_112 field_113 field_114], + chr: %i[field_114], + accessible_register: %i[field_115], + letting_allocation: %i[field_112 field_113 field_114 field_115], referral: %i[field_116], @@ -1133,6 +1135,7 @@ private attributes["cbl"] = cbl attributes["chr"] = chr attributes["cap"] = cap + attributes["accessible_register"] = accessible_register attributes["letting_allocation_unknown"] = letting_allocation_unknown attributes["referral"] = field_116 @@ -1382,6 +1385,15 @@ private end end + def cap + case field_113 + when 2 + 0 + when 1 + 1 + end + end + def chr case field_114 when 2 @@ -1391,8 +1403,8 @@ private end end - def cap - case field_113 + def accessible_register + case field_115 when 2 0 when 1 @@ -1401,7 +1413,7 @@ private end def letting_allocation_unknown - [cbl, chr, cap].all?(0) ? 1 : 0 + [cbl, chr, cap, accessible_register].all?(0) ? 1 : 0 end def net_income_known diff --git a/app/services/csv/lettings_log_csv_service.rb b/app/services/csv/lettings_log_csv_service.rb index 91006e388..e67363188 100644 --- a/app/services/csv/lettings_log_csv_service.rb +++ b/app/services/csv/lettings_log_csv_service.rb @@ -263,7 +263,7 @@ module Csv "renttype" => RENTTYPE_LABELS, }.freeze - CONVENTIONAL_YES_NO_ATTRIBUTES = %w[illness_type_1 illness_type_2 illness_type_3 illness_type_4 illness_type_5 illness_type_6 illness_type_7 illness_type_8 illness_type_9 illness_type_10 refused cbl cap chr letting_allocation_none housingneeds_a housingneeds_b housingneeds_c housingneeds_d housingneeds_e housingneeds_f housingneeds_g housingneeds_h has_benefits nocharge postcode_known].freeze + CONVENTIONAL_YES_NO_ATTRIBUTES = %w[illness_type_1 illness_type_2 illness_type_3 illness_type_4 illness_type_5 illness_type_6 illness_type_7 illness_type_8 illness_type_9 illness_type_10 refused cbl cap chr accessible_register letting_allocation_none housingneeds_a housingneeds_b housingneeds_c housingneeds_d housingneeds_e housingneeds_f housingneeds_g housingneeds_h has_benefits nocharge postcode_known].freeze YES_OR_BLANK_ATTRIBUTES = %w[declaration rp_homeless rp_insan_unsat rp_medwel rp_hardship rp_dontknow].freeze diff --git a/app/views/notifications/_notification_banner.html.erb b/app/views/notifications/_notification_banner.html.erb index 230fe458a..cd7dfffac 100644 --- a/app/views/notifications/_notification_banner.html.erb +++ b/app/views/notifications/_notification_banner.html.erb @@ -6,7 +6,7 @@ <% if notification_count > 1 && current_user.present? %>

Notification 1 of <%= notification_count %>

<% end %> -

<%= notification.title %>

+

<%= notification.title.html_safe %>

<% if notification.page_content.present? %>
<%= govuk_link_to notification.link_text, notifications_path, class: "govuk-link--inverse govuk-!-font-weight-bold" %> diff --git a/db/migrate/20240129161037_add_accessible_register_to_lettings_logs.rb b/db/migrate/20240129161037_add_accessible_register_to_lettings_logs.rb new file mode 100644 index 000000000..623a95306 --- /dev/null +++ b/db/migrate/20240129161037_add_accessible_register_to_lettings_logs.rb @@ -0,0 +1,5 @@ +class AddAccessibleRegisterToLettingsLogs < ActiveRecord::Migration[7.0] + def change + add_column :lettings_logs, :accessible_register, :integer + end +end diff --git a/db/schema.rb b/db/schema.rb index 2402013ad..6959c4bf3 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -192,14 +192,14 @@ ActiveRecord::Schema[7.0].define(version: 2024_02_09_153215) do t.integer "hb" t.integer "hbrentshortfall" t.integer "property_relet" - t.datetime "mrcdate", precision: nil + t.datetime "mrcdate" t.integer "incref" - t.datetime "startdate", precision: nil + t.datetime "startdate" t.integer "armedforces" t.integer "first_time_property_let_as_social_housing" t.integer "unitletas" t.integer "builtype" - t.datetime "voiddate", precision: nil + t.datetime "voiddate" t.bigint "owning_organisation_id" t.bigint "managing_organisation_id" t.integer "renttype" @@ -306,6 +306,7 @@ ActiveRecord::Schema[7.0].define(version: 2024_02_09_153215) do t.integer "nationality_all" t.integer "nationality_all_group" t.integer "reasonother_value_check" + t.integer "accessible_register" t.index ["bulk_upload_id"], name: "index_lettings_logs_on_bulk_upload_id" t.index ["created_by_id"], name: "index_lettings_logs_on_created_by_id" t.index ["location_id"], name: "index_lettings_logs_on_location_id" @@ -356,7 +357,7 @@ ActiveRecord::Schema[7.0].define(version: 2024_02_09_153215) do t.string "old_id" t.string "old_visible_id" t.string "mobility_type" - t.datetime "startdate", precision: nil + t.datetime "startdate" t.string "location_admin_district" t.boolean "confirmed" t.boolean "is_la_inferred" @@ -556,7 +557,7 @@ ActiveRecord::Schema[7.0].define(version: 2024_02_09_153215) do t.integer "stairbought" t.integer "stairowned" t.decimal "mrent", precision: 10, scale: 2 - t.datetime "exdate", precision: nil + t.datetime "exdate" t.integer "exday" t.integer "exmonth" t.integer "exyear" @@ -592,7 +593,7 @@ ActiveRecord::Schema[7.0].define(version: 2024_02_09_153215) do t.integer "wchair" t.integer "income2_value_check" t.integer "armedforcesspouse" - t.datetime "hodate", precision: nil + t.datetime "hodate" t.integer "hoday" t.integer "homonth" t.integer "hoyear" @@ -710,8 +711,8 @@ ActiveRecord::Schema[7.0].define(version: 2024_02_09_153215) do t.string "name" t.bigint "organisation_id" t.integer "sign_in_count", default: 0, null: false - t.datetime "current_sign_in_at", precision: nil - t.datetime "last_sign_in_at", precision: nil + t.datetime "current_sign_in_at" + t.datetime "last_sign_in_at" t.string "current_sign_in_ip" t.string "last_sign_in_ip" t.integer "role" @@ -719,7 +720,7 @@ ActiveRecord::Schema[7.0].define(version: 2024_02_09_153215) do t.string "phone" t.integer "failed_attempts", default: 0 t.string "unlock_token" - t.datetime "locked_at", precision: nil + t.datetime "locked_at" t.boolean "is_dpo", default: false t.boolean "is_key_contact", default: false t.integer "second_factor_attempts_count", default: 0 @@ -727,12 +728,12 @@ ActiveRecord::Schema[7.0].define(version: 2024_02_09_153215) do t.string "encrypted_otp_secret_key_iv" t.string "encrypted_otp_secret_key_salt" t.string "direct_otp" - t.datetime "direct_otp_sent_at", precision: nil + t.datetime "direct_otp_sent_at" t.datetime "totp_timestamp", precision: nil t.boolean "active", default: true t.string "confirmation_token" - t.datetime "confirmed_at", precision: nil - t.datetime "confirmation_sent_at", precision: nil + t.datetime "confirmed_at" + t.datetime "confirmation_sent_at" t.string "unconfirmed_email" t.boolean "initial_confirmation_sent" t.index ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true diff --git a/lib/tasks/clear_invalidated_earnings.rake b/lib/tasks/clear_invalidated_earnings.rake new file mode 100644 index 000000000..74dbd1aca --- /dev/null +++ b/lib/tasks/clear_invalidated_earnings.rake @@ -0,0 +1,11 @@ +desc "Clear earnings for lettings logs that fail validation" +task clear_invalidated_earnings: :environment do + LettingsLog.filter_by_year(2023).find_each do |lettings_log| + lettings_log.validate_net_income(lettings_log) + if lettings_log.errors[:earnings].present? + lettings_log.earnings = nil + lettings_log.incfreq = nil + lettings_log.save!(validate: false) + end + end +end diff --git a/spec/factories/lettings_log.rb b/spec/factories/lettings_log.rb index 8b7e3f543..6f4cf951c 100644 --- a/spec/factories/lettings_log.rb +++ b/spec/factories/lettings_log.rb @@ -113,6 +113,7 @@ FactoryBot.define do cbl { 0 } chr { 1 } cap { 0 } + accessible_register { 0 } reasonother { nil } housingneeds { 1 } housingneeds_type { 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 2776273c8..e752f4237 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,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,declaration,postcode_known,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,hhmemb,pregnancy_value_check,refused,hhtype,totchild,totelder,totadult,age1,retirement_value_check,sex1,ethnic_group,ethnic,national,nationality_all,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,reasonother_value_check,prevten,new_old,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,earnings,incfreq,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_sensitive,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,false,2023-11-26T00:00:00+00:00,,2024-04-01T00:00:00+01:00,1,,,2023,DLUHC,DLUHC,1,7,0,2023-11-26,2,2,1,,2,HIJKLMN,ABCDEFG,1,1,0,,,fake address,,London,,NW9 5LL,false,Barnet,E09000003,0,2,6,2,2,7,1,1,3,2023-11-24,,,1,2023-11-25,,3,1,4,,2,,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,2,1,0,TN23 6LZ,1,false,Ashford,E07000105,1,0,1,0,0,0,0,0,1,,2,,0,0,268,1,,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,,,,,,,,,,,,,,,,,,,, +id,status,duplicate_set_id,created_by,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,declaration,postcode_known,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,hhmemb,pregnancy_value_check,refused,hhtype,totchild,totelder,totadult,age1,retirement_value_check,sex1,ethnic_group,ethnic,national,nationality_all,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,reasonother_value_check,prevten,new_old,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,earnings,incfreq,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_sensitive,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,false,2023-11-26T00:00:00+00:00,,2024-04-01T00:00:00+01:00,1,,,2023,DLUHC,DLUHC,1,7,0,2023-11-26,2,2,1,,2,HIJKLMN,ABCDEFG,1,1,0,,,fake address,,London,,NW9 5LL,false,Barnet,E09000003,0,2,6,2,2,7,1,1,3,2023-11-24,,,1,2023-11-25,,3,1,4,,2,,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,2,1,0,TN23 6LZ,1,false,Ashford,E07000105,1,0,1,0,0,0,0,0,1,0,,2,,0,0,268,1,,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_24.csv b/spec/fixtures/files/lettings_log_csv_export_labels_24.csv index 76638fec4..2d15ea4b3 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,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,declaration,postcode_known,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,hhmemb,pregnancy_value_check,refused,hhtype,totchild,totelder,totadult,age1,retirement_value_check,sex1,ethnic_group,ethnic,national,nationality_all,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,reasonother_value_check,prevten,new_old,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,earnings,incfreq,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_sensitive,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,false,2023-11-26T00:00:00+00:00,,2024-04-01T00:00:00+01:00,single log,,,2023,DLUHC,DLUHC,General needs,Affordable rent general needs local authority,No,2023-11-26,Affordable Rent,Affordable Rent,Rent to Buy,,No,HIJKLMN,ABCDEFG,Yes,Yes,No,,,fake address,,London,,NW9 5LL,No,Barnet,E09000003,No,Affordable rent basis,Tenant abandoned property,No,2,House,Purpose built,Yes,3,2023-11-24,,,Yes,2023-11-25,,Don’t know,Yes,Assured Shorthold Tenancy (AST) – Fixed term,,2,,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,2,No,Yes,TN23 6LZ,Yes,No,Ashford,E07000105,Yes,,Yes,,,,No,No,Yes,,Tenant applied directly (no referral or nomination),,Yes,No,268,Weekly,,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,,,,,,,,,,,,,,,,,,,, +id,status,duplicate_set_id,created_by,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,declaration,postcode_known,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,hhmemb,pregnancy_value_check,refused,hhtype,totchild,totelder,totadult,age1,retirement_value_check,sex1,ethnic_group,ethnic,national,nationality_all,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,reasonother_value_check,prevten,new_old,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,earnings,incfreq,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_sensitive,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,false,2023-11-26T00:00:00+00:00,,2024-04-01T00:00:00+01:00,single log,,,2023,DLUHC,DLUHC,General needs,Affordable rent general needs local authority,No,2023-11-26,Affordable Rent,Affordable Rent,Rent to Buy,,No,HIJKLMN,ABCDEFG,Yes,Yes,No,,,fake address,,London,,NW9 5LL,No,Barnet,E09000003,No,Affordable rent basis,Tenant abandoned property,No,2,House,Purpose built,Yes,3,2023-11-24,,,Yes,2023-11-25,,Don’t know,Yes,Assured Shorthold Tenancy (AST) – Fixed term,,2,,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,2,No,Yes,TN23 6LZ,Yes,No,Ashford,E07000105,Yes,,Yes,,,,No,No,Yes,No,,Tenant applied directly (no referral or nomination),,Yes,No,268,Weekly,,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_24.csv b/spec/fixtures/files/lettings_log_csv_export_non_support_codes_24.csv index c796f49d7..29c2db295 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,created_by,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,declaration,uprn_known,uprn,address_line1,address_line2,town_or_city,county,postcode_full,la_label,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,hhmemb,refused,age1,sex1,ethnic_group,ethnic,national,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,letting_allocation_none,referral,referral_value_check,incref,earnings,incfreq,hb,has_benefits,benefits,household_charge,nocharge,period,is_carehome,chcharge,wchchrg,carehome_charges_value_check,brent,scharge,pscharge,supcharg,tcharge,scharge_value_check,pscharge_value_check,supcharg_value_check,hbrentshortfall,tshortfall,scheme_code,scheme_service_name,scheme_sensitive,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,,2024-04-01T00:00:00+01:00,1,2023,DLUHC,DLUHC,1,7,0,2023-11-26,2,2,1,,2,HIJKLMN,ABCDEFG,1,0,,fake address,,London,,NW9 5LL,Barnet,2,6,2,2,7,1,1,3,2023-11-24,1,,1,2023-11-25,,3,1,4,,2,,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,268,1,6,1,1,,0,2,,,,,200.0,50.0,40.0,35.0,325.0,,,,1,12.0,,,,,,,,,,,,,,,,,,,, +id,status,duplicate_set_id,created_by,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,declaration,uprn_known,uprn,address_line1,address_line2,town_or_city,county,postcode_full,la_label,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,hhmemb,refused,age1,sex1,ethnic_group,ethnic,national,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,referral_value_check,incref,earnings,incfreq,hb,has_benefits,benefits,household_charge,nocharge,period,is_carehome,chcharge,wchchrg,carehome_charges_value_check,brent,scharge,pscharge,supcharg,tcharge,scharge_value_check,pscharge_value_check,supcharg_value_check,hbrentshortfall,tshortfall,scheme_code,scheme_service_name,scheme_sensitive,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,,2024-04-01T00:00:00+01:00,1,2023,DLUHC,DLUHC,1,7,0,2023-11-26,2,2,1,,2,HIJKLMN,ABCDEFG,1,0,,fake address,,London,,NW9 5LL,Barnet,2,6,2,2,7,1,1,3,2023-11-24,1,,1,2023-11-25,,3,1,4,,2,,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,0,,2,,0,268,1,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_24.csv b/spec/fixtures/files/lettings_log_csv_export_non_support_labels_24.csv index 572e034cc..cef9f5c72 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,created_by,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,declaration,uprn_known,uprn,address_line1,address_line2,town_or_city,county,postcode_full,la_label,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,hhmemb,refused,age1,sex1,ethnic_group,ethnic,national,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,letting_allocation_none,referral,referral_value_check,incref,earnings,incfreq,hb,has_benefits,benefits,household_charge,nocharge,period,is_carehome,chcharge,wchchrg,carehome_charges_value_check,brent,scharge,pscharge,supcharg,tcharge,scharge_value_check,pscharge_value_check,supcharg_value_check,hbrentshortfall,tshortfall,scheme_code,scheme_service_name,scheme_sensitive,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,,2024-04-01T00:00:00+01:00,single log,2023,DLUHC,DLUHC,General needs,Affordable rent general needs local authority,No,2023-11-26,Affordable Rent,Affordable Rent,Rent to Buy,,No,HIJKLMN,ABCDEFG,Yes,No,,fake address,,London,,NW9 5LL,Barnet,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,,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,268,Weekly,Universal Credit housing element,Yes,All,,No,Every 2 weeks,,,,,200.0,50.0,40.0,35.0,325.0,,,,Yes,12.0,,,,,,,,,,,,,,,,,,,, +id,status,duplicate_set_id,created_by,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,declaration,uprn_known,uprn,address_line1,address_line2,town_or_city,county,postcode_full,la_label,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,hhmemb,refused,age1,sex1,ethnic_group,ethnic,national,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,referral_value_check,incref,earnings,incfreq,hb,has_benefits,benefits,household_charge,nocharge,period,is_carehome,chcharge,wchchrg,carehome_charges_value_check,brent,scharge,pscharge,supcharg,tcharge,scharge_value_check,pscharge_value_check,supcharg_value_check,hbrentshortfall,tshortfall,scheme_code,scheme_service_name,scheme_sensitive,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,,2024-04-01T00:00:00+01:00,single log,2023,DLUHC,DLUHC,General needs,Affordable rent general needs local authority,No,2023-11-26,Affordable Rent,Affordable Rent,Rent to Buy,,No,HIJKLMN,ABCDEFG,Yes,No,,fake address,,London,,NW9 5LL,Barnet,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,,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,No,,Tenant applied directly (no referral or nomination),,No,268,Weekly,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/lib/tasks/clear_invalidated_earnings_spec.rb b/spec/lib/tasks/clear_invalidated_earnings_spec.rb new file mode 100644 index 000000000..19e5d8f88 --- /dev/null +++ b/spec/lib/tasks/clear_invalidated_earnings_spec.rb @@ -0,0 +1,110 @@ +require "rails_helper" +require "rake" + +RSpec.describe "clear_invalidated_earnings" do + describe ":clear_invalidated_earnings", type: :task do + subject(:task) { Rake::Task["clear_invalidated_earnings"] } + + before do + Rake.application.rake_require("tasks/clear_invalidated_earnings") + Rake::Task.define_task(:environment) + task.reenable + FormHandler.instance.use_real_forms! + end + + context "when the rake task is run" do + context "and there are 2023 logs with invalid earnings" do + let(:user) { create(:user) } + let!(:lettings_log) { create(:lettings_log, :completed, created_by: user, voiddate: nil, mrcdate: nil) } + + before do + lettings_log.startdate = Time.zone.local(2023, 4, 4) + lettings_log.incfreq = 1 + lettings_log.earnings = 20 + lettings_log.hhmemb = 1 + lettings_log.ecstat1 = 1 + lettings_log.save!(validate: false) + end + + it "clears earnings" do + initial_updated_at = lettings_log.updated_at + expect(lettings_log.incfreq).to eq(1) + expect(lettings_log.earnings).to eq(20) + expect(lettings_log.hhmemb).to eq(1) + expect(lettings_log.ecstat1).to eq(1) + + task.invoke + lettings_log.reload + + expect(lettings_log.incfreq).to eq(nil) + expect(lettings_log.earnings).to eq(nil) + expect(lettings_log.hhmemb).to eq(1) + expect(lettings_log.ecstat1).to eq(1) + expect(lettings_log.updated_at).not_to eq(initial_updated_at) + end + end + + context "and there are valid 2023 logs" do + let(:user) { create(:user) } + let!(:lettings_log) { create(:lettings_log, :completed, created_by: user, voiddate: nil, mrcdate: nil) } + + before do + lettings_log.startdate = Time.zone.local(2023, 4, 4) + lettings_log.incfreq = 1 + lettings_log.earnings = 95 + lettings_log.hhmemb = 1 + lettings_log.ecstat1 = 1 + lettings_log.save! + end + + it "does not update the logs" do + initial_updated_at = lettings_log.updated_at + expect(lettings_log.incfreq).to eq(1) + expect(lettings_log.earnings).to eq(95) + expect(lettings_log.hhmemb).to eq(1) + expect(lettings_log.ecstat1).to eq(1) + + task.invoke + lettings_log.reload + + expect(lettings_log.incfreq).to eq(1) + expect(lettings_log.earnings).to eq(95) + expect(lettings_log.hhmemb).to eq(1) + expect(lettings_log.ecstat1).to eq(1) + expect(lettings_log.updated_at).to eq(initial_updated_at) + end + end + + context "and there are 2022 logs" do + let(:user) { create(:user) } + let!(:lettings_log) { create(:lettings_log, :completed, created_by: user, voiddate: nil, mrcdate: nil) } + + before do + lettings_log.startdate = Time.zone.local(2022, 4, 4) + lettings_log.incfreq = 1 + lettings_log.earnings = 20 + lettings_log.hhmemb = 1 + lettings_log.ecstat1 = 1 + lettings_log.save!(validate: false) + end + + it "does not update the logs" do + initial_updated_at = lettings_log.updated_at + expect(lettings_log.incfreq).to eq(1) + expect(lettings_log.earnings).to eq(20) + expect(lettings_log.hhmemb).to eq(1) + expect(lettings_log.ecstat1).to eq(1) + + task.invoke + lettings_log.reload + + expect(lettings_log.incfreq).to eq(1) + expect(lettings_log.earnings).to eq(20) + expect(lettings_log.hhmemb).to eq(1) + expect(lettings_log.ecstat1).to eq(1) + expect(lettings_log.updated_at).to eq(initial_updated_at) + end + end + end + end +end diff --git a/spec/models/form/lettings/questions/letting_allocation_spec.rb b/spec/models/form/lettings/questions/letting_allocation_spec.rb new file mode 100644 index 000000000..ab268d840 --- /dev/null +++ b/spec/models/form/lettings/questions/letting_allocation_spec.rb @@ -0,0 +1,74 @@ +require "rails_helper" + +RSpec.describe Form::Lettings::Questions::LettingAllocation, type: :model do + subject(:question) { described_class.new(question_id, question_definition, page) } + + let(:question_id) { nil } + let(:question_definition) { nil } + let(:page) { instance_double(Form::Page) } + let(:subsection) { instance_double(Form::Subsection) } + let(:form) { instance_double(Form) } + + before do + allow(form).to receive(:start_year_after_2024?).and_return(false) + allow(page).to receive(:subsection).and_return(subsection) + allow(subsection).to receive(:form).and_return(form) + end + + it "has correct page" do + expect(question.page).to eq(page) + end + + it "has the correct id" do + expect(question.id).to eq("letting_allocation") + end + + it "has the correct header" do + expect(question.header).to eq("How was this letting allocated?") + end + + it "has the correct check_answer_label" do + expect(question.check_answer_label).to eq("Allocation system") + end + + it "has the correct type" do + expect(question.type).to eq("checkbox") + end + + it "is not marked as derived" do + expect(question.derived?).to be false + end + + context "with 2023/24 form" do + it "has the correct answer_options" do + expect(question.answer_options).to eq({ + "cbl" => { "value" => "Choice-based lettings (CBL)" }, + "cap" => { "value" => "Common Allocation Policy (CAP)" }, + "chr" => { "value" => "Common housing register (CHR)" }, + "divider" => { "value" => true }, + "letting_allocation_unknown" => { "value" => "None of these allocation systems" }, + }) + end + end + + context "with 2024/25 form" do + before do + allow(form).to receive(:start_year_after_2024?).and_return(true) + end + + it "has the correct answer_options" do + expect(question.answer_options).to eq({ + "cbl" => { "value" => "Choice-based lettings (CBL)", "hint" => "Where available vacant properties are advertised and applicants are able to bid for specific properties." }, + "cap" => { "value" => "Common Allocation Policy (CAP)", "hint" => "Where a common system agreed between a group of housing providers is used to determine applicant’s priority for housing." }, + "chr" => { "value" => "Common housing register (CHR)", "hint" => "Where a single waiting list is used by a group of housing providers to receive and process housing applications. Providers may use different approaches to determine priority." }, + "accessible_register" => { "value" => "Accessible housing register", "hint" => "Where the ‘access category’ or another descriptor of whether an available vacant property meets a range of access needs is displayed to applicants during the allocations process." }, + "divider" => { "value" => true }, + "letting_allocation_unknown" => { "value" => "None of these allocation systems" }, + }) + end + end + + it "has the correct check_answers_card_number" do + expect(question.check_answers_card_number).to eq(0) + end +end diff --git a/spec/models/form/sales/questions/mortgage_lender_spec.rb b/spec/models/form/sales/questions/mortgage_lender_spec.rb index 1fcf928a3..e50dafb2b 100644 --- a/spec/models/form/sales/questions/mortgage_lender_spec.rb +++ b/spec/models/form/sales/questions/mortgage_lender_spec.rb @@ -6,6 +6,14 @@ RSpec.describe Form::Sales::Questions::MortgageLender, type: :model do let(:question_id) { nil } let(:question_definition) { nil } let(:page) { instance_double(Form::Page) } + let(:subsection) { instance_double(Form::Subsection) } + let(:form) { instance_double(Form) } + + before do + allow(form).to receive(:start_year_after_2024?) + allow(page).to receive(:subsection).and_return(subsection) + allow(subsection).to receive(:form).and_return(form) + end it "has correct page" do expect(question.page).to eq(page) @@ -44,96 +52,203 @@ RSpec.describe Form::Sales::Questions::MortgageLender, type: :model do expect(question.top_guidance_partial).to be_nil end - it "has the correct answer_options" do - expect(question.answer_options).to eq({ - "" => "Select an option", - "0" => "Don’t know", - "1" => "Atom Bank", - "2" => "Barclays Bank PLC", - "3" => "Bath Building Society", - "4" => "Buckinghamshire Building Society", - "5" => "Cambridge Building Society", - "6" => "Coventry Building Society", - "7" => "Cumberland Building Society", - "8" => "Darlington Building Society", - "9" => "Dudley Building Society", - "10" => "Ecology Building Society", - "11" => "Halifax", - "12" => "Hanley Economic Building Society", - "13" => "Hinckley and Rugby Building Society", - "14" => "Holmesdale Building Society", - "15" => "Ipswich Building Society", - "16" => "Leeds Building Society", - "17" => "Lloyds Bank", - "18" => "Mansfield Building Society", - "19" => "Market Harborough Building Society", - "20" => "Melton Mowbray Building Society", - "21" => "Nationwide Building Society", - "22" => "Natwest", - "23" => "Nedbank Private Wealth", - "24" => "Newbury Building Society", - "25" => "OneSavings Bank", - "26" => "Parity Trust", - "27" => "Penrith Building Society", - "28" => "Pepper Homeloans", - "29" => "Royal Bank of Scotland", - "30" => "Santander", - "31" => "Skipton Building Society", - "32" => "Teachers Building Society", - "33" => "The Co-operative Bank", - "34" => "Tipton & Coseley Building Society", - "35" => "TSB", - "36" => "Ulster Bank", - "37" => "Virgin Money", - "38" => "West Bromwich Building Society", - "39" => "Yorkshire Building Society", - "40" => "Other", - }) + context "when form year is before 2024" do + before do + allow(form).to receive(:start_year_after_2024?).and_return(false) + end + + it "has the correct answer_options" do + expect(question.answer_options).to eq({ + "" => "Select an option", + "0" => "Don’t know", + "1" => "Atom Bank", + "2" => "Barclays Bank PLC", + "3" => "Bath Building Society", + "4" => "Buckinghamshire Building Society", + "5" => "Cambridge Building Society", + "6" => "Coventry Building Society", + "7" => "Cumberland Building Society", + "8" => "Darlington Building Society", + "9" => "Dudley Building Society", + "10" => "Ecology Building Society", + "11" => "Halifax", + "12" => "Hanley Economic Building Society", + "13" => "Hinckley and Rugby Building Society", + "14" => "Holmesdale Building Society", + "15" => "Ipswich Building Society", + "16" => "Leeds Building Society", + "17" => "Lloyds Bank", + "18" => "Mansfield Building Society", + "19" => "Market Harborough Building Society", + "20" => "Melton Mowbray Building Society", + "21" => "Nationwide Building Society", + "22" => "Natwest", + "23" => "Nedbank Private Wealth", + "24" => "Newbury Building Society", + "25" => "OneSavings Bank", + "26" => "Parity Trust", + "27" => "Penrith Building Society", + "28" => "Pepper Homeloans", + "29" => "Royal Bank of Scotland", + "30" => "Santander", + "31" => "Skipton Building Society", + "32" => "Teachers Building Society", + "33" => "The Co-operative Bank", + "34" => "Tipton & Coseley Building Society", + "35" => "TSB", + "36" => "Ulster Bank", + "37" => "Virgin Money", + "38" => "West Bromwich Building Society", + "39" => "Yorkshire Building Society", + "40" => "Other", + }) + end + + it "has the correct displayed_answer_options" do + expect(question.displayed_answer_options(nil, nil)).to eq({ + "" => "Select an option", + "1" => "Atom Bank", + "2" => "Barclays Bank PLC", + "3" => "Bath Building Society", + "4" => "Buckinghamshire Building Society", + "5" => "Cambridge Building Society", + "6" => "Coventry Building Society", + "7" => "Cumberland Building Society", + "8" => "Darlington Building Society", + "9" => "Dudley Building Society", + "10" => "Ecology Building Society", + "11" => "Halifax", + "12" => "Hanley Economic Building Society", + "13" => "Hinckley and Rugby Building Society", + "14" => "Holmesdale Building Society", + "15" => "Ipswich Building Society", + "16" => "Leeds Building Society", + "17" => "Lloyds Bank", + "18" => "Mansfield Building Society", + "19" => "Market Harborough Building Society", + "20" => "Melton Mowbray Building Society", + "21" => "Nationwide Building Society", + "22" => "Natwest", + "23" => "Nedbank Private Wealth", + "24" => "Newbury Building Society", + "25" => "OneSavings Bank", + "26" => "Parity Trust", + "27" => "Penrith Building Society", + "28" => "Pepper Homeloans", + "29" => "Royal Bank of Scotland", + "30" => "Santander", + "31" => "Skipton Building Society", + "32" => "Teachers Building Society", + "33" => "The Co-operative Bank", + "34" => "Tipton & Coseley Building Society", + "35" => "TSB", + "36" => "Ulster Bank", + "37" => "Virgin Money", + "38" => "West Bromwich Building Society", + "39" => "Yorkshire Building Society", + "40" => "Other", + }) + end end - it "has the correct displayed_answer_options" do - expect(question.displayed_answer_options(nil, nil)).to eq({ - "" => "Select an option", - "1" => "Atom Bank", - "2" => "Barclays Bank PLC", - "3" => "Bath Building Society", - "4" => "Buckinghamshire Building Society", - "5" => "Cambridge Building Society", - "6" => "Coventry Building Society", - "7" => "Cumberland Building Society", - "8" => "Darlington Building Society", - "9" => "Dudley Building Society", - "10" => "Ecology Building Society", - "11" => "Halifax", - "12" => "Hanley Economic Building Society", - "13" => "Hinckley and Rugby Building Society", - "14" => "Holmesdale Building Society", - "15" => "Ipswich Building Society", - "16" => "Leeds Building Society", - "17" => "Lloyds Bank", - "18" => "Mansfield Building Society", - "19" => "Market Harborough Building Society", - "20" => "Melton Mowbray Building Society", - "21" => "Nationwide Building Society", - "22" => "Natwest", - "23" => "Nedbank Private Wealth", - "24" => "Newbury Building Society", - "25" => "OneSavings Bank", - "26" => "Parity Trust", - "27" => "Penrith Building Society", - "28" => "Pepper Homeloans", - "29" => "Royal Bank of Scotland", - "30" => "Santander", - "31" => "Skipton Building Society", - "32" => "Teachers Building Society", - "33" => "The Co-operative Bank", - "34" => "Tipton & Coseley Building Society", - "35" => "TSB", - "36" => "Ulster Bank", - "37" => "Virgin Money", - "38" => "West Bromwich Building Society", - "39" => "Yorkshire Building Society", - "40" => "Other", - }) + context "when form year is >= 2024" do + before do + allow(form).to receive(:start_year_after_2024?).and_return(true) + end + + it "has the correct answer_options" do + expect(question.answer_options).to eq({ + "" => "Select an option", + "0" => "Don’t know", + "1" => "Atom Bank", + "2" => "Barclays Bank PLC", + "3" => "Bath Building Society", + "4" => "Buckinghamshire Building Society", + "5" => "Cambridge Building Society", + "6" => "Coventry Building Society", + "7" => "Cumberland Building Society", + "8" => "Darlington Building Society", + "9" => "Dudley Building Society", + "10" => "Ecology Building Society", + "11" => "Halifax", + "12" => "Hanley Economic Building Society", + "13" => "Hinckley and Rugby Building Society", + "14" => "Holmesdale Building Society", + "15" => "Ipswich Building Society", + "16" => "Leeds Building Society", + "17" => "Lloyds Bank", + "18" => "Mansfield Building Society", + "19" => "Market Harborough Building Society", + "20" => "Melton Mowbray Building Society", + "21" => "Nationwide Building Society", + "22" => "Natwest", + "23" => "Nedbank Private Wealth", + "24" => "Newbury Building Society", + "25" => "OneSavings Bank", + "26" => "Parity Trust", + "27" => "Penrith Building Society", + "28" => "Pepper Homeloans", + "29" => "Royal Bank of Scotland", + "30" => "Santander", + "31" => "Skipton Building Society", + "32" => "Teachers Building Society", + "33" => "The Co-operative Bank", + "34" => "Tipton & Coseley Building Society", + "35" => "TSB", + "36" => "Ulster Bank", + "37" => "Virgin Money", + "38" => "West Bromwich Building Society", + "39" => "Yorkshire Building Society", + "41" => "Kent Reliance", + "40" => "Other", + }) + end + + it "has the correct displayed_answer_options" do + expect(question.displayed_answer_options(nil, nil)).to eq({ + "" => "Select an option", + "1" => "Atom Bank", + "2" => "Barclays Bank PLC", + "3" => "Bath Building Society", + "4" => "Buckinghamshire Building Society", + "5" => "Cambridge Building Society", + "6" => "Coventry Building Society", + "7" => "Cumberland Building Society", + "8" => "Darlington Building Society", + "9" => "Dudley Building Society", + "10" => "Ecology Building Society", + "11" => "Halifax", + "12" => "Hanley Economic Building Society", + "13" => "Hinckley and Rugby Building Society", + "14" => "Holmesdale Building Society", + "15" => "Ipswich Building Society", + "16" => "Leeds Building Society", + "17" => "Lloyds Bank", + "18" => "Mansfield Building Society", + "19" => "Market Harborough Building Society", + "20" => "Melton Mowbray Building Society", + "21" => "Nationwide Building Society", + "22" => "Natwest", + "23" => "Nedbank Private Wealth", + "24" => "Newbury Building Society", + "25" => "OneSavings Bank", + "26" => "Parity Trust", + "27" => "Penrith Building Society", + "28" => "Pepper Homeloans", + "29" => "Royal Bank of Scotland", + "30" => "Santander", + "31" => "Skipton Building Society", + "32" => "Teachers Building Society", + "33" => "The Co-operative Bank", + "34" => "Tipton & Coseley Building Society", + "35" => "TSB", + "36" => "Ulster Bank", + "37" => "Virgin Money", + "38" => "West Bromwich Building Society", + "39" => "Yorkshire Building Society", + "41" => "Kent Reliance", + "40" => "Other", + }) + end end end diff --git a/spec/models/validations/financial_validations_spec.rb b/spec/models/validations/financial_validations_spec.rb index 1a6672e08..c68a3b7b2 100644 --- a/spec/models/validations/financial_validations_spec.rb +++ b/spec/models/validations/financial_validations_spec.rb @@ -188,6 +188,7 @@ RSpec.describe Validations::FinancialValidations do describe "net income validations" do it "validates that the net income is within the expected range for the household’s employment status" do + record.startdate = Time.zone.local(2023, 5, 1) record.earnings = 200 record.incfreq = 1 record.hhmemb = 1 @@ -198,6 +199,7 @@ RSpec.describe Validations::FinancialValidations do context "when the net income is higher than the hard max for their employment status" do it "adds an error" do + record.startdate = Time.zone.local(2023, 5, 1) record.earnings = 5000 record.incfreq = 1 record.hhmemb = 1 @@ -214,6 +216,7 @@ RSpec.describe Validations::FinancialValidations do context "when the net income is lower than the hard min for their employment status" do it "adds an error" do + record.startdate = Time.zone.local(2023, 5, 1) record.earnings = 50 record.incfreq = 1 record.hhmemb = 1 @@ -230,6 +233,7 @@ RSpec.describe Validations::FinancialValidations do context "when there is more than one household member" do it "allows income levels based on all working situations combined" do + record.startdate = Time.zone.local(2023, 5, 1) record.earnings = 5000 record.incfreq = 1 record.hhmemb = 4 @@ -242,6 +246,7 @@ RSpec.describe Validations::FinancialValidations do end it "uses the combined value in error messages" do + record.startdate = Time.zone.local(2023, 5, 1) record.earnings = 100 record.incfreq = 1 record.hhmemb = 3 @@ -254,6 +259,7 @@ RSpec.describe Validations::FinancialValidations do end it "adds errors to relevant fields for each tenant when income is too high" do + record.startdate = Time.zone.local(2023, 5, 1) record.earnings = 5000 record.incfreq = 1 record.hhmemb = 3 @@ -277,6 +283,7 @@ RSpec.describe Validations::FinancialValidations do end it "adds errors to relevant fields for each tenant when income is too low" do + record.startdate = Time.zone.local(2023, 5, 1) record.earnings = 50 record.incfreq = 1 record.hhmemb = 3 @@ -293,6 +300,20 @@ RSpec.describe Validations::FinancialValidations do expect(record.errors["ecstat#{n}"]).to be_empty end end + + context "when the net income is lower than the hard min for their employment status for 22/23 collection" do + it "does not add an error" do + record.startdate = Time.zone.local(2022, 5, 1) + record.earnings = 50 + record.incfreq = 1 + record.hhmemb = 1 + record.ecstat1 = 1 + financial_validator.validate_net_income(record) + expect(record.errors["earnings"]).to be_empty + expect(record.errors["ecstat1"]).to be_empty + expect(record.errors["hhmemb"]).to be_empty + 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 58be059fc..4501d25be 100644 --- a/spec/services/bulk_upload/lettings/year2024/row_parser_spec.rb +++ b/spec/services/bulk_upload/lettings/year2024/row_parser_spec.rb @@ -1119,6 +1119,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do expect(parser.errors[:field_112]).to include("You must answer was the letting made under the Choice-Based Lettings (CBL)?") expect(parser.errors[:field_113]).to include("You must answer was the letting made under the Common Allocation Policy (CAP)?") expect(parser.errors[:field_114]).to include("You must answer was the letting made under the Common Housing Register (CHR)?") + expect(parser.errors[:field_115]).to include("You must answer was the letting made under the Accessible Register?") end end end @@ -1889,16 +1890,16 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do end describe "#letting_allocation_unknown" do - context "when field_112, 117, 118 are no ie 2" do - let(:attributes) { { bulk_upload:, field_112: 2, field_113: 2, field_114: 2 } } + context "when field_112, 113, 114, 115 are no ie 2" do + let(:attributes) { { bulk_upload:, field_112: 2, field_113: 2, field_114: 2, field_115: 2 } } it "sets value to 1" do expect(parser.log.letting_allocation_unknown).to be(1) end end - context "when any one of field_112, 117, 118 is yes ie 1" do - let(:attributes) { { bulk_upload:, field_112: 1 } } + context "when any one of field_112, 113, 114, 115 is yes ie 1" do + let(:attributes) { { bulk_upload:, field_115: 1 } } it "sets value to 0" do expect(parser.log.letting_allocation_unknown).to be(0) diff --git a/spec/services/csv/lettings_log_csv_service_spec.rb b/spec/services/csv/lettings_log_csv_service_spec.rb index 659cadc7d..7109d0e94 100644 --- a/spec/services/csv/lettings_log_csv_service_spec.rb +++ b/spec/services/csv/lettings_log_csv_service_spec.rb @@ -101,7 +101,7 @@ RSpec.describe Csv::LettingsLogCsvService do let(:questions) do [ build(:question, id: "condition_effects", type: "checkbox", answer_options: { "illness_type_1" => {}, "illness_type_2" => {}, "illness_type_3" => {} }), - build(:question, id: "letting_allocation", type: "checkbox", answer_options: { "cbl" => {}, "cap" => {}, "chr" => {} }), + build(:question, id: "letting_allocation", type: "checkbox", answer_options: { "cbl" => {}, "cap" => {}, "chr" => {}, "accessible_register" => {} }), ] end