From f1d53bfe018503721b2f5ae90fe0d83ad36555d8 Mon Sep 17 00:00:00 2001 From: Samuel Young Date: Thu, 26 Feb 2026 12:44:52 +0000 Subject: [PATCH] CLDC-4203: Update bulk upload field numbers (#3189) * CLDC-4141: copy person questions refactor from CLDC-4142 * CLDC-4141: remove gender same as sex and replace gender identity q * CLDC-4141: replace sex with sexrab where relevant for 2026 * CLDC-4141: update download order * CLDC-4140: remove sex from rowparser entirely * CLDC-4140: keep sex in factory for now * CLDC-4140: update household characteristics test * CLDC-4140: update log variable spec * CLDC-4140: update csv export tests * CLDC-4140: update validator tests * CLDC-4140: update row-parser spec * CLDC-4140: update csv-parser spec * CLDC-4140: update export spec * CLDC-4140: update log var defs spec * CLDC-4140: update export spec * CLDC-4140: update row parser spec * CLDC-4140: update validator spec * CLDC-4140: update csv parser spec * CLDC-4143: Update gender retirement validations rename functions as the new wording is more related to those that identify as male and any other option * CLDC-4143: Add 2026 tests * CLDC-4143: Update legacy json files causes issues with some old tests * CLDC-4143: Add error mappings for gender fields * CLDC-4143: Add new gender age retirement soft validation replaces the many check pages from previous years with a single one shows if either of the previous ones would show has agreed wording on ticket * fixup! CLDC-4143: Update gender retirement validations improve gender comment wording * CLDC-4143: Update non males validation name reference to 'soft validation' we found confusing * fixup! CLDC-4143: Add new gender age retirement soft validation update subsection specs * CLDC-4140: update parsers post merge * CLDC-4140: update tests after field renumbering * CLDC-4140: update tests after field renumbering * CLDC-4203: Remove builtype from BU * CLDC-4203: Renumber sex/gender fields * CLDC-4203: Renumber source of referral fields * CLDC-4203: Renumber lettings_log_to_csv to_2026_row comments * CLDC-4140: update spacing in to_2026_row * CLDC-4140: update row parser spec field numbers * CLDC-4140: update row parser field types * CLDC-4203: Swap age and relat fields as age is now asked first * CLDC-4203: Update error messages for fields to match BU * CLDC-4203: Add a new example BU file * CLDC-4203: Update tests * CLDC-4164: Fix spacing in lettings_log_to_csv * CLDC-4203: Fix error description q order Co-authored-by: Nat Dean-Lewis <94526761+natdeanlewissoftwire@users.noreply.github.com> * CLDC-4203: Fix attribute ordering in row_parser --------- Co-authored-by: Nat Dean-Lewis Co-authored-by: Nat Dean-Lewis <94526761+natdeanlewissoftwire@users.noreply.github.com> --- .../bulk_upload/lettings_log_to_csv.rb | 111 +- .../lettings/year2026/csv_parser.rb | 2 +- .../lettings/year2026/row_parser.rb | 1089 ++++++++--------- .../files/2026_27_lettings_bulk_upload.csv | 70 +- .../bulk_upload/lettings/validator_spec.rb | 4 +- .../lettings/year2026/csv_parser_spec.rb | 8 +- .../lettings/year2026/row_parser_spec.rb | 1089 ++++++++--------- 7 files changed, 1184 insertions(+), 1189 deletions(-) diff --git a/app/helpers/bulk_upload/lettings_log_to_csv.rb b/app/helpers/bulk_upload/lettings_log_to_csv.rb index 18a524b0d..11f60773f 100644 --- a/app/helpers/bulk_upload/lettings_log_to_csv.rb +++ b/app/helpers/bulk_upload/lettings_log_to_csv.rb @@ -105,8 +105,8 @@ class BulkUpload::LettingsLogToCsv renewal, log.startdate&.day, log.startdate&.month, - log.startdate&.strftime("%y"), # 10 + log.startdate&.strftime("%y"), # 10 rent_type, log.irproduct_other, log.tenancycode, @@ -116,20 +116,19 @@ class BulkUpload::LettingsLogToCsv log.unitletas, log.uprn, log.address_line1&.tr(",", " "), - log.address_line2&.tr(",", " "), # 20 + log.address_line2&.tr(",", " "), # 20 log.town_or_city&.tr(",", " "), log.county&.tr(",", " "), ((log.postcode_full || "").split(" ") || [""]).first, ((log.postcode_full || "").split(" ") || [""]).last, log.la, log.unittype_gn, - log.builtype, log.wchair, log.beds, - log.voiddate&.day, # 30 + log.voiddate&.day, - log.voiddate&.month, + log.voiddate&.month, # 30 log.voiddate&.strftime("%y"), log.mrcdate&.day, log.mrcdate&.month, @@ -138,98 +137,119 @@ class BulkUpload::LettingsLogToCsv log.joint, log.startertenancy, log.tenancy, - log.tenancyother, # 40 + log.tenancyother, - log.tenancylength, + log.tenancylength, # 40 log.age1 || overrides[:age1], log.sexrab1, + log.gender_same_as_sex1, + log.gender_description1, log.ethnic, log.nationality_all_group, log.ecstat1, - relat_number(log.relat2), log.age2 || overrides[:age2], - log.sexrab2, - log.ecstat2, # 50 + relat_number(log.relat2), - relat_number(log.relat3), + log.sexrab2, # 50 + log.gender_same_as_sex2, + log.gender_description2, + log.ecstat2, log.age3 || overrides[:age3], + relat_number(log.relat3), log.sexrab3, + log.gender_same_as_sex3, + log.gender_description3, log.ecstat3, + + log.age4 || overrides[:age4], # 60 relat_number(log.relat4), - log.age4 || overrides[:age4], log.sexrab4, + log.gender_same_as_sex4, + log.gender_description4, log.ecstat4, + log.age5 || overrides[:age5], relat_number(log.relat5), - log.age5 || overrides[:age5], # 60 - log.sexrab5, + log.gender_same_as_sex5, + + log.gender_description5, # 70 log.ecstat5, - relat_number(log.relat6), log.age6 || overrides[:age6], + relat_number(log.relat6), log.sexrab6, + log.gender_same_as_sex6, + log.gender_description6, log.ecstat6, - relat_number(log.relat7), log.age7 || overrides[:age7], - log.sexrab7, - log.ecstat7, # 70 + relat_number(log.relat7), - relat_number(log.relat8), + log.sexrab7, # 80 + log.gender_same_as_sex7, + log.gender_description7, + log.ecstat7, log.age8 || overrides[:age8], + relat_number(log.relat8), log.sexrab8, + log.gender_same_as_sex8, + log.gender_description8, log.ecstat8, - log.armedforces, + + log.armedforces, # 90 log.leftreg, log.reservist, log.preg_occ, log.housingneeds_a, - log.housingneeds_b, # 80 - + log.housingneeds_b, log.housingneeds_c, log.housingneeds_f, log.housingneeds_g, log.housingneeds_h, - overrides[:illness] || log.illness, + + overrides[:illness] || log.illness, # 100 log.illness_type_1, log.illness_type_2, log.illness_type_3, log.illness_type_4, - log.illness_type_5, # 90 - + log.illness_type_5, log.illness_type_6, log.illness_type_7, log.illness_type_8, log.illness_type_9, - log.illness_type_10, + + log.illness_type_10, # 110 log.layear, log.waityear, log.reason, log.reasonother, - log.prevten, # 100 - + log.prevten, homeless, previous_postcode_known, ((log.ppostcode_full || "").split(" ") || [""]).first, ((log.ppostcode_full || "").split(" ") || [""]).last, - log.prevloc, + + log.prevloc, # 120 log.reasonpref, log.rp_homeless, log.rp_insan_unsat, log.rp_medwel, - log.rp_hardship, # 110 - + log.rp_hardship, log.rp_dontknow, cbl, chr, cap, - accessible_register, + + accessible_register, # 130 log.owning_organisation.la? ? log.referral_register : nil, + log.owning_organisation.prp? ? log.referral_register : nil, + log.referral_noms, + log.referral_org, net_income_known, log.incfreq, log.earnings, - log.hb, # 120 - + log.hb, log.benefits, - log.household_charge, + + log.household_charge, # 140 log.period, log.brent, log.scharge, @@ -237,27 +257,6 @@ class BulkUpload::LettingsLogToCsv log.supcharg, log.hbrentshortfall, log.tshortfall, - log.gender_same_as_sex1, # 130 - - log.gender_description1, - log.gender_same_as_sex2, - log.gender_description2, - log.gender_same_as_sex3, - log.gender_description3, - log.gender_same_as_sex4, - log.gender_description4, - log.gender_same_as_sex5, - log.gender_description5, - log.gender_same_as_sex6, # 140 - - log.gender_description6, - log.gender_same_as_sex7, - log.gender_description7, - log.gender_same_as_sex8, - log.gender_description8, - log.owning_organisation.prp? ? log.referral_register : nil, - log.referral_noms, - log.referral_org, # 148 ] end diff --git a/app/services/bulk_upload/lettings/year2026/csv_parser.rb b/app/services/bulk_upload/lettings/year2026/csv_parser.rb index 643990c8b..d2f1ab7b1 100644 --- a/app/services/bulk_upload/lettings/year2026/csv_parser.rb +++ b/app/services/bulk_upload/lettings/year2026/csv_parser.rb @@ -4,7 +4,7 @@ class BulkUpload::Lettings::Year2026::CsvParser include CollectionTimeHelper # TODO: CLDC-4162: Update when 2026 format is known - FIELDS = 148 + FIELDS = 147 FORM_YEAR = 2026 attr_reader :path diff --git a/app/services/bulk_upload/lettings/year2026/row_parser.rb b/app/services/bulk_upload/lettings/year2026/row_parser.rb index c8fc4c891..547ced717 100644 --- a/app/services/bulk_upload/lettings/year2026/row_parser.rb +++ b/app/services/bulk_upload/lettings/year2026/row_parser.rb @@ -11,150 +11,147 @@ class BulkUpload::Lettings::Year2026::RowParser field_4: "What is the needs type?", field_5: "What scheme does this letting belong to?", field_6: "Which location is this letting for?", - field_7: "Is this letting a renewal?", - 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_7: "Is this letting a renewal of social housing to the same tenant in the same property?", + field_8: "What is the tenancy start date? - day DD?", + field_9: "What is the tenancy start date? - month MM?", + field_10: "What is the tenancy start date? - year YY?", 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?", - field_15: "Has tenant seen the MHCLG privacy notice?", + field_15: "Has the tenant seen or been given access to the MHCLG privacy notice?", field_16: "What is the reason for the property being vacant?", field_17: "What type was the property most recently let as?", field_18: "If known, provide this property’s UPRN", - field_19: "Address line 1", - field_20: "Address line 2", + field_19: "Address Line 1", + field_20: "Address Line 2", field_21: "Town or city", field_22: "County", - field_23: "Part 1 of the property’s postcode", - field_24: "Part 2 of the property’s postcode", - field_25: "What is the property’s local authority?", + field_23: "Part 1 of the property's postcode", + field_24: "Part 2 of the property's postcode", + field_25: "What is the property's local authority?", field_26: "What type of unit is the property?", - field_27: "Which type of building is the property?", - field_28: "Is the property built or adapted to wheelchair-user standards?", - field_29: "How many bedrooms does the property have?", - field_30: "What is the void date?", - field_31: "What is the void date?", - field_32: "What is the void date?", - field_33: "What date were any major repairs completed on?", - field_34: "What date were any major repairs completed on?", - field_35: "What date were any major repairs completed on?", - field_36: "Is this letting sheltered accommodation?", - field_37: "Is this a joint tenancy?", - field_38: "Is this a starter tenancy?", - field_39: "What is the type of tenancy?", - field_40: "If 'Other', what is the type of tenancy?", - field_41: "What is the length of the fixed-term tenancy to the nearest year?", - field_42: "What is the lead tenant’s age?", - field_43: "Lead tenant's sex, as registered at birth", - field_44: "Which of these best describes the lead tenant’s ethnic background?", - field_45: "What is the lead tenant’s nationality?", - field_46: "Which of these best describes the lead tenant’s working situation?", - field_47: "Is person 2 the partner of the lead tenant?", - field_48: "What is person 2’s age?", - field_49: "Person 2's sex, as registered at birth", - field_50: "Which of these best describes person 2’s working situation?", - field_51: "Is person 3 the partner of the lead tenant?", - field_52: "What is person 3’s age?", - field_53: "Person 3's sex, as registered at birth", - field_54: "Which of these best describes person 3’s working situation?", - field_55: "Is person 4 the partner of the lead tenant?", - field_56: "What is person 4’s age?", - field_57: "Person 4's sex, as registered at birth", - field_58: "Which of these best describes person 4’s working situation?", - field_59: "Is person 5 the partner of the lead tenant?", - field_60: "What is person 5’s age?", - field_61: "Person 5's sex, as registered at birth", - field_62: "Which of these best describes person 5’s working situation?", - field_63: "Is person 6 the partner of the lead tenant?", - field_64: "What is person 6’s age?", - field_65: "Person 6's sex, as registered at birth", - field_66: "Which of these best describes person 6’s working situation?", - field_67: "Is person 7 the partner of the lead tenant?", - field_68: "What is person 7’s age?", - field_69: "Person 7's sex, as registered at birth", - field_70: "Which of these best describes person 7’s working situation?", - field_71: "Is person 8 the partner of the lead tenant?", - field_72: "What is person 8’s age?", - field_73: "Person 8's sex, as registered at birth", - field_74: "Which of these best describes person 8’s working situation?", - field_75: "Does anybody in the household have links to the UK armed forces?", - field_76: "Is this person still serving in the UK armed forces?", - field_77: "Was this person seriously injured or ill as a result of serving in the UK armed forces?", - field_78: "Is anybody in the household pregnant?", - field_79: "Does anybody in the household have any disabled access needs?", - field_80: "Does anybody in the household have any disabled access needs?", - field_81: "Does anybody in the household have any disabled access needs?", - field_82: "Does anybody in the household have any disabled access needs?", - field_83: "Does anybody in the household have any disabled access needs?", - field_84: "Does anybody in the household have any disabled access needs?", - field_85: "Does anybody in the household have a physical or mental health condition (or other illness) expected to last 12 months or more?", - field_86: "Does this person’s condition affect their dexterity?", - field_87: "Does this person’s condition affect their learning or understanding or concentrating?", - field_88: "Does this person’s condition affect their hearing?", - field_89: "Does this person’s condition affect their memory?", - field_90: "Does this person’s condition affect their mental health?", - field_91: "Does this person’s condition affect their mobility?", - field_92: "Does this person’s condition affect them socially or behaviourally?", - field_93: "Does this person’s condition affect their stamina or breathing or fatigue?", - field_94: "Does this person’s condition affect their vision?", - field_95: "Does this person’s condition affect them in another way?", - field_96: "How long has the household continuously lived in the local authority area of the new letting?", - field_97: "How long has the household been on the local authority waiting list for the new letting?", - field_98: "What is the tenant’s main reason for the household leaving their last settled home?", - field_99: "If 'Other', what was the main reason for leaving their last settled home?", - field_100: "Where was the household immediately before this letting?", - field_101: "Did the household experience homelessness immediately before this letting?", - field_102: "Do you know the postcode of the household’s last settled home?", - field_103: "What is the postcode of the household’s last settled home?", - field_104: "What is the postcode of the household’s last settled home?", - field_105: "What is the local authority of the household’s last settled home?", - field_106: "Was the household given 'reasonable preference' by the local authority?", - field_107: "Reasonable preference reason - They were homeless or about to lose their home (within 56 days)", - field_108: "Reasonable preference reason - They were living in insanitary, overcrowded or unsatisfactory housing", - field_109: "Reasonable preference reason - They needed to move on medical and welfare reasons (including disability)", - field_110: "Reasonable preference reason - They needed to move to avoid hardship to themselves or others", - field_111: "Reasonable preference reason - Don’t know", - field_112: "Was the letting made under the Choice-Based Lettings (CBL)?", - field_113: "Was the letting made under the Common Allocation Policy (CAP)?", - field_114: "Was the letting made under the Common Housing Register (CHR)?", - field_115: "Was the letting made under the Accessible Register?", - field_116: "What was the source of referral for this letting? - LA properties", - field_117: "Do you know the household’s combined total income after tax?", - field_118: "How often does the household receive income?", - field_119: "How much income does the household have in total?", - field_120: "Is the tenant likely to be receiving any of these housing-related benefits?", - field_121: "How much of the household’s income is from Universal Credit, state pensions or benefits?", - field_122: "Does the household pay rent or other charges for the accommodation?", - field_123: "How often does the household pay rent and other charges?", - field_124: "What is the basic rent?", - field_125: "What is the service charge?", - field_126: "What is the personal service charge?", - field_127: "What is the support charge?", - field_128: "After the household has received any housing-related benefits, will they still need to pay for rent and charges?", - field_129: "What do you expect the outstanding amount to be?", - - field_130: "Is the gender the lead tenant identifies with the same as their sex registered at birth?", - field_131: "If 'No', enter the lead tenant's gender identity", - field_132: "Is the gender person 2 identifies with the same as their sex registered at birth?", - field_133: "If 'No', enter person 2's gender identity", - field_134: "Is the gender person 3 identifies with the same as their sex registered at birth?", - field_135: "If 'No', enter person 3's gender identity", - field_136: "Is the gender person 4 identifies with the same as their sex registered at birth?", - field_137: "If 'No', enter person 4's gender identity", - field_138: "Is the gender person 5 identifies with the same as their sex registered at birth?", - field_139: "If 'No', enter person 5's gender identity", - field_140: "Is the gender person 6 identifies with the same as their sex registered at birth?", - field_141: "If 'No', enter person 6's gender identity", - field_142: "Is the gender person 7 identifies with the same as their sex registered at birth?", - field_143: "If 'No', enter person 7's gender identity", - field_144: "Is the gender person 8 identifies with the same as their sex registered at birth?", - field_145: "If 'No', enter person 8's gender identity", - - field_146: "What was the source of referral for this letting? - PRP properties part 1", - field_147: "What was the source of referral for this letting? - PRP properties part 2", - field_148: "What was the source of referral for this letting? - PRP properties part 3", + field_27: "Is the property built or adapted to wheelchair-user standards?", + field_28: "How many bedrooms does the property have?", + field_29: "What is the void date? - day DD", + field_30: "What is the void date? - month MM", + field_31: "What is the void date? - year YY", + field_32: "What date were any major repairs completed on? - day DD", + field_33: "What date were any major repairs completed on? - month MM", + field_34: "What date were any major repairs completed on? - year YY", + field_35: "Is this property older people's housing?", + field_36: "Is this a joint tenancy?", + field_37: "Is this a starter tenancy?", + field_38: "What is the type of tenancy?", + field_39: "If 'Other', what is the type of tenancy?", + field_40: "What is the length of the fixed-term tenancy to the nearest year?", + field_41: "What is the lead tenant’s age?", + field_42: "What is the lead tenant's sex?", + field_43: "Is the gender the lead tenant identifies with the same as their sex registered at birth?", + field_44: "If 'No', enter lead tenant's gender identity", + field_45: "Which of these best describes the lead tenant's ethnic background?", + field_46: "What is the lead tenant’s nationality?", + field_47: "Which of these best describes the lead tenant’s working situation?", + field_48: "What is person 2's age?", + field_49: "Is person 2 the partner of the lead tenant?", + field_50: "What is person 2's sex?", + field_51: "Is the gender the person 2 identifies with the same as their sex registered at birth?", + field_52: "If 'No', enter person 2's gender identity", + field_53: "Which of these best describes person 2's working situation?", + field_54: "What is person 3's age?", + field_55: "Is person 3 the partner of the lead tenant?", + field_56: "What is person 3's sex?", + field_57: "Is the gender the person 3 identifies with the same as their sex registered at birth?", + field_58: "If 'No', enter person 3's gender identity", + field_59: "Which of these best describes person 3's working situation?", + field_60: "What is person 4's age?", + field_61: "Is person 4 the partner of the lead tenant?", + field_62: "What is person 4's sex?", + field_63: "Is the gender the person 4 identifies with the same as their sex registered at birth?", + field_64: "If 'No', enter person 4's gender identity", + field_65: "Which of these best describes person 4's working situation?", + field_66: "What is person 5's age?", + field_67: "Is person 5 the partner of the lead tenant?", + field_68: "What is person 5's sex?", + field_69: "Is the gender the person 5 identifies with the same as their sex registered at birth?", + field_70: "If 'No', enter person 5's gender identity", + field_71: "Which of these best describes person 5's working situation?", + field_72: "What is person 6's age?", + field_73: "Is person 6 the partner of the lead tenant?", + field_74: "What is person 6's sex?", + field_75: "Is the gender the person 6 identifies with the same as their sex registered at birth?", + field_76: "If 'No', enter person 6's gender identity", + field_77: "Which of these best describes person 6's working situation?", + field_78: "What is person 7's age?", + field_79: "Is person 7 the partner of the lead tenant?", + field_80: "What is person 7's sex?", + field_81: "Is the gender the person 7 identifies with the same as their sex registered at birth?", + field_82: "If 'No', enter person 7's gender identity", + field_83: "Which of these best describes person 7's working situation?", + field_84: "What is person 8's age?", + field_85: "Is person 8 the partner of the lead tenant?", + field_86: "What is person 8's sex?", + field_87: "Is the gender the person 8 identifies with the same as their sex registered at birth?", + field_88: "If 'No', enter person 8's gender identity", + field_89: "Which of these best describes person 8's working situation?", + field_90: "Does anybody in the household have links to the UK armed forces?", + field_91: "Is this person still serving in the UK armed forces?", + field_92: "Was this person seriously injured or ill as a result of serving in the UK armed forces?", + field_93: "Is anybody in the household pregnant?", + field_94: "Disabled access needs — a) Fully wheelchair-accessible housing", + field_95: "Disabled access needs — b) Wheelchair access to essential rooms", + field_96: "Disabled access needs — c) Level access housing", + field_97: "Disabled access needs — f) Other disabled access needs", + field_98: "Disabled access needs — g) No disabled access needs", + field_99: "Disabled access needs — h) Don’t know", + field_100: "Does anybody in the household have a physical or mental health condition (or other illness) expected to last 12 months or more?", + field_101: "Does this person's condition affect their dexterity?", + field_102: "Does this person's condition affect their learning or understanding or concentrating?", + field_103: "Does this person's condition affect their hearing?", + field_104: "Does this person's condition affect their memory?", + field_105: "Does this person's condition affect their mental health?", + field_106: "Does this person's condition affect their mobility?", + field_107: "Does this person's condition affect them socially or behaviourally?", + field_108: "Does this person's condition affect their stamina or breathing or fatigue?", + field_109: "Does this person's condition affect their vision?", + field_110: "Does this person's condition affect them in another way?", + field_111: "How long has the household continuously lived in the local authority area of the new letting?", + field_112: "How long has the household been on the local authority housing register (or waiting list) for the area of the new letting?", + field_113: "What is the tenant’s main reason for the household leaving their last settled home?", + field_114: "If 'Other', what was the main reason for leaving their last settled home?", + field_115: "Where was the household immediately before this letting?", + field_116: "Did the household experience homelessness immediately before this letting?", + field_117: "Do you know the postcode of the household's last settled home?", + field_118: "Part 1 of postcode of last settled home", + field_119: "Part 2 of postcode of last settled home", + field_120: "What is the local authority of the household's last settled home?", + field_121: "Was the household given 'reasonable preference' by the local authority?", + field_122: "Reasonable preference reason — They were homeless or about to lose their home (within 56 days)", + field_123: "Reasonable preference reason — They were living in unsanitary, overcrowded or unsatisfactory housing", + field_124: "Reasonable preference reason — They needed to move due to medical and welfare reasons (including disability)", + field_125: "Reasonable preference reason — They needed to move to avoid hardship to themselves or others", + field_126: "Reasonable preference reason — Don't know", + field_127: "How was this letting allocated? — Choice based Lettings (CBL)", + field_128: "How was this letting allocated? — Common Allocations Policy (CAP)", + field_129: "How was this letting allocated? — Common Housing Register (CHR)", + field_130: "How was this letting allocated? — Accessible Housing Register", + field_131: "What was the source of referral for this letting? - LA properties", + field_132: "What was the source of referral for this letting? - PRP properties part 1", + field_133: "What was the source of referral for this letting? - PRP properties part 2", + field_134: "What was the source of referral for this letting? - PRP properties part 3", + field_135: "Do you know the household's combined total income after tax?", + field_136: "How often does the household receive income?", + field_137: "How much income does the household have in total?", + field_138: "Is the tenant likely to be receiving any of these housing-related benefits?", + field_139: "How much of the household's income is from Universal Credit, state pensions or benefits?", + field_140: "Does the household pay rent or other charges for the accommodation?", + field_141: "How often does the household pay rent and other charges?", + field_142: "What is the basic rent?", + field_143: "What is the service charge?", + field_144: "What is the personal service charge?", + field_145: "What is the support charge?", + field_146: "After the household has received any housing-related benefits, will they still need to pay for rent and charges?", + field_147: "What do you expect the outstanding amount to be?", }.freeze RENT_TYPE_BU_MAPPING = { @@ -178,6 +175,8 @@ class BulkUpload::Lettings::Year2026::RowParser attribute :field_2, :string attribute :field_3, :string attribute :field_4, :integer + attribute :field_5, :string + attribute :field_6, :string attribute :field_7, :integer attribute :field_8, :integer attribute :field_9, :integer @@ -186,8 +185,9 @@ class BulkUpload::Lettings::Year2026::RowParser attribute :field_12, :string attribute :field_13, :string attribute :field_14, :string - attribute :field_5, :string - attribute :field_6, :string + attribute :field_15, :integer + attribute :field_16, :integer + attribute :field_17, :integer attribute :field_18, :string attribute :field_19, :string attribute :field_20, :string @@ -196,8 +196,6 @@ class BulkUpload::Lettings::Year2026::RowParser attribute :field_23, :string attribute :field_24, :string attribute :field_25, :string - attribute :field_17, :integer - attribute :field_16, :integer attribute :field_26, :integer attribute :field_27, :integer attribute :field_28, :integer @@ -208,60 +206,59 @@ class BulkUpload::Lettings::Year2026::RowParser attribute :field_33, :integer attribute :field_34, :integer attribute :field_35, :integer + attribute :field_36, :integer attribute :field_37, :integer attribute :field_38, :integer - attribute :field_39, :integer - attribute :field_40, :string - attribute :field_41, :integer - attribute :field_36, :integer - attribute :field_15, :integer + attribute :field_39, :string + attribute :field_40, :integer + attribute :field_41, :string attribute :field_42, :string attribute :field_43, :string - attribute :field_44, :integer + attribute :field_44, :string attribute :field_45, :integer attribute :field_46, :integer attribute :field_47, :integer attribute :field_48, :string - attribute :field_49, :string - attribute :field_50, :integer - attribute :field_51, :integer + attribute :field_49, :integer + attribute :field_50, :string + attribute :field_51, :string attribute :field_52, :string - attribute :field_53, :string - attribute :field_54, :integer + attribute :field_53, :integer + attribute :field_54, :string attribute :field_55, :integer attribute :field_56, :string attribute :field_57, :string - attribute :field_58, :integer + attribute :field_58, :string attribute :field_59, :integer attribute :field_60, :string - attribute :field_61, :string - attribute :field_62, :integer - attribute :field_63, :integer + attribute :field_61, :integer + attribute :field_62, :string + attribute :field_63, :string attribute :field_64, :string - attribute :field_65, :string - attribute :field_66, :integer + attribute :field_65, :integer + attribute :field_66, :string attribute :field_67, :integer attribute :field_68, :string - attribute :field_69, :string - attribute :field_70, :integer + attribute :field_69, :integer + attribute :field_70, :string attribute :field_71, :integer attribute :field_72, :string - attribute :field_73, :string - attribute :field_74, :integer + attribute :field_73, :integer + attribute :field_74, :string attribute :field_75, :integer - attribute :field_76, :integer + attribute :field_76, :string attribute :field_77, :integer - attribute :field_78, :integer + attribute :field_78, :string attribute :field_79, :integer - attribute :field_80, :integer + attribute :field_80, :string attribute :field_81, :integer - attribute :field_82, :integer + attribute :field_82, :string attribute :field_83, :integer - attribute :field_84, :integer + attribute :field_84, :string attribute :field_85, :integer - attribute :field_86, :integer + attribute :field_86, :string attribute :field_87, :integer - attribute :field_88, :integer + attribute :field_88, :string attribute :field_89, :integer attribute :field_90, :integer attribute :field_91, :integer @@ -272,13 +269,13 @@ class BulkUpload::Lettings::Year2026::RowParser attribute :field_96, :integer attribute :field_97, :integer attribute :field_98, :integer - attribute :field_99, :string + attribute :field_99, :integer attribute :field_100, :integer attribute :field_101, :integer attribute :field_102, :integer - attribute :field_103, :string - attribute :field_104, :string - attribute :field_105, :string + attribute :field_103, :integer + attribute :field_104, :integer + attribute :field_105, :integer attribute :field_106, :integer attribute :field_107, :integer attribute :field_108, :integer @@ -287,43 +284,40 @@ class BulkUpload::Lettings::Year2026::RowParser attribute :field_111, :integer attribute :field_112, :integer attribute :field_113, :integer - attribute :field_114, :integer + attribute :field_114, :string attribute :field_115, :integer attribute :field_116, :integer attribute :field_117, :integer - attribute :field_118, :integer - attribute :field_119, :decimal - attribute :field_120, :integer + attribute :field_118, :string + attribute :field_119, :string + attribute :field_120, :string attribute :field_121, :integer attribute :field_122, :integer attribute :field_123, :integer - attribute :field_124, :decimal - attribute :field_125, :decimal - attribute :field_126, :decimal - attribute :field_127, :decimal + attribute :field_124, :integer + attribute :field_125, :integer + attribute :field_126, :integer + attribute :field_127, :integer attribute :field_128, :integer - attribute :field_129, :decimal - + attribute :field_129, :integer attribute :field_130, :integer - attribute :field_131, :string + attribute :field_131, :integer attribute :field_132, :integer - attribute :field_133, :string + attribute :field_133, :integer attribute :field_134, :integer - attribute :field_135, :string + attribute :field_135, :integer attribute :field_136, :integer - attribute :field_137, :string + attribute :field_137, :decimal attribute :field_138, :integer - attribute :field_139, :string + attribute :field_139, :integer attribute :field_140, :integer - attribute :field_141, :string - attribute :field_142, :integer - attribute :field_143, :string - attribute :field_144, :integer - attribute :field_145, :string - + attribute :field_141, :integer + attribute :field_142, :decimal + attribute :field_143, :decimal + attribute :field_144, :decimal + attribute :field_145, :decimal attribute :field_146, :integer - attribute :field_147, :integer - attribute :field_148, :integer + attribute :field_147, :decimal validate :validate_valid_radio_option, on: :before_log @@ -390,7 +384,7 @@ class BulkUpload::Lettings::Year2026::RowParser }, on: :after_log - validates :field_112, + validates :field_127, presence: { message: I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "was the letting made under the Choice-Based Lettings (CBL)?"), category: :not_answered, @@ -398,11 +392,11 @@ class BulkUpload::Lettings::Year2026::RowParser inclusion: { in: [1, 2], message: I18n.t("#{ERROR_BASE_KEY}.invalid_option", question: "was the letting made under the Choice-Based Lettings (CBL)?"), - if: -> { field_112.present? }, + if: -> { field_127.present? }, }, on: :after_log - validates :field_113, + validates :field_128, presence: { message: I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "was the letting made under the Common Allocation Policy (CAP)?"), category: :not_answered, @@ -410,11 +404,11 @@ class BulkUpload::Lettings::Year2026::RowParser inclusion: { in: [1, 2], message: I18n.t("#{ERROR_BASE_KEY}.invalid_option", question: "was the letting made under the Common Allocation Policy (CAP)?"), - if: -> { field_113.present? }, + if: -> { field_128.present? }, }, on: :after_log - validates :field_114, + validates :field_129, presence: { message: I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "was the letting made under the Common Housing Register (CHR)?"), category: :not_answered, @@ -422,11 +416,11 @@ class BulkUpload::Lettings::Year2026::RowParser inclusion: { in: [1, 2], message: I18n.t("#{ERROR_BASE_KEY}.invalid_option", question: "was the letting made under the Common Housing Register (CHR)?"), - if: -> { field_114.present? }, + if: -> { field_129.present? }, }, on: :after_log - validates :field_115, + validates :field_130, presence: { message: I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "was the letting made under the Accessible Register?"), category: :not_answered, @@ -434,18 +428,18 @@ class BulkUpload::Lettings::Year2026::RowParser inclusion: { in: [1, 2], message: I18n.t("#{ERROR_BASE_KEY}.invalid_option", question: "was the letting made under the Accessible Register?"), - if: -> { field_115.present? }, + if: -> { field_130.present? }, }, on: :after_log - validates :field_42, format: { with: /\A\d{1,3}\z|\AR\z/, message: I18n.t("#{ERROR_BASE_KEY}.age.invalid", person_num: 1) }, on: :after_log + validates :field_41, format: { with: /\A\d{1,3}\z|\AR\z/, message: I18n.t("#{ERROR_BASE_KEY}.age.invalid", person_num: 1) }, on: :after_log validates :field_48, format: { with: /\A\d{1,3}\z|\AR\z/, message: I18n.t("#{ERROR_BASE_KEY}.age.invalid", person_num: 2) }, on: :after_log, if: proc { details_known?(2).zero? } - validates :field_52, format: { with: /\A\d{1,3}\z|\AR\z/, message: I18n.t("#{ERROR_BASE_KEY}.age.invalid", person_num: 3) }, on: :after_log, if: proc { details_known?(3).zero? } - validates :field_56, format: { with: /\A\d{1,3}\z|\AR\z/, message: I18n.t("#{ERROR_BASE_KEY}.age.invalid", person_num: 4) }, on: :after_log, if: proc { details_known?(4).zero? } - validates :field_60, format: { with: /\A\d{1,3}\z|\AR\z/, message: I18n.t("#{ERROR_BASE_KEY}.age.invalid", person_num: 5) }, on: :after_log, if: proc { details_known?(5).zero? } - validates :field_64, format: { with: /\A\d{1,3}\z|\AR\z/, message: I18n.t("#{ERROR_BASE_KEY}.age.invalid", person_num: 6) }, on: :after_log, if: proc { details_known?(6).zero? } - validates :field_68, format: { with: /\A\d{1,3}\z|\AR\z/, message: I18n.t("#{ERROR_BASE_KEY}.age.invalid", person_num: 7) }, on: :after_log, if: proc { details_known?(7).zero? } - validates :field_72, format: { with: /\A\d{1,3}\z|\AR\z/, message: I18n.t("#{ERROR_BASE_KEY}.age.invalid", person_num: 8) }, on: :after_log, if: proc { details_known?(8).zero? } + validates :field_54, format: { with: /\A\d{1,3}\z|\AR\z/, message: I18n.t("#{ERROR_BASE_KEY}.age.invalid", person_num: 3) }, on: :after_log, if: proc { details_known?(3).zero? } + validates :field_60, format: { with: /\A\d{1,3}\z|\AR\z/, message: I18n.t("#{ERROR_BASE_KEY}.age.invalid", person_num: 4) }, on: :after_log, if: proc { details_known?(4).zero? } + validates :field_66, format: { with: /\A\d{1,3}\z|\AR\z/, message: I18n.t("#{ERROR_BASE_KEY}.age.invalid", person_num: 5) }, on: :after_log, if: proc { details_known?(5).zero? } + validates :field_72, format: { with: /\A\d{1,3}\z|\AR\z/, message: I18n.t("#{ERROR_BASE_KEY}.age.invalid", person_num: 6) }, on: :after_log, if: proc { details_known?(6).zero? } + validates :field_78, format: { with: /\A\d{1,3}\z|\AR\z/, message: I18n.t("#{ERROR_BASE_KEY}.age.invalid", person_num: 7) }, on: :after_log, if: proc { details_known?(7).zero? } + validates :field_84, format: { with: /\A\d{1,3}\z|\AR\z/, message: I18n.t("#{ERROR_BASE_KEY}.age.invalid", person_num: 8) }, on: :after_log, if: proc { details_known?(8).zero? } validate :validate_needs_type_present, on: :after_log validate :validate_data_types, on: :after_log @@ -580,12 +574,12 @@ class BulkUpload::Lettings::Year2026::RowParser !general_needs? ? :field_6.to_s : nil, # location # TODO: CLDC-4119: remove location from hash !supported_housing? ? "field_23" : nil, # postcode # TODO: CLDC-4119: add postcode to hash for supported housing !supported_housing? ? "field_24" : nil, # postcode # TODO: CLDC-4119: add postcode to hash for supported housing - "field_42", # age1 - "field_43", # sexrab1 - "field_46", # ecstat1 + "field_41", # age1 + "field_42", # sexrab1 + "field_47", # ecstat1 ) - if [field_124, field_125, field_126, field_127].all?(&:present?) - hash.merge({ "tcharge" => [field_124, field_125, field_126, field_127].sum }) + if [field_142, field_143, field_144, field_145].all?(&:present?) + hash.merge({ "tcharge" => [field_142, field_143, field_144, field_145].sum }) else hash end @@ -594,7 +588,7 @@ class BulkUpload::Lettings::Year2026::RowParser def add_duplicate_found_in_spreadsheet_errors spreadsheet_duplicate_hash.each_key do |field| if field == "tcharge" - %w[field_124 field_125 field_126 field_127].each do |sub_field| + %w[field_142 field_143 field_144 field_145].each do |sub_field| errors.add(sub_field, I18n.t("#{ERROR_BASE_KEY}.spreadsheet_dupe"), category: :setup) end else @@ -703,14 +697,14 @@ private end def validate_nationality - if field_45.present? && !valid_nationality_options.include?(field_45.to_s) - errors.add(:field_45, I18n.t("#{ERROR_BASE_KEY}.nationality.invalid")) + if field_46.present? && !valid_nationality_options.include?(field_46.to_s) + errors.add(:field_46, I18n.t("#{ERROR_BASE_KEY}.nationality.invalid")) end end def validate_reasonpref_reason_values valid_reasonpref_reason_options = %w[0 1] - %w[field_107 field_108 field_109 field_110 field_111].each do |field| + %w[field_122 field_123 field_124 field_125 field_126].each do |field| next unless send(field).present? && !valid_reasonpref_reason_options.include?(send(field).to_s) question_text = QUESTIONS[field.to_sym] @@ -721,9 +715,9 @@ private def validate_prevten_value_when_renewal return unless renewal? - return if field_100.blank? || [6, 30, 31, 32, 33, 34, 35, 38].include?(field_100) + return if field_115.blank? || [6, 30, 31, 32, 33, 34, 35, 38].include?(field_115) - errors.add(:field_100, I18n.t("#{ERROR_BASE_KEY}.prevten.invalid")) + errors.add(:field_115, I18n.t("#{ERROR_BASE_KEY}.prevten.invalid")) end def duplicate_check_fields @@ -748,41 +742,41 @@ private end def validate_no_and_dont_know_disabled_needs_conjunction - if field_83 == 1 && field_84 == 1 - errors.add(:field_83, I18n.t("#{ERROR_BASE_KEY}.housingneeds.no_and_dont_know_disabled_needs_conjunction")) - errors.add(:field_84, I18n.t("#{ERROR_BASE_KEY}.housingneeds.no_and_dont_know_disabled_needs_conjunction")) + if field_98 == 1 && field_99 == 1 + errors.add(:field_98, I18n.t("#{ERROR_BASE_KEY}.housingneeds.no_and_dont_know_disabled_needs_conjunction")) + errors.add(:field_99, I18n.t("#{ERROR_BASE_KEY}.housingneeds.no_and_dont_know_disabled_needs_conjunction")) end end def validate_dont_know_disabled_needs_conjunction - if field_84 == 1 && [field_79, field_80, field_81, field_82].count(1).positive? - %i[field_84 field_79 field_80 field_81 field_82].each do |field| + if field_99 == 1 && [field_94, field_95, field_96, field_97].count(1).positive? + %i[field_99 field_94 field_95 field_96 field_97].each do |field| errors.add(field, I18n.t("#{ERROR_BASE_KEY}.housingneeds.dont_know_disabled_needs_conjunction")) if send(field) == 1 end end end def validate_no_disabled_needs_conjunction - if field_83 == 1 && [field_79, field_80, field_81, field_82].count(1).positive? - %i[field_83 field_79 field_80 field_81 field_82].each do |field| + if field_98 == 1 && [field_94, field_95, field_96, field_97].count(1).positive? + %i[field_98 field_94 field_95 field_96 field_97].each do |field| errors.add(field, I18n.t("#{ERROR_BASE_KEY}.housingneeds.no_disabled_needs_conjunction")) if send(field) == 1 end end end def validate_only_one_housing_needs_type - if [field_79, field_80, field_81].count(1) > 1 - %i[field_79 field_80 field_81].each do |field| + if [field_94, field_95, field_96].count(1) > 1 + %i[field_94 field_95 field_96].each do |field| errors.add(field, I18n.t("#{ERROR_BASE_KEY}.housingneeds_type.only_one_option_permitted")) if send(field) == 1 end end end def validate_no_housing_needs_questions_answered - if [field_79, field_80, field_81, field_82, field_83, field_84].all?(&:blank?) - errors.add(:field_83, I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "anybody with disabled access needs.")) - errors.add(:field_82, I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "other access needs.")) - %i[field_79 field_80 field_81].each do |field| + if [field_94, field_95, field_96, field_97, field_98, field_99].all?(&:blank?) + errors.add(:field_98, I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "anybody with disabled access needs.")) + errors.add(:field_97, I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "other access needs.")) + %i[field_94 field_95 field_96].each do |field| errors.add(field, I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "disabled access needs type.")) end end @@ -790,16 +784,16 @@ private def validate_reasonable_preference_dont_know if rp_dontknow_conflict? - errors.add(:field_111, I18n.t("#{ERROR_BASE_KEY}.reasonpref.conflict.dont_know")) - %i[field_107 field_108 field_109 field_110].each do |field| + errors.add(:field_126, I18n.t("#{ERROR_BASE_KEY}.reasonpref.conflict.dont_know")) + %i[field_122 field_123 field_124 field_125].each do |field| errors.add(field, I18n.t("#{ERROR_BASE_KEY}.reasonpref.conflict.other")) if send(field) == 1 end end end def validate_reasonable_preference_homeless - reason_fields = %i[field_107 field_108 field_109 field_110 field_111] - if field_106 == 1 && reason_fields.all? { |field| attributes[field.to_s].blank? } + reason_fields = %i[field_122 field_123 field_124 field_125 field_126] + if field_121 == 1 && reason_fields.all? { |field| attributes[field.to_s].blank? } reason_fields.each do |field| errors.add(field, I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "reason for reasonable preference.")) end @@ -807,7 +801,7 @@ private end def validate_condition_effects - illness_option_fields = %i[field_94 field_88 field_91 field_86 field_87 field_89 field_90 field_93 field_92 field_95] + illness_option_fields = %i[field_109 field_103 field_106 field_101 field_102 field_104 field_105 field_108 field_107 field_110] if household_no_illness? illness_option_fields.each do |field| if attributes[field.to_s] == 1 @@ -822,12 +816,12 @@ private end def household_no_illness? - field_85 != 1 + field_100 != 1 end def validate_leaving_reason_for_renewal - if renewal? && ![50, 51, 52, 53].include?(field_98) - errors.add(:field_98, I18n.t("#{ERROR_BASE_KEY}.reason.renewal_reason_needed")) + if renewal? && ![50, 51, 52, 53].include?(field_113) + errors.add(:field_113, I18n.t("#{ERROR_BASE_KEY}.reason.renewal_reason_needed")) end end @@ -968,13 +962,13 @@ private end def validate_all_charges_given - return if supported_housing? && field_124 == 1 + return if supported_housing? && field_142 == 1 blank_charge_fields, other_charge_fields = { - field_124: "basic rent", - field_125: "service charge", - field_126: "personal service charge", - field_127: "support charge", + field_142: "basic rent", + field_143: "service charge", + field_144: "personal service charge", + field_145: "support charge", }.partition { |field, _| public_send(field).blank? }.map(&:to_h) blank_charge_fields.each do |field, charge| @@ -990,7 +984,7 @@ private end def all_charges_given? - field_124.present? && field_125.present? && field_126.present? && field_127.present? + field_142.present? && field_143.present? && field_144.present? && field_145.present? end def setup_question?(question) @@ -1011,52 +1005,52 @@ private errors.add(:field_23, error_message) unless supported_housing? # postcode_full # TODO: CLDC-4119: add postcode to error fields for supported housing errors.add(:field_24, error_message) unless supported_housing? # postcode_full # TODO: CLDC-4119: add postcode to error fields for supported housing errors.add(:field_25, error_message) unless supported_housing? # la # TODO: CLDC-4119: add LA to error fields for supported housing - errors.add(:field_42, error_message) # age1 - errors.add(:field_43, error_message) # sexrab1 - errors.add(:field_46, error_message) # ecstat1 - errors.add(:field_122, error_message) unless general_needs? # household_charge - errors.add(:field_124, error_message) # brent - errors.add(:field_125, error_message) # scharge - errors.add(:field_126, error_message) # pscharge - errors.add(:field_127, error_message) # chcharge + errors.add(:field_41, error_message) # age1 + errors.add(:field_42, error_message) # sexrab1 + errors.add(:field_47, error_message) # ecstat1 + errors.add(:field_140, error_message) unless general_needs? # household_charge + errors.add(:field_142, error_message) # brent + errors.add(:field_143, error_message) # scharge + errors.add(:field_144, error_message) # pscharge + errors.add(:field_145, error_message) # chcharge end end def field_referral_register_la_valid? if owning_organisation&.la? - [1, 2, 3, 4].include?(field_116) + [1, 2, 3, 4].include?(field_131) else - field_116.blank? + field_131.blank? end end def field_referral_register_prp_valid? if owning_organisation&.prp? - [5, 6, 7, 8, 9].include?(field_146) + [5, 6, 7, 8, 9].include?(field_132) else - field_146.blank? + field_132.blank? end end def field_referral_noms_valid? - case field_146 + case field_132 when 6 - [1, 2, 3, 4].include?(field_147) + [1, 2, 3, 4].include?(field_133) when 7 - [5, 6, 7, 8].include?(field_147) + [5, 6, 7, 8].include?(field_133) else - field_147.blank? + field_133.blank? end end def field_referral_org_valid? - case field_147 + case field_133 when 1 - [1, 2, 3, 4, 5, 6, 7, 8, 9, 10].include?(field_148) + [1, 2, 3, 4, 5, 6, 7, 8, 9, 10].include?(field_134) when 7 - [11, 12, 13, 14, 15, 16, 17, 18, 19, 20].include?(field_148) + [11, 12, 13, 14, 15, 16, 17, 18, 19, 20].include?(field_134) else - field_148.blank? + field_134.blank? end end @@ -1068,7 +1062,7 @@ private return if renewal? return if referral_fields_valid? - %i[field_116 field_146 field_147 field_148].each do |field| + %i[field_131 field_132 field_133 field_134].each do |field| errors.add(field, I18n.t("#{ERROR_BASE_KEY}.referral.invalid_option")) end end @@ -1094,140 +1088,139 @@ private rent_type: %i[field_11], startdate: %i[field_8 field_9 field_10], unittype_gn: %i[field_26], - builtype: %i[field_27], - wchair: %i[field_28], - beds: %i[field_29], - joint: %i[field_37], - startertenancy: %i[field_38], - tenancy: %i[field_39], - tenancyother: %i[field_40], - tenancylength: %i[field_41], + wchair: %i[field_27], + beds: %i[field_28], + joint: %i[field_36], + startertenancy: %i[field_37], + tenancy: %i[field_38], + tenancyother: %i[field_39], + tenancylength: %i[field_40], declaration: %i[field_15], - age1_known: %i[field_42], - age1: %i[field_42], + age1_known: %i[field_41], + age1: %i[field_41], age2_known: %i[field_48], age2: %i[field_48], - age3_known: %i[field_52], - age3: %i[field_52], - age4_known: %i[field_56], - age4: %i[field_56], - age5_known: %i[field_60], - age5: %i[field_60], - age6_known: %i[field_64], - age6: %i[field_64], - age7_known: %i[field_68], - age7: %i[field_68], - age8_known: %i[field_72], - age8: %i[field_72], - - sexrab1: %i[field_43], - sexrab2: %i[field_49], - sexrab3: %i[field_53], - sexrab4: %i[field_57], - sexrab5: %i[field_61], - sexrab6: %i[field_65], - sexrab7: %i[field_69], - sexrab8: %i[field_73], - - ethnic_group: %i[field_44], - ethnic: %i[field_44], - nationality_all: %i[field_45], - nationality_all_group: %i[field_45], - - relat2: %i[field_47], - relat3: %i[field_51], - relat4: %i[field_55], - relat5: %i[field_59], - relat6: %i[field_63], - relat7: %i[field_67], - relat8: %i[field_71], - - ecstat1: %i[field_46], - ecstat2: %i[field_50], - ecstat3: %i[field_54], - ecstat4: %i[field_58], - ecstat5: %i[field_62], - ecstat6: %i[field_66], - ecstat7: %i[field_70], - ecstat8: %i[field_74], - - armedforces: %i[field_75], - leftreg: %i[field_76], - reservist: %i[field_77], - preg_occ: %i[field_78], - housingneeds: %i[field_78], - - illness: %i[field_85], - - layear: %i[field_96], - waityear: %i[field_97], - reason: %i[field_98], - reasonother: %i[field_99], - prevten: %i[field_100], - homeless: %i[field_101], - - prevloc: %i[field_105], - previous_la_known: %i[field_105], - ppcodenk: %i[field_102], - ppostcode_full: %i[field_103 field_104], - - reasonpref: %i[field_106], - rp_homeless: %i[field_107], - rp_insan_unsat: %i[field_108], - rp_medwel: %i[field_109], - rp_hardship: %i[field_110], - rp_dontknow: %i[field_111], - - cbl: %i[field_112], - cap: %i[field_113], - chr: %i[field_114], - accessible_register: %i[field_115], - letting_allocation: %i[field_112 field_113 field_114 field_115], - - referral_register: %i[field_116 field_146], - referral_noms: %i[field_147], - referral_org: %i[field_148], - - net_income_known: %i[field_117], - incfreq: %i[field_118], - earnings: %i[field_119], - hb: %i[field_120], - benefits: %i[field_121], - - period: %i[field_123], - brent: %i[field_124], - scharge: %i[field_125], - pscharge: %i[field_126], - supcharg: %i[field_127], - tcharge: %i[field_124 field_125 field_126 field_127], - household_charge: %i[field_122], - hbrentshortfall: %i[field_128], - tshortfall: %i[field_129], + age3_known: %i[field_54], + age3: %i[field_54], + age4_known: %i[field_60], + age4: %i[field_60], + age5_known: %i[field_66], + age5: %i[field_66], + age6_known: %i[field_72], + age6: %i[field_72], + age7_known: %i[field_78], + age7: %i[field_78], + age8_known: %i[field_84], + age8: %i[field_84], + + sexrab1: %i[field_42], + sexrab2: %i[field_50], + sexrab3: %i[field_56], + sexrab4: %i[field_62], + sexrab5: %i[field_68], + sexrab6: %i[field_74], + sexrab7: %i[field_80], + sexrab8: %i[field_86], + + ethnic_group: %i[field_45], + ethnic: %i[field_45], + nationality_all: %i[field_46], + nationality_all_group: %i[field_46], + + relat2: %i[field_49], + relat3: %i[field_55], + relat4: %i[field_61], + relat5: %i[field_67], + relat6: %i[field_73], + relat7: %i[field_79], + relat8: %i[field_85], + + ecstat1: %i[field_47], + ecstat2: %i[field_53], + ecstat3: %i[field_59], + ecstat4: %i[field_65], + ecstat5: %i[field_71], + ecstat6: %i[field_77], + ecstat7: %i[field_83], + ecstat8: %i[field_89], + + armedforces: %i[field_90], + leftreg: %i[field_91], + reservist: %i[field_92], + preg_occ: %i[field_93], + housingneeds: %i[field_93], + + illness: %i[field_100], + + layear: %i[field_111], + waityear: %i[field_112], + reason: %i[field_113], + reasonother: %i[field_114], + prevten: %i[field_115], + homeless: %i[field_116], + + prevloc: %i[field_120], + previous_la_known: %i[field_120], + ppcodenk: %i[field_117], + ppostcode_full: %i[field_118 field_119], + + reasonpref: %i[field_121], + rp_homeless: %i[field_122], + rp_insan_unsat: %i[field_123], + rp_medwel: %i[field_124], + rp_hardship: %i[field_125], + rp_dontknow: %i[field_126], + + cbl: %i[field_127], + cap: %i[field_128], + chr: %i[field_129], + accessible_register: %i[field_130], + letting_allocation: %i[field_127 field_128 field_129 field_130], + + referral_register: %i[field_131 field_132], + referral_noms: %i[field_133], + referral_org: %i[field_134], + + net_income_known: %i[field_135], + incfreq: %i[field_136], + earnings: %i[field_137], + hb: %i[field_138], + benefits: %i[field_139], + + period: %i[field_141], + brent: %i[field_142], + scharge: %i[field_143], + pscharge: %i[field_144], + supcharg: %i[field_145], + tcharge: %i[field_142 field_143 field_144 field_145], + household_charge: %i[field_140], + hbrentshortfall: %i[field_146], + tshortfall: %i[field_147], unitletas: %i[field_17], rsnvac: %i[field_16], - sheltered: %i[field_36], - - illness_type_1: %i[field_94], - illness_type_2: %i[field_88], - illness_type_3: %i[field_91], - illness_type_4: %i[field_86], - illness_type_5: %i[field_87], - illness_type_6: %i[field_89], - illness_type_7: %i[field_90], - illness_type_8: %i[field_93], - illness_type_9: %i[field_92], - illness_type_10: %i[field_95], + sheltered: %i[field_35], + + illness_type_1: %i[field_109], + illness_type_2: %i[field_103], + illness_type_3: %i[field_106], + illness_type_4: %i[field_101], + illness_type_5: %i[field_102], + illness_type_6: %i[field_104], + illness_type_7: %i[field_105], + illness_type_8: %i[field_108], + illness_type_9: %i[field_107], + illness_type_10: %i[field_110], irproduct_other: %i[field_12], propcode: %i[field_14], - majorrepairs: %i[field_33 field_34 field_35], - mrcdate: %i[field_33 field_34 field_35], + majorrepairs: %i[field_32 field_33 field_34], + mrcdate: %i[field_32 field_33 field_34], - voiddate: %i[field_30 field_31 field_32], + voiddate: %i[field_29 field_30 field_31], uprn: [:field_18], address_line1: [:field_19], @@ -1236,22 +1229,23 @@ private county: [:field_22], uprn_selection: [:field_19], - gender_same_as_sex1: %i[field_130], - gender_same_as_sex2: %i[field_132], - gender_same_as_sex3: %i[field_134], - gender_same_as_sex4: %i[field_136], - gender_same_as_sex5: %i[field_138], - gender_same_as_sex6: %i[field_140], - gender_same_as_sex7: %i[field_142], - gender_same_as_sex8: %i[field_144], - gender_description1: %i[field_131], - gender_description2: %i[field_133], - gender_description3: %i[field_135], - gender_description4: %i[field_137], - gender_description5: %i[field_139], - gender_description6: %i[field_141], - gender_description7: %i[field_143], - gender_description8: %i[field_145], + gender_same_as_sex1: %i[field_43], + gender_description1: %i[field_44], + gender_same_as_sex2: %i[field_51], + gender_description2: %i[field_52], + gender_same_as_sex3: %i[field_57], + gender_description3: %i[field_58], + gender_same_as_sex4: %i[field_63], + gender_description4: %i[field_64], + gender_same_as_sex5: %i[field_69], + gender_description5: %i[field_70], + gender_same_as_sex6: %i[field_75], + gender_description6: %i[field_76], + gender_same_as_sex7: %i[field_81], + gender_description7: %i[field_82], + gender_same_as_sex8: %i[field_87], + gender_description8: %i[field_88], + }.compact end @@ -1279,70 +1273,69 @@ private attributes["rent_type"] = RENT_TYPE_BU_MAPPING[field_11] attributes["startdate"] = startdate attributes["unittype_gn"] = field_26 - attributes["builtype"] = field_27 - attributes["wchair"] = field_28 - attributes["beds"] = field_26 == 2 ? 1 : field_29 - attributes["joint"] = field_37 - attributes["startertenancy"] = field_38 - attributes["tenancy"] = field_39 - attributes["tenancyother"] = field_40 - attributes["tenancylength"] = field_41 + attributes["wchair"] = field_27 + attributes["beds"] = field_26 == 2 ? 1 : field_28 + attributes["joint"] = field_36 + attributes["startertenancy"] = field_37 + attributes["tenancy"] = field_38 + attributes["tenancyother"] = field_39 + attributes["tenancylength"] = field_40 attributes["declaration"] = field_15 attributes["age1_known"] = age1_known? - attributes["age1"] = field_42 if attributes["age1_known"]&.zero? && field_42&.match(/\A\d{1,3}\z|\AR\z/) + attributes["age1"] = field_41 if attributes["age1_known"]&.zero? && field_41&.match(/\A\d{1,3}\z|\AR\z/) attributes["age2_known"] = age2_known? attributes["age2"] = field_48 if attributes["age2_known"]&.zero? && field_48&.match(/\A\d{1,3}\z|\AR\z/) attributes["age3_known"] = age3_known? - attributes["age3"] = field_52 if attributes["age3_known"]&.zero? && field_52&.match(/\A\d{1,3}\z|\AR\z/) + attributes["age3"] = field_54 if attributes["age3_known"]&.zero? && field_54&.match(/\A\d{1,3}\z|\AR\z/) attributes["age4_known"] = age4_known? - attributes["age4"] = field_56 if attributes["age4_known"]&.zero? && field_56&.match(/\A\d{1,3}\z|\AR\z/) + attributes["age4"] = field_60 if attributes["age4_known"]&.zero? && field_60&.match(/\A\d{1,3}\z|\AR\z/) attributes["age5_known"] = age5_known? - attributes["age5"] = field_60 if attributes["age5_known"]&.zero? && field_60&.match(/\A\d{1,3}\z|\AR\z/) + attributes["age5"] = field_66 if attributes["age5_known"]&.zero? && field_66&.match(/\A\d{1,3}\z|\AR\z/) attributes["age6_known"] = age6_known? - attributes["age6"] = field_64 if attributes["age6_known"]&.zero? && field_64&.match(/\A\d{1,3}\z|\AR\z/) + attributes["age6"] = field_72 if attributes["age6_known"]&.zero? && field_72&.match(/\A\d{1,3}\z|\AR\z/) attributes["age7_known"] = age7_known? - attributes["age7"] = field_68 if attributes["age7_known"]&.zero? && field_68&.match(/\A\d{1,3}\z|\AR\z/) + attributes["age7"] = field_78 if attributes["age7_known"]&.zero? && field_78&.match(/\A\d{1,3}\z|\AR\z/) attributes["age8_known"] = age8_known? - attributes["age8"] = field_72 if attributes["age8_known"]&.zero? && field_72&.match(/\A\d{1,3}\z|\AR\z/) + attributes["age8"] = field_84 if attributes["age8_known"]&.zero? && field_84&.match(/\A\d{1,3}\z|\AR\z/) - attributes["sexrab1"] = field_43 - attributes["sexrab2"] = field_49 - attributes["sexrab3"] = field_53 - attributes["sexrab4"] = field_57 - attributes["sexrab5"] = field_61 - attributes["sexrab6"] = field_65 - attributes["sexrab7"] = field_69 - attributes["sexrab8"] = field_73 + attributes["sexrab1"] = field_42 + attributes["sexrab2"] = field_50 + attributes["sexrab3"] = field_56 + attributes["sexrab4"] = field_62 + attributes["sexrab5"] = field_68 + attributes["sexrab6"] = field_74 + attributes["sexrab7"] = field_80 + attributes["sexrab8"] = field_86 attributes["ethnic_group"] = ethnic_group_from_ethnic - attributes["ethnic"] = field_44 - attributes["nationality_all"] = field_45 if field_45.present? && valid_nationality_options.include?(field_45.to_s) + attributes["ethnic"] = field_45 + attributes["nationality_all"] = field_46 if field_46.present? && valid_nationality_options.include?(field_46.to_s) attributes["nationality_all_group"] = nationality_group(attributes["nationality_all"]) - attributes["relat2"] = relationship_from_input_value(field_47) - attributes["relat3"] = relationship_from_input_value(field_51) - attributes["relat4"] = relationship_from_input_value(field_55) - attributes["relat5"] = relationship_from_input_value(field_59) - attributes["relat6"] = relationship_from_input_value(field_63) - attributes["relat7"] = relationship_from_input_value(field_67) - attributes["relat8"] = relationship_from_input_value(field_71) - - attributes["ecstat1"] = field_46 - attributes["ecstat2"] = field_50 - attributes["ecstat3"] = field_54 - attributes["ecstat4"] = field_58 - attributes["ecstat5"] = field_62 - attributes["ecstat6"] = field_66 - attributes["ecstat7"] = field_70 - attributes["ecstat8"] = field_74 + attributes["relat2"] = relationship_from_input_value(field_49) + attributes["relat3"] = relationship_from_input_value(field_55) + attributes["relat4"] = relationship_from_input_value(field_61) + attributes["relat5"] = relationship_from_input_value(field_67) + attributes["relat6"] = relationship_from_input_value(field_73) + attributes["relat7"] = relationship_from_input_value(field_79) + attributes["relat8"] = relationship_from_input_value(field_85) + + attributes["ecstat1"] = field_47 + attributes["ecstat2"] = field_53 + attributes["ecstat3"] = field_59 + attributes["ecstat4"] = field_65 + attributes["ecstat5"] = field_71 + attributes["ecstat6"] = field_77 + attributes["ecstat7"] = field_83 + attributes["ecstat8"] = field_89 attributes["details_known_2"] = details_known?(2) attributes["details_known_3"] = details_known?(3) @@ -1352,36 +1345,36 @@ private attributes["details_known_7"] = details_known?(7) attributes["details_known_8"] = details_known?(8) - attributes["armedforces"] = field_75 + attributes["armedforces"] = field_90 attributes["leftreg"] = leftreg - attributes["reservist"] = field_77 + attributes["reservist"] = field_92 - attributes["preg_occ"] = field_78 + attributes["preg_occ"] = field_93 attributes["housingneeds"] = housingneeds attributes["housingneeds_type"] = housingneeds_type attributes["housingneeds_other"] = housingneeds_other - attributes["illness"] = field_85 + attributes["illness"] = field_100 - attributes["layear"] = field_96 - attributes["waityear"] = field_97 - attributes["reason"] = field_98 - attributes["reasonother"] = field_99 if reason_is_other? - attributes["prevten"] = field_100 - attributes["homeless"] = field_101 + attributes["layear"] = field_111 + attributes["waityear"] = field_112 + attributes["reason"] = field_113 + attributes["reasonother"] = field_114 if reason_is_other? + attributes["prevten"] = field_115 + attributes["homeless"] = field_116 attributes["prevloc"] = prevloc attributes["previous_la_known"] = previous_la_known attributes["ppcodenk"] = ppcodenk attributes["ppostcode_full"] = ppostcode_full - attributes["reasonpref"] = field_106 - attributes["rp_homeless"] = field_107 unless rp_dontknow_conflict? - attributes["rp_insan_unsat"] = field_108 unless rp_dontknow_conflict? - attributes["rp_medwel"] = field_109 unless rp_dontknow_conflict? - attributes["rp_hardship"] = field_110 unless rp_dontknow_conflict? - attributes["rp_dontknow"] = field_111 unless rp_dontknow_conflict? + attributes["reasonpref"] = field_121 + attributes["rp_homeless"] = field_122 unless rp_dontknow_conflict? + attributes["rp_insan_unsat"] = field_123 unless rp_dontknow_conflict? + attributes["rp_medwel"] = field_124 unless rp_dontknow_conflict? + attributes["rp_hardship"] = field_125 unless rp_dontknow_conflict? + attributes["rp_dontknow"] = field_126 unless rp_dontknow_conflict? attributes["cbl"] = cbl attributes["chr"] = chr @@ -1395,36 +1388,36 @@ private attributes["net_income_known"] = net_income_known attributes["earnings"] = earnings - attributes["incfreq"] = field_118 - attributes["hb"] = field_120 - attributes["benefits"] = field_121 - - attributes["period"] = field_123 - attributes["brent"] = field_124 if all_charges_given? - attributes["scharge"] = field_125 if all_charges_given? - attributes["pscharge"] = field_126 if all_charges_given? - attributes["supcharg"] = field_127 if all_charges_given? - attributes["household_charge"] = supported_housing? ? field_122 : nil - attributes["hbrentshortfall"] = field_128 + attributes["incfreq"] = field_136 + attributes["hb"] = field_138 + attributes["benefits"] = field_139 + + attributes["period"] = field_141 + attributes["brent"] = field_142 if all_charges_given? + attributes["scharge"] = field_143 if all_charges_given? + attributes["pscharge"] = field_144 if all_charges_given? + attributes["supcharg"] = field_145 if all_charges_given? + attributes["household_charge"] = supported_housing? ? field_140 : nil + attributes["hbrentshortfall"] = field_146 attributes["tshortfall_known"] = tshortfall_known - attributes["tshortfall"] = field_129 + attributes["tshortfall"] = field_147 attributes["hhmemb"] = hhmemb attributes["unitletas"] = field_17 attributes["rsnvac"] = rsnvac - attributes["sheltered"] = field_36 - - attributes["illness_type_1"] = field_94 - attributes["illness_type_2"] = field_88 - attributes["illness_type_3"] = field_91 - attributes["illness_type_4"] = field_86 - attributes["illness_type_5"] = field_87 - attributes["illness_type_6"] = field_89 - attributes["illness_type_7"] = field_90 - attributes["illness_type_8"] = field_93 - attributes["illness_type_9"] = field_92 - attributes["illness_type_10"] = field_95 + attributes["sheltered"] = field_35 + + attributes["illness_type_1"] = field_109 + attributes["illness_type_2"] = field_103 + attributes["illness_type_3"] = field_106 + attributes["illness_type_4"] = field_101 + attributes["illness_type_5"] = field_102 + attributes["illness_type_6"] = field_104 + attributes["illness_type_7"] = field_105 + attributes["illness_type_8"] = field_108 + attributes["illness_type_9"] = field_107 + attributes["illness_type_10"] = field_110 attributes["irproduct_other"] = field_12 if RENT_TYPE_BU_MAPPING[field_11] == 5 @@ -1459,22 +1452,22 @@ private attributes["postcode_full_input"] = postcode_full attributes["select_best_address_match"] = true if field_18.blank? - attributes["gender_same_as_sex1"] = field_130 - attributes["gender_description1"] = field_131 - attributes["gender_same_as_sex2"] = field_132 - attributes["gender_description2"] = field_133 - attributes["gender_same_as_sex3"] = field_134 - attributes["gender_description3"] = field_135 - attributes["gender_same_as_sex4"] = field_136 - attributes["gender_description4"] = field_137 - attributes["gender_same_as_sex5"] = field_138 - attributes["gender_description5"] = field_139 - attributes["gender_same_as_sex6"] = field_140 - attributes["gender_description6"] = field_141 - attributes["gender_same_as_sex7"] = field_142 - attributes["gender_description7"] = field_143 - attributes["gender_same_as_sex8"] = field_144 - attributes["gender_description8"] = field_145 + attributes["gender_same_as_sex1"] = field_43 + attributes["gender_description1"] = field_44 + attributes["gender_same_as_sex2"] = field_51 + attributes["gender_description2"] = field_52 + attributes["gender_same_as_sex3"] = field_57 + attributes["gender_description3"] = field_58 + attributes["gender_same_as_sex4"] = field_63 + attributes["gender_description4"] = field_64 + attributes["gender_same_as_sex5"] = field_69 + attributes["gender_description5"] = field_70 + attributes["gender_same_as_sex6"] = field_75 + attributes["gender_description6"] = field_76 + attributes["gender_same_as_sex7"] = field_81 + attributes["gender_description7"] = field_82 + attributes["gender_same_as_sex8"] = field_87 + attributes["gender_description8"] = field_88 attributes end @@ -1538,9 +1531,9 @@ private end def ethnic_group_from_ethnic - return nil if field_44.blank? + return nil if field_45.blank? - case field_44 + case field_45 when 1, 2, 3, 18, 20 0 when 4, 5, 6, 7 @@ -1557,19 +1550,19 @@ private end def age1_known? - return 1 if field_42 == "R" + return 1 if field_41 == "R" 0 end [ { person: 2, field: :field_48 }, - { person: 3, field: :field_52 }, - { person: 4, field: :field_56 }, - { person: 5, field: :field_60 }, - { person: 6, field: :field_64 }, - { person: 7, field: :field_68 }, - { person: 8, field: :field_72 }, + { person: 3, field: :field_54 }, + { person: 4, field: :field_60 }, + { person: 5, field: :field_66 }, + { person: 6, field: :field_72 }, + { person: 7, field: :field_78 }, + { person: 8, field: :field_84 }, ].each do |hash| define_method("age#{hash[:person]}_known?") do return 1 if public_send(hash[:field]) == "R" @@ -1583,53 +1576,53 @@ private end def person_2_present? - field_47.present? || field_48.present? || field_49.present? || field_132.present? || field_133.present? + field_49.present? || field_48.present? || field_50.present? || field_51.present? || field_52.present? end def person_3_present? - field_51.present? || field_52.present? || field_53.present? || field_134.present? || field_135.present? + field_55.present? || field_54.present? || field_56.present? || field_57.present? || field_58.present? end def person_4_present? - field_55.present? || field_56.present? || field_57.present? || field_136.present? || field_137.present? + field_61.present? || field_60.present? || field_62.present? || field_63.present? || field_64.present? end def person_5_present? - field_59.present? || field_60.present? || field_61.present? || field_138.present? || field_139.present? + field_67.present? || field_66.present? || field_68.present? || field_69.present? || field_70.present? end def person_6_present? - field_63.present? || field_64.present? || field_65.present? || field_140.present? || field_141.present? + field_73.present? || field_72.present? || field_74.present? || field_75.present? || field_76.present? end def person_7_present? - field_67.present? || field_68.present? || field_69.present? || field_142.present? || field_143.present? + field_79.present? || field_78.present? || field_80.present? || field_81.present? || field_82.present? end def person_8_present? - field_71.present? || field_72.present? || field_73.present? || field_144.present? || field_145.present? + field_85.present? || field_84.present? || field_86.present? || field_87.present? || field_88.present? end def leftreg - field_76 + field_91 end def housingneeds - if field_83 == 1 + if field_98 == 1 2 - elsif field_84 == 1 + elsif field_99 == 1 3 - elsif field_83.blank? || field_83&.zero? + elsif field_98.blank? || field_98&.zero? 1 end end def housingneeds_type - if field_79 == 1 + if field_94 == 1 0 - elsif field_80 == 1 + elsif field_95 == 1 1 - elsif field_81 == 1 + elsif field_96 == 1 2 else 3 @@ -1637,13 +1630,13 @@ private end def housingneeds_other - return 1 if field_82 == 1 + return 1 if field_97 == 1 - 0 if [field_79, field_80, field_81].include?(1) + 0 if [field_94, field_95, field_96].include?(1) end def prevloc - field_105 + field_120 end def previous_la_known @@ -1651,7 +1644,7 @@ private end def ppcodenk - case field_102 + case field_117 when 1 0 when 2 @@ -1660,11 +1653,11 @@ private end def ppostcode_full - "#{field_103} #{field_104}".strip.gsub(/\s+/, " ") + "#{field_118} #{field_119}".strip.gsub(/\s+/, " ") end def cbl - case field_112 + case field_127 when 2 0 when 1 @@ -1673,7 +1666,7 @@ private end def cap - case field_113 + case field_128 when 2 0 when 1 @@ -1682,7 +1675,7 @@ private end def chr - case field_114 + case field_129 when 2 0 when 1 @@ -1691,7 +1684,7 @@ private end def accessible_register - case field_115 + case field_130 when 2 0 when 1 @@ -1704,7 +1697,7 @@ private end def net_income_known - case field_117 + case field_135 when 1 0 when 2 @@ -1715,11 +1708,11 @@ private end def earnings - field_119.presence&.round + field_137.presence&.round end def tshortfall_known - field_128 == 1 ? 0 : 1 + field_146 == 1 ? 0 : 1 end def hhmemb @@ -1739,15 +1732,15 @@ private end def mrcdate - year = field_35.to_s.strip.length.between?(1, 2) ? field_35 + 2000 : field_35 - Date.new(year, field_34, field_33) if field_35.present? && field_34.present? && field_33.present? + year = field_34.to_s.strip.length.between?(1, 2) ? field_34 + 2000 : field_34 + Date.new(year, field_33, field_32) if field_34.present? && field_33.present? && field_32.present? rescue Date::Error Date.new end def voiddate - year = field_32.to_s.strip.length.between?(1, 2) ? field_32 + 2000 : field_32 - Date.new(year, field_31, field_30) if field_32.present? && field_31.present? && field_30.present? + year = field_31.to_s.strip.length.between?(1, 2) ? field_31 + 2000 : field_31 + Date.new(year, field_30, field_29) if field_31.present? && field_30.present? && field_29.present? rescue Date::Error Date.new end @@ -1774,7 +1767,7 @@ private end def reason_is_other? - field_98 == 20 + field_113 == 20 end def bulk_upload_organisation @@ -1793,10 +1786,10 @@ private end def rp_dontknow_conflict? - other_reason_fields = %i[field_107 field_108 field_109 field_110] - if field_106 == 1 + other_reason_fields = %i[field_122 field_123 field_124 field_125] + if field_121 == 1 selected_reasons = other_reason_fields.select { |field| send(field) == 1 } - dont_know_selected = field_111 == 1 + dont_know_selected = field_126 == 1 return true if selected_reasons.any? && dont_know_selected end @@ -1812,9 +1805,9 @@ private return unless referral_fields_valid? if owning_organisation.la? - field_116 + field_131 else - field_146 + field_132 end end @@ -1823,7 +1816,7 @@ private return unless referral_fields_valid? if owning_organisation.prp? - field_147 + field_133 end end @@ -1832,7 +1825,7 @@ private return unless referral_fields_valid? if owning_organisation.prp? - field_148 + field_134 end end end diff --git a/spec/fixtures/files/2026_27_lettings_bulk_upload.csv b/spec/fixtures/files/2026_27_lettings_bulk_upload.csv index 4b66a7c71..2c9d3dc38 100644 --- a/spec/fixtures/files/2026_27_lettings_bulk_upload.csv +++ b/spec/fixtures/files/2026_27_lettings_bulk_upload.csv @@ -1,5 +1,5 @@ -Section,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 scheme does this letting belong to?,Which location is this letting for?,Is this letting a renewal of social housing to the same tenant in the same property?,What is the tenancy start date? - day DD,What is the tenancy start date? - month MM,What is the tenancy start date? - year YY,What is the rent type?,Which 'Other' type of Intermediate Rent is this letting?,What is the tenant code?,What is the property reference?,Has the tenant seen or been given access to the MHCLG privacy notice?,What is the reason for the property being vacant?,What type was the property most recently let as?,"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 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 YY,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 property older people's housing?,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?,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?,Is person 2 the partner of 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?,Is person 3 the partner of 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?,Is person 4 the partner of 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?,Is person 5 the partner of 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?,Is person 6 the partner of 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?,Is person 7 the partner of 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?,Is person 8 the partner of 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 +Section,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 scheme does this letting belong to?,Which location is this letting for?,Is this letting a renewal of social housing to the same tenant in the same property?,What is the tenancy start date? - day DD,What is the tenancy start date? - month MM,What is the tenancy start date? - year YY,What is the rent type?,Which 'Other' type of Intermediate Rent is this letting?,What is the tenant code?,What is the property reference?,Has the tenant seen or been given access to the MHCLG privacy notice?,What is the reason for the property being vacant?,What type was the property most recently let as?,"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 of unit 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 YY,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 property older people's housing?,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?,What is the lead tenant’s age?,What is the lead tenant's sex?,Is the gender the lead tenant identifies with the same as their sex registered at birth?,"If 'No', enter 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 age?,Is person 2 the partner of the lead tenant?,What is person 2's sex?,Is the gender the person 2 identifies with the same as their sex registered at birth?,"If 'No', enter person 2's gender identity",Which of these best describes person 2's working situation?,What is person 3's age?,Is person 3 the partner of the lead tenant?,What is person 3's sex?,Is the gender the person 3 identifies with the same as their sex registered at birth?,"If 'No', enter person 3's gender identity",Which of these best describes person 3's working situation?,What is person 4's age?,Is person 4 the partner of the lead tenant?,What is person 4's sex?,Is the gender the person 4 identifies with the same as their sex registered at birth?,"If 'No', enter person 4's gender identity",Which of these best describes person 4's working situation?,What is person 5's age?,Is person 5 the partner of the lead tenant?,What is person 5's sex?,Is the gender the person 5 identifies with the same as their sex registered at birth?,"If 'No', enter person 5's gender identity",Which of these best describes person 5's working situation?,What is person 6's age?,Is person 6 the partner of the lead tenant?,What is person 6's sex?,Is the gender the person 6 identifies with the same as their sex registered at birth?,"If 'No', enter person 6's gender identity",Which of these best describes person 6's working situation?,What is person 7's age?,Is person 7 the partner of the lead tenant?,What is person 7's sex?,Is the gender the person 7 identifies with the same as their sex registered at birth?,"If 'No', enter person 7's gender identity",Which of these best describes person 7's working situation?,What is person 8's age?,Is person 8 the partner of the lead tenant?,What is person 8's sex?,Is the gender the person 8 identifies with the same as their sex registered at birth?,"If 'No', enter 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 @@ -29,59 +29,63 @@ Common Allocations Policy (CAP)","How was this letting allocated? Common Housing Register (CHR)","How was this letting allocated? -Accessible Housing Register",What was the source of referral for this letting? - LA properties,Do you know the household's combined total income after tax?,How often does the household receive income?,How much income does the household have in total?,Is the tenant likely to be receiving any of these housing-related benefits?,"How much of the household's income is from Universal Credit, state pensions or benefits?",Does the household pay rent or other charges for the accommodation?,How often does the household pay rent and other charges?,What is the basic rent?,What is the service charge?,What is the personal service charge?,What is the support charge?,"After the household has received any housing-related benefits, will they still need to pay for rent and charges?",What do you expect the outstanding amount to be?,What was the lead tenant's sex at birth?,What was person 2's sex registered at birth?,What was person 3's sex registered at birth?,What was person 4's sex registered at birth?,What was person 5's sex registered at birth?,What was person 6's sex registered at birth?,What was person 7's sex registered at birth?,What was person 8's sex registered at birth?,Is the gender the lead tenant identifies with the same as their sex registered at birth?,"If 'No', enter lead tenant's gender identity",Is the gender the person 2 identifies with the same as their sex registered at birth?,"If 'No', enter person 2's gender identity",Is the gender the person 3 identifies with the same as their sex registered at birth?,"If 'No', enter person 3's gender identity",Is the gender the person 4 identifies with the same as their sex registered at birth?,"If 'No', enter person 4's gender identity",Is the gender the person 5 identifies with the same as their sex registered at birth?,"If 'No', enter person 5's gender identity",Is the gender the person 6 identifies with the same as their sex registered at birth?,"If 'No', enter person 6's gender identity",Is the gender the person 7 identifies with the same as their sex registered at birth?,"If 'No', enter person 7's gender identity",Is the gender the person 8 identifies with the same as their sex registered at birth?,"If 'No', enter person 8's gender identity",What was the source of referral for this letting? - PRP properties part 1,What was the source of referral for this letting? - PRP properties part 2,What was the source of referral for this letting? - PRP properties part 3 -Additional info,"You can find the org ID on the CORE service under 'Stock owners' or, if your organisation is the stock owner, under 'About your organisation'","You can find the org ID on the CORE service under 'Managing agents' or, if your organisation is the managing agent, under 'About your organisation'","If left empty, the letting log will be assigned to the account used to upload the log.","General needs housing includes both self-contained and shared housing without support or specific adaptations. Supported housing includes direct access hostels, group homes, residential care and nursing homes.","Scheme code. Include the 'S' at the beginning if it has one. +Accessible Housing Register",What was the source of referral for this letting? - LA properties,What was the source of referral for this letting? - PRP properties part 1,What was the source of referral for this letting? - PRP properties part 2,What was the source of referral for this letting? - PRP properties part 3,Do you know the household's combined total income after tax?,How often does the household receive income?,How much income does the household have in total?,Is the tenant likely to be receiving any of these housing-related benefits?,"How much of the household's income is from Universal Credit, state pensions or benefits?",Does the household pay rent or other charges for the accommodation?,How often does the household pay rent and other charges?,What is the basic rent?,What is the service charge?,What is the personal service charge?,What is the support charge?,"After the household has received any housing-related benefits, will they still need to pay for rent and charges?",What do you expect the outstanding amount to be? +Additional info,"You can find the org ID on the CORE service under 'Stock owners' or, if your organisation is the stock owner, under 'About your organisation'","You can find the org ID on the CORE service under 'Managing agents' or, if your organisation is the managing agent, under 'About your organisation'","If left empty, the letting log will be assigned to the account used to upload the log.","General needs housing includes both self-contained and shared housing without support or specific adaptations. + +Supported housing is housing with special design facilities or features targeted at a specific client group requiring support, for example housing designed for older people, sheltered accommodation, extra care housing. It can include direct access hostels, group homes, and purpose-built self-contained housing. We do not require CORE logs for residential care or nursing homes.","Scheme code. Include the 'S' at the beginning if it has one. You can find the scheme code on the CORE service under 'Schemes', either by searching for the specific scheme or downloading a csv.","Location code. You can find the location code on the CORE service under 'Schemes', either by searching for the specific location or downloading a csv.","If the property was previously being used as temporary accommodation, then answer 'no'.",,,,See specification for definitions,,This is how you usually refer to this tenancy on your own systems.,This is how you usually refer to this property on your own systems.,"Make sure the lead tenant has seen or been given access to the Ministry of Housing, Communities and Local Government (MHCLG) privacy notice before completing this log. This is a legal requirement under data protection legislation.","Internal transfer - Where a tenant moved from one social housing property to another property. Their landlord may be the same or may have changed. Renewal of a fixed term tenancy - to the same tenant in the same property, except if was previously used as temporary accommodation.",This is the rent type of the previous tenancy in this property.,"The Unique Property Reference Number (UPRN) is a unique number system created by Ordnance Survey and used by housing providers and various industries across the UK. An example UPRN is 10010457355. -The UPRN may not be the same as the property reference assigned by your organisation.",,,,,Combined with field 22 it should be a postcode which lies within the local authority given in field 25.,Combined with field 21 it should be a postcode which lies within the local authority given in field 25.,,,,"This is whether someone who uses a wheelchair is able to make full use of all of the property’s rooms and facilities, including use of both inside and outside space, and entering and exiting the property.","If shared accommodation, enter the number of bedrooms occupied by this household. A bedsit has 1 bedroom.","Date the property was (legally/contractually) available to let, or for: +The UPRN may not be the same as the property reference assigned by your organisation.",,,,,Combined with field 22 it should be a postcode which lies within the local authority given in field 25.,Combined with field 21 it should be a postcode which lies within the local authority given in field 25.,,,"This is whether someone who uses a wheelchair is able to make full use of all of the property’s rooms and facilities, including use of both inside and outside space, and entering and exiting the property.","If shared accommodation, enter the number of bedrooms occupied by this household. A bedsit has 1 bedroom.","Date the property was (legally/contractually) available to let, or for: - re-lets: the day after previous tenant’s contract end - new-builds: the day the landlord legally owned the property ('completion date’) - new conversions or acquisitions: the completion date, or the day after any rehabilitation work ended -- new leases: the day the landlord got contractual property rights, and could let it out to tenants.",,,"Major repairs are works that could not be reasonably carried out with a tenant living at the property. For example, structural repairs.",,,"This includes retirement living, sheltered housing and extra care housing. There is no national set limit for “older people”, please answer based on your own policies. +- new leases: the day the landlord got contractual property rights, and could let it out to tenants.",,,"Major repairs are works which could not reasonably be carried out with a tenant in occupation, and which need to be carried out in a property while it is vacant. They involve remedial works that are necessary for the property to remain habitable and include structural repairs, site works and service installations.",,,"This includes retirement living, sheltered housing and extra care housing. There is no national set limit for “older people”, please answer based on your own policies. Extra care housing is for tenants with medium to high care and support needs, often with 24 hour access to support staff provided by an agency registered with the Care Quality Commission.",This is where two or more people are named on the tenancy agreement.,"If the tenancy has an ‘introductory period’ answer ‘yes’. -You should submit a CORE log at the beginning of the starter tenancy or introductory period, with the best information you have at the time. You do not need to submit a log when a tenant later rolls onto the main tenancy.",This is about the main tenancy after any starter or introductory period. See specification for definitions.,,Do not include the starter or introductory period. The minimum period is 2 years for social or affordable rent general needs logs. You do not need to submit CORE logs for these types of tenancies if they are shorter than 2 years.,"This is the household member who does the most paid work. If several people do the same amount of paid work, it's the oldest household member.",This should be however they personally choose to identify from the options below. This may or may not be the same as their biological sex or the sex they were assigned at birth.,,"If the lead tenant is a dual national of the United Kingdom and another country, enter United Kingdom. If they are a dual national of two other countries, the tenant should decide which country to enter.","This is the household member who does the most paid work. If several people do the same amount of paid work, it's the oldest household member.",,Answer 1 for children aged under 1 year old,This should be however they personally choose to identify from the options below. This may or may not be the same as their biological sex or the sex they were assigned at birth.,,,Answer 1 for children aged under 1 year old,This should be however they personally choose to identify from the options below. This may or may not be the same as their biological sex or the sex they were assigned at birth.,,,Answer 1 for children aged under 1 year old,This should be however they personally choose to identify from the options below. This may or may not be the same as their biological sex or the sex they were assigned at birth.,,,Answer 1 for children aged under 1 year old,This should be however they personally choose to identify from the options below. This may or may not be the same as their biological sex or the sex they were assigned at birth.,,,Answer 1 for children aged under 1 year old,This should be however they personally choose to identify from the options below. This may or may not be the same as their biological sex or the sex they were assigned at birth.,,,Answer 1 for children aged under 1 year old,This should be however they personally choose to identify from the options below. This may or may not be the same as their biological sex or the sex they were assigned at birth.,,,Answer 1 for children aged under 1 year old,This should be however they personally choose to identify from the options below. This may or may not be the same as their biological sex or the sex they were assigned at birth.,,"This excludes national service. -If several household members have these links, answer for regular first. If no regular, answer for reserve. If no reserve, answer for spouses or civil partners.",,,,,,,,,,,"For example, lifting and carrying objects, or using a keyboard",,"For example, deafness or partial hearing",,"For example, depression or anxiety","For example, walking short distances or climbing stairs","For example, anything associated with autism spectrum disorder (ASD), including Asperger’s or attention deficit hyperactivity disorder (ADHD)",,"For example, blindness or partial sight",,,,"The tenant's ‘last settled home' is their last long-standing home. For tenants who had temporary accommodation, sleeping rough or otherwise homeless, their last settled home is where they were living previously.",,,,"This is the tenant’s last long-standing home. It is where the tenant was living before any period in temporary accommodation, sleeping rough or otherwise homeless.","Combined with field 104, it should be a postcode which lies within the local authority given in field 105.","Combined with field 103, it should be a postcode which lies within the local authority given in field 105.","This is the tenant’s last long-standing home. It is where the tenant was living before any period in temporary accommodation, sleeping rough or otherwise homeless.",Households may be given ‘reasonable preference’ for social housing under one or more specific category by the local authority. This is also known as ‘priority need’.,,,,,,Where available vacant properties are advertised and applicants are able to bid for specific properties.,Where a common system agreed between a group of housing providers is used to determine applicants' priority for housing.,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.,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.,,,,"Include any income after tax from employment, pensions, and Universal Credit. Don't include National Insurance (NI) contributions and tax, housing benefit, child benefit, or council tax support.","This is about when the tenant is in their new let. If they are unsure about the situation for their new let and their financial and working situation hasn’t changed significantly, answer based on what housing-related benefits they currently receive.",,"If rent is charged on the property then answer Yes, even if tenants do not pay it themselves.",,"This is the amount paid before any charges are added for services (for example, hot water or cleaning). Households may receive housing benefit or Universal Credit towards basic rent.","For example, cleaning. Households may get household benefits towards the service charge.",For example heating or hot water. This doesn’t include housing benefit or Universal Credit.,Any charges made to fund support services included in the tenancy agreement.,Also known as the 'outstanding amount',You only need to give an approximate figure.,This is the sex that was registered at birth.,This is the sex that was registered at birth.,This is the sex that was registered at birth.,This is the sex that was registered at birth.,This is the sex that was registered at birth.,This is the sex that was registered at birth.,This is the sex that was registered at birth.,This is the sex that was registered at birth.,,,,,,,,,,,,,,,,,,, -Values,Alphanumeric,,Email format,01-Feb,Alphanumeric,Numeric,01-Feb,Jan-31,01-Dec,25 - 26,01-Jul,Text,"Alphanumeric, max 13 characters","Alphanumeric, max 12 characters",1,"5 - 6, or 8 - 22",1 - 3 or 5 - 9,Numeric,Alphanumeric,,Text,,"Alphanumeric, +You should submit a CORE log at the beginning of the starter tenancy or introductory period, with the best information you have at the time. You do not need to submit a log when a tenant later rolls onto the main tenancy.",This is about the main tenancy after any starter or introductory period. See specification for definitions.,,Do not include the starter or introductory period. The minimum period is 2 years for social or affordable rent general needs logs. You do not need to submit CORE logs for these types of tenancies if they are shorter than 2 years.,"This is the household member who does the most paid work. If several people do the same amount of paid work, it's the oldest household member.",This is their sex as registered at birth. The next question will ask about gender identity.,,,,"If the lead tenant is a dual national of the United Kingdom and another country, enter United Kingdom. If they are a dual national of two other countries, the tenant should decide which country to enter.","This is the household member who does the most paid work. If several people do the same amount of paid work, it's the oldest household member. + +People providing informal care for family and friends who are not in formal employment (but may receive carer's allowance) should answer ""Not seeking work"".",Answer 1 for children aged under 1 year old,,This is their sex as registered at birth. The next question will ask about gender identity.,,,"People providing informal care for family and friends who are not in formal employment (but may receive carer's allowance) should answer ""Not seeking work"".",Answer 1 for children aged under 1 year old,,This is their sex as registered at birth. The next question will ask about gender identity.,,,"People providing informal care for family and friends who are not in formal employment (but may receive carer's allowance) should answer ""Not seeking work"".",Answer 1 for children aged under 1 year old,,This is their sex as registered at birth. The next question will ask about gender identity.,,,"People providing informal care for family and friends who are not in formal employment (but may receive carer's allowance) should answer ""Not seeking work"".",Answer 1 for children aged under 1 year old,,This is their sex as registered at birth. The next question will ask about gender identity.,,,"People providing informal care for family and friends who are not in formal employment (but may receive carer's allowance) should answer ""Not seeking work"".",Answer 1 for children aged under 1 year old,,This is their sex as registered at birth. The next question will ask about gender identity.,,,"People providing informal care for family and friends who are not in formal employment (but may receive carer's allowance) should answer ""Not seeking work"".",Answer 1 for children aged under 1 year old,,This is their sex as registered at birth. The next question will ask about gender identity.,,,"People providing informal care for family and friends who are not in formal employment (but may receive carer's allowance) should answer ""Not seeking work"".",Answer 1 for children aged under 1 year old,,This is their sex as registered at birth. The next question will ask about gender identity.,,,"People providing informal care for family and friends who are not in formal employment (but may receive carer's allowance) should answer ""Not seeking work"".","This excludes national service. +If several household members have these links, answer for regular first. If no regular, answer for reserve. If no reserve, answer for spouses or civil partners.",,,,,,,,,,,"For example, lifting and carrying objects, or using a keyboard",,"For example, deafness or partial hearing",,"For example, depression or anxiety","For example, walking short distances or climbing stairs","For example, anything associated with autism spectrum disorder (ASD), including Asperger’s or attention deficit hyperactivity disorder (ADHD)",,"For example, blindness or partial sight",,,,"The tenant's ‘last settled home' is their last long-standing home. For tenants who had temporary accommodation, sleeping rough or otherwise homeless, their last settled home is where they were living immediately before that period.",,This is where the household was the night before they moved into this new let.,,"This is the tenant’s last long-standing home. It is where the tenant was living before any period in temporary accommodation, sleeping rough or otherwise homeless.","Combined with field 119, it should be a postcode which lies within the local authority given in field 120.","Combined with field 118, it should be a postcode which lies within the local authority given in field 120.","This is the tenant’s last long-standing home. It is where the tenant was living before any period in temporary accommodation, sleeping rough or otherwise homeless.",Households may be given ‘reasonable preference’ for social housing under one or more specific category by the local authority. This is also known as ‘priority need’.,,,,,,Where available vacant properties are advertised and applicants are able to bid for specific properties.,Where a common system agreed between a group of housing providers is used to determine applicants' priority for housing.,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.,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.,,,Use code 3 for internal transfers from a housing register had LA involvement (if field 131 = 6) and code 5 for internal transfers from a housing register had no LA involvement (if field 132 = 7).,Use codes 1-10 for lettings from a housing register that had LA involvement (if field 131 = 6) and codes 11-20 for lettings from a housing register with no LA involvement (if field 132= 7).,,,"Include any income after tax from employment, pensions, and Universal Credit. Don't include National Insurance (NI) contributions and tax, housing benefit, child benefit, or council tax support.","This is about when the tenant is in their new let. If they are unsure about the situation for their new let and their financial and working situation hasn’t changed significantly, answer based on what housing-related benefits they currently receive.",,"If rent is charged on the property then answer Yes, even if tenants do not pay it themselves.","Only options relevant to your organisation will be accepted. To change these, go to the 'About your organisation' page or contact the CORE helpdesk.","This is the amount paid before any charges are added for services (for example, hot water or cleaning). Households may receive housing benefit or Universal Credit towards basic rent.","For example, cleaning. Households may get household benefits towards the service charge.",For example heating or hot water. This doesn’t include housing benefit or Universal Credit.,Any charges made to fund support services included in the tenancy agreement.,Also known as the 'outstanding amount',You only need to give an approximate figure. +Values,Alphanumeric,,Email format,1 - 2,Alphanumeric,Numeric,1 - 2,1 - 31,1 - 12,26 - 27,1 - 7,Text,"Alphanumeric, max 13 characters","Alphanumeric, max 12 characters",1,"5 - 6, or 8 - 22",1 - 3 or 5 - 9,Numeric,Alphanumeric,,Text,,"Alphanumeric, 2 - 4 characters","Alphanumeric, - 3 characters","9 character ONS code, beginning with 'E' (https://www.get-information-schools.service.gov.uk/Guidance/LaNameCodes) ","1 - 2, 4 or 6 - 10",01-Feb,01-Feb,01-Jul,Jan-31,01-Dec,Jun-26,Jan-31,01-Dec,Jun-26,"2 - 4, 7 - 8",01-Mar,01-Feb,02-Aug,Text,"1 - 99, see specification for more detail",16 - 120 or R,"F, M, X or R",Jan-20,"3 digit ISO country code, see specification",0 - 10,01-Mar,"Numeric, range 1 - 120 or text (upper case 'R') + 3 characters","9 character ONS code, beginning with 'E' (https://www.get-information-schools.service.gov.uk/Guidance/LaNameCodes) ","1 - 2, 4 or 6 - 10",1 - 2,1 - 7,1 - 31,1 - 12,07 - 27,1 - 31,1 - 12,07 - 27,"2 - 4, 7 - 8",1 - 3,1 - 2,2 - 8,Text,"1 - 99, see specification for more detail",16 - 120 or R,"F, M or R",1 - 3,Text,Text,"3 digit ISO country code, see specification",0 - 10,"Numeric, range 1 - 120 or text (upper case 'R') Must be >= 16 if working situation = 1 - 8 or 0 -Must be <16 if working situation = 9","F, M, X or R","0 - 10 +Must be <16 if working situation = 9",1 - 3,"F, M or R",1 - 3,Text,"0 - 10 -Must be 9 if age <16",01-Mar,"Numeric, range 1 - 120 or text (upper case 'R') +Must be 9 if age <16","Numeric, range 1 - 120 or text (upper case 'R') Must be >= 16 if working situation = 1 - 8 or 0 -Must be <16 if working situation = 9","F, M, X or R","0 - 10 +Must be <16 if working situation = 9",1 - 3,"F, M or R",1 - 3,Text,"0 - 10 -Must be 9 if age <16",01-Mar,"Numeric, range 1 - 120 or text (upper case 'R') +Must be 9 if age <16","Numeric, range 1 - 120 or text (upper case 'R') Must be >= 16 if working situation = 1 - 8 or 0 -Must be <16 if working situation = 9","F, M, X or R","0 - 10 +Must be <16 if working situation = 9",1 - 3,"F, M or R",1 - 3,Text,"0 - 10 -Must be 9 if age <16",01-Mar,"Numeric, range 1 - 120 or text (upper case 'R') +Must be 9 if age <16","Numeric, range 1 - 120 or text (upper case 'R') Must be >= 16 if working situation = 1 - 8 or 0 -Must be <16 if working situation = 9","F, M, X or R","0 - 10 +Must be <16 if working situation = 9",1 - 3,"F, M or R",1 - 3,Text,"0 - 10 -Must be 9 if age <16",01-Mar,"Numeric, range 1 - 120 or text (upper case 'R') +Must be 9 if age <16","Numeric, range 1 - 120 or text (upper case 'R') Must be >= 16 if working situation = 1 - 8 or 0 -Must be <16 if working situation = 9","F, M, X or R","0 - 10 +Must be <16 if working situation = 9",1 - 3,"F, M or R",1 - 3,Text,"0 - 10 -Must be 9 if age <16",01-Mar,"Numeric, range 1 - 120 or text (upper case 'R') +Must be 9 if age <16","Numeric, range 1 - 120 or text (upper case 'R') Must be >= 16 if working situation = 1 - 8 or 0 -Must be <16 if working situation = 9","F, M, X or R","0 - 10 +Must be <16 if working situation = 9",1 - 3,"F, M or R",1 - 3,Text,"0 - 10 -Must be 9 if age <16",01-Mar,"Numeric, range 1 - 120 or text (upper case 'R') +Must be 9 if age <16","Numeric, range 1 - 120 or text (upper case 'R') Must be >= 16 if working situation = 1 - 8 or 0 -Must be <16 if working situation = 9","F, M, X or R","0 - 10 - -Must be 9 if age <16",01-Jun,03-Jun,01-Mar,,1 or empty,,,,,,01-Mar,1 or empty,,,,,,,,,,1 - 2 or 6 - 12,2 or 6 - 13,"1 - 2, 4, 8 - 14, 16 - 20, 28 - 31, 34 or 44 - 55",Text,"3 - 4, 6 - 7, 9 - 10, 13 - 14, 18 - 19, 21, 23 - 33, 35, 37 - 39 ",1 or 11,01-Feb,"Alphanumeric, 2 - 4 characters","Alphanumeric, -3 characters","9 character ONS code, beginning with 'E' (https://www.get-information-schools.service.gov.uk/Guidance/LaNameCodes) ",01-Mar,1 or empty,,,,,01-Feb,,,,,01-Mar,01-Mar,0 - 99999,"1, 3, 6, 9 or 10",01-Apr,0 - 1,01-Oct,xxxx.xx,,,,01-Mar,xxxx.xx,"F, M or R","F, M or R","F, M or R","F, M or R","F, M or R","F, M or R","F, M or R","F, M or R",1 - 3,Text,1 - 3,Text,1 - 3,Text,1 - 3,Text,1 - 3,Text,1 - 3,Text,1 - 3,Text,1 - 3,Text,,, -Can be empty?,No,,Yes,No,"Yes, if letting is general needs (if field 4 = 1)","Yes, if letting is general needs (if field 4 = 1)",No,,,,,"Yes, if letting is not 'Other intermediate rent product' (if field 11 is not 6)",Yes,,No,"Yes, if letting is a renewal (if field 7 = 1)","Yes, if letting is a renewal (if field 7 = 1) or a first-time let (if field 16 = 15 - 17)","Yes, if letting is supported housing (if field 4 = 2) or if the property's postcode is not empty (if fields 23 and 24 contain full and valid entries)","Yes, if letting is supported housing (if field 4 = 2) or if property's UPRN and local authority are known (if fields 18 and 25 are not empty)",Yes,"Yes, if letting is supported housing (if field 4 = 2) or if property's UPRN and local authority are known (if fields 18 and 25 are not empty)",Yes,"Yes, if letting is supported housing (if field 4 = 2) or if property's UPRN and local authority are known (if fields 18 and 25 are not empty)",,"Yes, if letting is supported housing (if field 4 = 2)",,,,,"Yes, if letting is a renewal (if field 7 = 1)",,,Yes,,,"Yes, if letting is general needs (if field 4 = 1)",No,,,"Yes, if 'Other' is not selected for tenancy type (if field 39 is not 3)","Yes, if letting is not a fixed-term tenancy (if field 39 is not 4 or 6)",No,,,,,"Yes, if all fields about person 2 are empty (fields 47 - 50)",,,,"Yes, if all fields about person 3 are empty (fields 51 - 54)",,,,"Yes, if all fields about person 4 are empty (fields 55 - 58)",,,,"Yes, if all fields about person 5 are empty (fields 59 - 62)",,,,"Yes, if all fields about person 6 are empty (fields 63 - 66)",,,,"Yes, if all fields about person 7 are empty (fields 67 - 70)",,,,"Yes, if all fields about person 8 are empty (fields 71 - 74)",,,,No,"Yes, if no one in the household is a current or former regular (if field 75 is not 1)","Yes, if no one in the household is a current or former regular or reserve (if field 75 is not 1 or 4)",No,"Yes, if no household members have access needs or if it is unknown (if field 83 or 84 = 1)",,,,"Yes, if a household member has an access need (if at least one of fields 79 to 82 = 1)",,No,"Yes, if a household member has an access need (if at least one of fields 79 to 82 = 1) -If someone in the household does have such a condition (if field 89 = 1), then at least 1 of these fields must be 1.",,,,,,,,,,No,"Yes, if letting is a renewal (if field 7 = 1)",No,"Yes, if 'Other' is not selected for reason for leaving last settled home (if field 98 is not 20)",No,No,,"Yes, if postcode of household's last settled home is not known (if 102 = 2)",,Yes,No,"If household was given 'reasonable preference' (if field 107 = 1), at least one of these fields must be 1 -If household was not given 'reasonable preference' (if field 106 = 2 or 3), these fields will be ignored.",,,,,No,,,,,No,"Yes, if household's income is unknown (if field 117 = 2 or 3)",,No,,"Yes, if letting is supported housing (if field 4 = 2)",No,"Yes, if the household does not pay rent (if field 122 = 1)",,,,"Yes, if the household doesn't receive housing benefits, or if it is unknown (if field 120 = 3, 9 or 10)","Yes, if the household does not need to pay rent or charges after receiving housing benefits (if field 128 is not 1)",,,,,,,,,,,,,,,,,,,,,,,,,,, -Type of letting the question applies to,,,,,Supported housing only,,,,,,,Other Intermediate Rent only,,,,,,General needs only,,,,,,,,,,,,,,,,,,Supported housing only,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,Supported housing only,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, -Duplicate check field?,Yes,,,,Yes,,,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,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156 -,ORG1,ORG1,support@example.com,1,,,2,1,4,26,1,,1,1,1,5,1,,a,a,a,a,a1,1aa,E09000001,1,1,1,1,1,4,25,,,,,3,1,2,,,20,F,1,GBR,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,6,3,1,1,,,,,,1,1,,,,,,,,,,1,2,50,,30,1,2,,,,1,1,,,,,1,1,1,1,1,2,,,1,2,1,1,50,0,0,0,3,,F,,,,,,,,1,,,,,,,,,,,,,,,,,, +Must be <16 if working situation = 9",1 - 3,"F, M or R",1 - 3,Text,"0 - 10 + +Must be 9 if age <16",1 - 6,3 - 6,1 - 3,,1 or empty,,,,,,1 - 3,1 or empty,,,,,,,,,,1 - 2 or 6 - 12,2 or 6 - 13,"1 - 2, 4, 8 - 14, 16 - 20, 28 - 31, 34 or 44 - 57",Text,"3 - 4, 6 - 7, 9 - 10, 13 - 14, 18 - 19, 21, 23 - 33, 35, 37 - 40",1 or 11,1 - 2,"Alphanumeric, 2 - 4 characters","Alphanumeric, +3 characters","9 character ONS code, beginning with 'E' (https://www.get-information-schools.service.gov.uk/Guidance/LaNameCodes) ",1 - 3,1 or empty,,,,,1 - 2,,,,1 - 4,5 - 9,1 - 8,1 - 20,1 - 3,1 - 3,0 - 99999,"1, 3, 6, 9 or 10",1 - 4,0 - 1,1 - 10,xxxx.xx,,,,1 - 3,xxxx.xx +Can be empty?,No,,Yes,No,"Yes, if letting is general needs (if field 4 = 1)","Yes, if letting is general needs (if field 4 = 1)",No,,,,,"Yes, if letting is not 'Other intermediate rent product' (if field 11 is not 6)",Yes,,No,"Yes, if letting is a renewal (if field 7 = 1)","Yes, if letting is a renewal (if field 7 = 1) or a first-time let (if field 16 = 15 - 17)","Yes, if the property's postcode is not empty (if fields 23 and 24 contain full and valid entries)","Yes, if property's UPRN and local authority are known (if fields 18 and 25 are not empty)",Yes,"Yes, if property's UPRN and local authority are known (if fields 18 and 25 are not empty)",Yes,"Yes, if property's UPRN and local authority are known (if fields 18 and 25 are not empty)",No,"Yes, if letting is supported housing (if field 4 = 2)",,,,"Yes, if letting is a renewal (if field 7 = 1)",,,Yes,,,"Yes, if letting is general needs (if field 4 = 1)",No,,,"Yes, if 'Other' is not selected for tenancy type (if field 38 is not 3)","Yes, if letting is not a fixed-term tenancy (if field 38 is not 4 or 6)",No,,,"Yes, if 'No' is not selected for gender same as sex (if field 43 is not 2)",No,,,"Yes, if all fields about person 2 are empty (fields 48 - 53)","Yes, if person 2 is aged under 16 (if field 46 < 16) or if all fields about person 2 are empty (fields 48 - 53)","Yes, if all fields about person 2 are empty (fields 48 - 53)",,"Yes, if 'No' is not selected for gender same as sex (if field 51 is not 2) or if all fields about person 2 are empty (fields 48 - 53)","Yes, if all fields about person 2 are empty (fields 48 - 53)","Yes, if all fields about person 3 are empty (fields 54 - 59)","Yes, if person 3 is aged under 16 (if field 54 < 16) or if all fields about person 2 are empty (fields 54 - 59)","Yes, if all fields about person 3 are empty (fields 54 - 59)",,"Yes, if 'No' is not selected for gender same as sex (if field 57 is not 2) or if all fields about person 3 are empty (fields 54 - 59)","Yes, if all fields about person 3 are empty (fields 54 - 59)","Yes, if all fields about person 4 are empty (fields 60 - 65)","Yes, if person 4 is aged under 16 (if field 60 < 16) or if all fields about person 2 are empty (fields 54 - 59)","Yes, if all fields about person 4 are empty (fields 60 - 65)",,"Yes, if 'No' is not selected for gender same as sex (if field 63 is not 2) or if all fields about person 4 are empty (fields 60 - 65)","Yes, if all fields about person 4 are empty (fields 60 - 65)","Yes, if all fields about person 5 are empty (fields 59 - 62)","Yes, if person 5 is aged under 16 (if field 66 < 16) or if all fields about person 5 are empty (fields 66 - 71)","Yes, if all fields about person 5 are empty (fields 59 - 62)",,"Yes, if 'No' is not selected for gender same as sex (if field 69 is not 2) or if all fields about person 5 are empty (fields 66 - 71)","Yes, if all fields about person 5 are empty (fields 59 - 62)","Yes, if all fields about person 6 are empty (fields 63 - 66)","Yes, if person 6 is aged under 16 (if field 72 < 16) or if all fields about person 6 are empty (fields 72 - 77)","Yes, if all fields about person 6 are empty (fields 63 - 66)",,"Yes, if 'No' is not selected for gender same as sex (if field 75 is not 2) or if all fields about person 6 are empty (fields 72 - 77)","Yes, if all fields about person 6 are empty (fields 63 - 66)","Yes, if all fields about person 7 are empty (fields 67 - 70)","Yes, if person 7 is aged under 16 (if field 78 < 16) or if all fields about person 7 are empty (fields 78 - 83)","Yes, if all fields about person 7 are empty (fields 67 - 70)",,"Yes, if 'No' is not selected for gender same as sex (if field 81 is not 2) or if all fields about person 7 are empty (fields 78 - 83)","Yes, if all fields about person 7 are empty (fields 67 - 70)","Yes, if all fields about person 8 are empty (fields 71 - 74)","Yes, if person 8 is aged under 16 (if field 84 < 16) or if all fields about person 8 are empty (fields 84 - 89)","Yes, if all fields about person 8 are empty (fields 71 - 74)",,"Yes, if 'No' is not selected for gender same as sex (if field 87 is not 2) or if all fields about person 8 are empty (fields 84 - 89)","Yes, if all fields about person 8 are empty (fields 71 - 74)",No,"Yes, if no one in the household is a current or former regular (if field 90 is not 1)","Yes, if no one in the household is a current or former regular or reserve (if field 90 is not 1 or 4)",No,"Yes, if no household members have access needs or if it is unknown (if field 98 or 99 = 1)",,,,"Yes, if a household member has an access need (if at least one of fields 94 to 97 = 1)",,No,"Yes, if no one in the household has a physical or mental health condition (if field 100 is 2 or 3). +If someone in the household does have such a condition (if field 100 = 1), then at least 1 of these fields must be 1.",,,,,,,,,,No,"Yes, if letting is a renewal (if field 7 = 1)",No,"Yes, if 'Other' is not selected for reason for leaving last settled home (if field 113 is not 20)",No,No,,"Yes, if postcode of household's last settled home is not known (if 117 = 2)",,Yes,No,"Yes, if household was not given 'reasonable preference' (if field 121 = 2 or 3) +",,,,,No,,,,"Yes, if the stock owner (field 1) is a PRP, or if the letting is a renewal (if field 7 = 1)","Yes, if the stock owner (field 1) is a local authority, or if the letting is a renewal (if field 7 = 1)","Yes, if the stock owner (field 1) is a local authority, or if the letting is a renewal (if field 7 = 1), or if field 132 is 5 or 8-9","Yes, if the stock owner (field 1) is a local authority, or if the letting is a renewal (if field 7 = 1), or if field 133 is 2-6 or 8",No,"Yes, if household's income is unknown (if field 135 = 2 or 3)",,No,,"Yes, if letting is supported housing (if field 4 = 2)",No,"Yes, if the household does not pay rent (if field 140 = 1)",,,,"Yes, if the household doesn't receive housing benefits, or if it is unknown (if field 139 = 3, 9 or 10)","Yes, if the household does not need to pay rent or charges after receiving housing benefits (if field 146 is not 1)" +Type of letting the question applies to,,,,,Supported housing only,,,,,,,Other Intermediate Rent only,,,,,,,,,,,,,,General needs only,,,,,,,,,Supported housing only,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,Local authority owned properties,PRP owned properties,,,,,,,,Supported housing only,,,,,,, +Duplicate check field?,Yes,,,,,,,Yes,,,,,Yes,,,,,"Yes, if UPRN provided instead of address","Yes, if address provided instead of UPRN",,,,"Yes, if address provided instead of UPRN",,,,,,,,,,,,,,,,,,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,136,137,138,139,140,141,142,143,144,145,146,147 +,ORG1,ORG1,support@example.com,1,,,2,1,4,26,1,,1,1,1,5,1,,a,a,a,a,a1,1aa,E09000001,1,1,1,1,4,25,,,,,3,1,2,,,20,F,1,,1,GBR,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,6,3,1,1,,,,,,1,1,,,,,,,,,,1,2,50,,30,1,2,,,,1,1,,,,,1,1,1,1,1,,,,2,,,1,2,1,1,100,0,0,0,3, diff --git a/spec/services/bulk_upload/lettings/validator_spec.rb b/spec/services/bulk_upload/lettings/validator_spec.rb index 78e0d7f34..ef5386cc9 100644 --- a/spec/services/bulk_upload/lettings/validator_spec.rb +++ b/spec/services/bulk_upload/lettings/validator_spec.rb @@ -190,8 +190,8 @@ RSpec.describe BulkUpload::Lettings::Validator do expect(error.tenant_code).to eql(log.tenancycode) expect(error.property_ref).to eql(log.propcode) expect(error.row).to eql("2") - expect(error.cell).to eql("EB2") # this may change when adding a new field as the cols are in a random order - expect(error.col).to eql("EB") # this may change when adding a new field as the cols are in a random order + expect(error.cell).to eql("EA2") # this may change when adding a new field as the cols are in a random order + expect(error.col).to eql("EA") # this may change when adding a new field as the cols are in a random order end end end diff --git a/spec/services/bulk_upload/lettings/year2026/csv_parser_spec.rb b/spec/services/bulk_upload/lettings/year2026/csv_parser_spec.rb index d32a85ee3..0452116be 100644 --- a/spec/services/bulk_upload/lettings/year2026/csv_parser_spec.rb +++ b/spec/services/bulk_upload/lettings/year2026/csv_parser_spec.rb @@ -244,10 +244,10 @@ RSpec.describe BulkUpload::Lettings::Year2026::CsvParser do end it "returns correct column" do - expect(service.column_for_field("field_5")).to eql("AA") - expect(service.column_for_field("field_22")).to eql("BK") - expect(service.column_for_field("field_26")).to eql("BZ") - expect(service.column_for_field("field_25")).to eql("S") + expect(service.column_for_field("field_5")).to eql("T") + expect(service.column_for_field("field_22")).to eql("BG") + expect(service.column_for_field("field_26")).to eql("BX") + expect(service.column_for_field("field_25")).to eql("F") end end end diff --git a/spec/services/bulk_upload/lettings/year2026/row_parser_spec.rb b/spec/services/bulk_upload/lettings/year2026/row_parser_spec.rb index f0e05e30a..19847dec5 100644 --- a/spec/services/bulk_upload/lettings/year2026/row_parser_spec.rb +++ b/spec/services/bulk_upload/lettings/year2026/row_parser_spec.rb @@ -119,7 +119,7 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do end context "when calling the method multiple times" do - let(:attributes) { { bulk_upload:, field_129: 2 } } + let(:attributes) { { bulk_upload:, field_147: 2 } } it "does not add keep adding errors to the pile" do parser.valid? @@ -144,127 +144,126 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do field_26: "2", field_27: "1", field_28: "1", - field_29: "1", - field_37: "2", - field_38: "1", - field_39: "2", + field_36: "2", + field_37: "1", + field_38: "2", field_15: "1", - field_42: "42", + field_41: "42", field_48: "41", - field_52: "17", - field_56: "18", - field_60: "16", - field_64: "14", - field_68: "12", - field_72: "20", - - field_43: "F", - field_49: "M", - field_53: "F", - field_57: "M", - field_61: "F", - field_65: "M", - field_69: "F", - field_73: "M", - - field_44: "17", - field_45: "826", + field_54: "17", + field_60: "18", + field_66: "16", + field_72: "14", + field_78: "12", + field_84: "20", + + field_42: "F", + field_50: "M", + field_56: "F", + field_62: "M", + field_68: "F", + field_74: "M", + field_80: "F", + field_86: "M", + + field_45: "17", + field_46: "826", + + field_49: "1", + field_55: "2", + field_61: "2", + field_67: "3", + field_73: "2", + field_79: "2", + field_85: "2", field_47: "1", - field_51: "2", - field_55: "2", - field_59: "3", - field_63: "2", - field_67: "2", - field_71: "2", - - field_46: "1", - field_50: "2", - field_54: "7", - field_58: "7", - field_62: "8", - field_66: "9", - field_70: "0", - field_74: "10", - - field_75: "1", - field_76: "4", - field_77: "1", - - field_78: "1", - - field_79: "1", - field_80: "0", - field_81: "0", - field_82: "1", + field_53: "2", + field_59: "7", + field_65: "7", + field_71: "8", + field_77: "9", field_83: "0", + field_89: "10", - field_85: "3", + field_90: "1", + field_91: "4", + field_92: "1", - field_96: "11", - field_97: "2", - field_98: "31", - field_100: "3", - field_101: "11", - - field_102: "1", - field_103: "EC1N", - field_104: "2TD", + field_93: "1", - field_106: "1", - field_107: "1", - field_108: "", - field_109: "1", - field_110: "", - field_111: "", + field_94: "1", + field_95: "0", + field_96: "0", + field_97: "1", + field_98: "0", - field_112: "1", - field_113: "2", - field_114: "2", - field_115: "2", + field_100: "3", - field_116: "1", + field_111: "11", + field_112: "2", + field_113: "31", + field_115: "3", + field_116: "11", field_117: "1", - field_118: "2", - field_119: "2300", - field_120: "1", - field_121: "4", - - field_123: "4", - field_124: "1234.56", - field_125: "43.32", - field_126: "13.14", - field_127: "101.11", - field_128: "1", - field_129: "34.56", + field_118: "EC1N", + field_119: "2TD", + + field_121: "1", + field_122: "1", + field_123: "", + field_124: "1", + field_125: "", + field_126: "", + + field_127: "1", + field_128: "2", + field_129: "2", + field_130: "2", + + field_131: "1", + + field_135: "1", + field_136: "2", + field_137: "2300", + field_138: "1", + field_139: "4", + + field_141: "4", + field_142: "1234.56", + field_143: "43.32", + field_144: "13.14", + field_145: "101.11", + field_146: "1", + field_147: "34.56", field_16: "15", - field_30: now.day.to_s, - field_31: now.month.to_s, - field_32: now.strftime("%g"), + field_29: now.day.to_s, + field_30: now.month.to_s, + field_31: now.strftime("%g"), field_4: "1", field_18: "12", - field_130: "1", - field_131: "", - field_132: "2", - field_133: "identity", - field_134: "3", - field_135: "", - field_136: "1", - field_137: "", - field_138: "2", - field_139: "identity", - field_140: "3", - field_141: "", - field_142: "1", - field_143: "", - field_144: "2", - field_145: "identity", + field_43: "1", + field_44: "", + field_51: "2", + field_52: "identity", + field_57: "3", + field_58: "", + field_63: "1", + field_64: "", + field_69: "2", + field_70: "identity", + field_75: "3", + field_76: "", + field_81: "1", + field_82: "", + field_87: "2", + field_88: "identity", } end @@ -314,13 +313,13 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do :field_23, # postcode_full :field_24, # postcode_full :field_25, # LA - :field_42, # age1 - :field_43, # sexrab1 - :field_46, # ecstat1 - :field_124, # brent - :field_125, # scharge - :field_126, # pscharge - :field_127, # supcharg + :field_41, # age1 + :field_42, # sexrab1 + :field_47, # ecstat1 + :field_142, # brent + :field_143, # scharge + :field_144, # pscharge + :field_145, # supcharg ].each do |field| expect(parser.errors[field]).to include(error_message) end @@ -345,7 +344,7 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do end context "when a supported housing log already exists in the db" do # TODO: CLDC-4119: Beware! The `postcode_full` method in the `LettingsLog` class may cause issues with these supported housing log duplicate detection tests after postcode is added. See comment on the `postcode_full` method for details. - let(:attributes) { valid_attributes.merge({ field_4: "2", field_5: "S#{scheme.id}", field_6: location.old_visible_id, field_36: 3, field_122: 0 }) } + let(:attributes) { valid_attributes.merge({ field_4: "2", field_5: "S#{scheme.id}", field_6: location.old_visible_id, field_35: 3, field_140: 0 }) } before do parser.log.save! @@ -368,13 +367,13 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do :field_10, # startdate :field_13, # tenancycode :field_6, # location - :field_42, # age1 - :field_43, # sexrab1 - :field_46, # ecstat1 - :field_124, # brent - :field_125, # scharge - :field_126, # pscharge - :field_127, # supcharg + :field_41, # age1 + :field_42, # sexrab1 + :field_47, # ecstat1 + :field_142, # brent + :field_143, # scharge + :field_144, # pscharge + :field_145, # supcharg ].each do |field| expect(parser.errors[field]).to include(error_message) end @@ -410,13 +409,13 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do :field_10, # startdate :field_13, # tenancycode :field_6, # location - :field_42, # age1 - :field_43, # sexrab1 - :field_46, # ecstat1 - :field_124, # brent - :field_125, # scharge - :field_126, # pscharge - :field_127, # supcharg + :field_41, # age1 + :field_42, # sexrab1 + :field_47, # ecstat1 + :field_142, # brent + :field_143, # scharge + :field_144, # pscharge + :field_145, # supcharg ].each do |field| expect(parser.errors[field]).to include(error_message) end @@ -453,9 +452,9 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do :field_10, # startdate :field_13, # tenancycode :field_6, # location - :field_42, # age1 - :field_43, # sexrab1 - :field_46, # ecstat1 + :field_41, # age1 + :field_42, # sexrab1 + :field_47, # ecstat1 ].each do |field| expect(parser.errors[field]).to include(error_message) end @@ -474,8 +473,8 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do field_11: "2", field_6: location.id, field_1: owning_org.old_visible_id, - field_122: 0, - field_36: 4 }) + field_140: 0, + field_35: 4 }) end before do @@ -499,10 +498,10 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do :field_10, # startdate :field_13, # tenancycode :field_6, # location - :field_42, # age1 - :field_43, # sexrab1 - :field_46, # ecstat1 - :field_122, # household_charge + :field_41, # age1 + :field_42, # sexrab1 + :field_47, # ecstat1 + :field_140, # household_charge ].each do |field| expect(parser.errors[field]).to include(error_message) end @@ -518,9 +517,9 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do let(:attributes) do setup_section_params.merge({ field_5: nil, field_6: nil, - field_124: 300, - field_123: 1, - field_29: 1, + field_142: 300, + field_141: 1, + field_28: 1, field_4: 1, field_11: "2", field_25: "E09000008" }) @@ -553,9 +552,9 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do :field_23, # postcode_full :field_24, # postcode_full :field_25, # LA - :field_42, # age1 - :field_43, # sexrab1 - :field_46, # ecstat1 + :field_41, # age1 + :field_42, # sexrab1 + :field_47, # ecstat1 ].each do |field| expect(parser.errors[field]).to be_blank end @@ -588,8 +587,8 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do end context "with a valid ethnic value" do - context "when field_44 is 20" do - let(:attributes) { valid_attributes.merge({ field_44: "20" }) } + context "when field_45 is 20" do + let(:attributes) { valid_attributes.merge({ field_45: "20" }) } it "is correctly sets ethnic and ethnic group" do expect(parser.log.ethnic).to eq(20) @@ -609,43 +608,43 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do context "when there is a :skip_bu_error error" do let(:managing_org) { create(:organisation, :with_old_visible_id, rent_periods: [4, 1]) } - let(:attributes) { valid_attributes.merge({ field_123: 3, field_127: 80 }) } + let(:attributes) { valid_attributes.merge({ field_141: 3, field_145: 80 }) } it "does not add that error" do parser.valid? expect(parser.log.errors.map(&:attribute).sort).to eql(%i[managing_organisation_id period]) - expect(parser.errors.map(&:attribute)).to eql(%i[field_123]) + expect(parser.errors.map(&:attribute)).to eql(%i[field_141]) end end end describe "#validate_nulls" do context "when non-setup questions are null" do - let(:attributes) { setup_section_params.merge({ field_43: "" }) } + let(:attributes) { setup_section_params.merge({ field_42: "" }) } it "fetches the question's check_answer_label if it exists" do parser.valid? - expect(parser.errors[:field_43]).to eql([I18n.t("validations.lettings.2026.bulk_upload.not_answered", question: "lead tenant’s sex registered at birth.")]) + expect(parser.errors[:field_42]).to eql([I18n.t("validations.lettings.2026.bulk_upload.not_answered", question: "lead tenant’s sex registered at birth.")]) end end context "when other null error is added" do - let(:attributes) { setup_section_params.merge({ field_112: nil }) } + let(:attributes) { setup_section_params.merge({ field_127: nil }) } it "only has one error added to the field" do parser.valid? - expect(parser.errors[:field_112]).to eql([I18n.t("validations.lettings.2026.bulk_upload.not_answered", question: "was the letting made under the Choice-Based Lettings (CBL)?")]) + expect(parser.errors[:field_127]).to eql([I18n.t("validations.lettings.2026.bulk_upload.not_answered", question: "was the letting made under the Choice-Based Lettings (CBL)?")]) end end context "when an invalid value error has been added" do - let(:attributes) { setup_section_params.merge({ field_115: "100" }) } + let(:attributes) { setup_section_params.merge({ field_130: "100" }) } it "does not add an additional error" do parser.valid? - expect(parser.errors[:field_115].length).to eq(1) - expect(parser.errors[:field_115]).to include(match I18n.t("validations.lettings.2026.bulk_upload.invalid_option", question: "")) + expect(parser.errors[:field_130].length).to eq(1) + expect(parser.errors[:field_130]).to include(match I18n.t("validations.lettings.2026.bulk_upload.invalid_option", question: "")) end end end @@ -894,213 +893,213 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do end end - describe "#field_98" do # leaving reason + describe "#field_113" do # leaving reason context "when field_7 is 1 meaning it is a renewal" do - context "when field_98 is 50" do - let(:attributes) { { bulk_upload:, field_98: "50", field_7: "1" } } + context "when field_113 is 50" do + let(:attributes) { { bulk_upload:, field_113: "50", field_7: "1" } } it "is permitted" do parser.valid? - expect(parser.errors[:field_98]).to be_blank + expect(parser.errors[:field_113]).to be_blank end end - context "when field_98 is 51" do - let(:attributes) { { bulk_upload:, field_98: "51", field_7: "1" } } + context "when field_113 is 51" do + let(:attributes) { { bulk_upload:, field_113: "51", field_7: "1" } } it "is permitted" do parser.valid? - expect(parser.errors[:field_98]).to be_blank + expect(parser.errors[:field_113]).to be_blank end end - context "when field_98 is 52" do - let(:attributes) { { bulk_upload:, field_98: "52", field_7: "1" } } + context "when field_113 is 52" do + let(:attributes) { { bulk_upload:, field_113: "52", field_7: "1" } } it "is permitted" do parser.valid? - expect(parser.errors[:field_98]).to be_blank + expect(parser.errors[:field_113]).to be_blank end end - context "when field_98 is 53" do - let(:attributes) { { bulk_upload:, field_98: "53", field_7: "1" } } + context "when field_113 is 53" do + let(:attributes) { { bulk_upload:, field_113: "53", field_7: "1" } } it "is permitted" do parser.valid? - expect(parser.errors[:field_98]).to be_blank + expect(parser.errors[:field_113]).to be_blank end end - context "when field_98 is not 50, 51, 52 or 53" do - let(:attributes) { { bulk_upload:, field_98: "1", field_7: "1" } } + context "when field_113 is not 50, 51, 52 or 53" do + let(:attributes) { { bulk_upload:, field_113: "1", field_7: "1" } } it "is not permitted" do parser.valid? - expect(parser.errors[:field_98]).to include(I18n.t("validations.lettings.2026.bulk_upload.reason.renewal_reason_needed")) + expect(parser.errors[:field_113]).to include(I18n.t("validations.lettings.2026.bulk_upload.reason.renewal_reason_needed")) end end end context "when no longer a valid option from previous year" do - let(:attributes) { setup_section_params.merge({ field_98: "7" }) } + let(:attributes) { setup_section_params.merge({ field_113: "7" }) } it "returns an error" do parser.valid? - expect(parser.errors[:field_98]).to include(I18n.t("validations.lettings.2026.bulk_upload.invalid_option", question: "what is the tenant’s main reason for the household leaving their last settled home?")) + expect(parser.errors[:field_113]).to include(I18n.t("validations.lettings.2026.bulk_upload.invalid_option", question: "what is the tenant’s main reason for the household leaving their last settled home?")) end end end - describe "#field_79, #field_80, #field_81" do + describe "#field_94, #field_95, #field_96" do context "when one item selected" do - let(:attributes) { { bulk_upload:, field_79: "1" } } + let(:attributes) { { bulk_upload:, field_94: "1" } } it "is permitted" do parser.valid? - expect(parser.errors[:field_79]).to be_blank - expect(parser.errors[:field_80]).to be_blank - expect(parser.errors[:field_81]).to be_blank + expect(parser.errors[:field_94]).to be_blank + expect(parser.errors[:field_95]).to be_blank + expect(parser.errors[:field_96]).to be_blank end end context "when more than one item selected" do - let(:attributes) { { bulk_upload:, field_79: "1", field_80: "1" } } + let(:attributes) { { bulk_upload:, field_94: "1", field_95: "1" } } it "is not permitted" do parser.valid? - expect(parser.errors[:field_79]).to be_present - expect(parser.errors[:field_80]).to be_present + expect(parser.errors[:field_94]).to be_present + expect(parser.errors[:field_95]).to be_present end end end - describe "#field_83" do + describe "#field_98" do context "when 1 and another disability field selected" do - let(:attributes) { { bulk_upload:, field_83: "1", field_82: "1" } } + let(:attributes) { { bulk_upload:, field_98: "1", field_97: "1" } } it "is not permitted" do parser.valid? - expect(parser.errors[:field_83]).to be_present + expect(parser.errors[:field_98]).to be_present end end end - describe "#field_84" do + describe "#field_99" do context "when 1 and another disability field selected" do - let(:attributes) { { bulk_upload:, field_84: "1", field_82: "1" } } + let(:attributes) { { bulk_upload:, field_99: "1", field_97: "1" } } it "is not permitted" do parser.valid? - expect(parser.errors[:field_84]).to be_present + expect(parser.errors[:field_99]).to be_present end end end - describe "#field_83, #field_84" do + describe "#field_98, #field_99" do context "when both 1" do - let(:attributes) { { bulk_upload:, field_83: "1", field_84: "1" } } + let(:attributes) { { bulk_upload:, field_98: "1", field_99: "1" } } it "is not permitted" do parser.valid? - expect(parser.errors[:field_83]).to be_present - expect(parser.errors[:field_84]).to be_present + expect(parser.errors[:field_98]).to be_present + expect(parser.errors[:field_99]).to be_present end end end - describe "#field_79 - #field_84" do + describe "#field_94 - #field_99" do context "when all blank" do - let(:attributes) { setup_section_params.merge({ field_79: nil, field_80: nil, field_81: nil, field_82: nil, field_83: nil, field_84: nil }) } + let(:attributes) { setup_section_params.merge({ field_94: nil, field_95: nil, field_96: nil, field_97: nil, field_98: nil, field_99: nil }) } it "adds errors to correct fields" do parser.valid? - expect(parser.errors[:field_79]).to be_present - expect(parser.errors[:field_80]).to be_present - expect(parser.errors[:field_81]).to be_present - expect(parser.errors[:field_82]).to be_present - expect(parser.errors[:field_83]).to be_present + expect(parser.errors[:field_94]).to be_present + expect(parser.errors[:field_95]).to be_present + expect(parser.errors[:field_96]).to be_present + expect(parser.errors[:field_97]).to be_present + expect(parser.errors[:field_98]).to be_present end end - context "when one item selected and field_82 is blank" do - let(:attributes) { setup_section_params.merge({ field_79: "1", field_82: nil }) } + context "when one item selected and field_97 is blank" do + let(:attributes) { setup_section_params.merge({ field_94: "1", field_97: nil }) } it "sets other disabled access needs as no" do parser.valid? - expect(parser.errors[:field_79]).to be_blank - expect(parser.errors[:field_82]).to be_blank + expect(parser.errors[:field_94]).to be_blank + expect(parser.errors[:field_97]).to be_blank expect(parser.log.housingneeds_other).to eq(0) end end end - describe "#field_85, field_94 - 99" do + describe "#field_100, field_109 - 99" do context "when no illness but illnesses answered" do - let(:attributes) { { bulk_upload:, field_85: "2", field_86: "1", field_87: "1", field_88: "1" } } + let(:attributes) { { bulk_upload:, field_100: "2", field_101: "1", field_102: "1", field_103: "1" } } it "errors added to correct fields" do parser.valid? - expect(parser.errors[:field_86]).to be_present - expect(parser.errors[:field_87]).to be_present - expect(parser.errors[:field_88]).to be_present - expect(parser.errors[:field_89]).not_to be_present - expect(parser.errors[:field_90]).not_to be_present - expect(parser.errors[:field_91]).not_to be_present - expect(parser.errors[:field_92]).not_to be_present - expect(parser.errors[:field_93]).not_to be_present - expect(parser.errors[:field_94]).not_to be_present - expect(parser.errors[:field_95]).not_to be_present + expect(parser.errors[:field_101]).to be_present + expect(parser.errors[:field_102]).to be_present + expect(parser.errors[:field_103]).to be_present + expect(parser.errors[:field_104]).not_to be_present + expect(parser.errors[:field_105]).not_to be_present + expect(parser.errors[:field_106]).not_to be_present + expect(parser.errors[:field_107]).not_to be_present + expect(parser.errors[:field_108]).not_to be_present + expect(parser.errors[:field_109]).not_to be_present + expect(parser.errors[:field_110]).not_to be_present end end context "when illness but no illnesses answered" do - let(:attributes) { { bulk_upload:, field_85: "1", field_86: nil, field_87: nil, field_88: nil, field_89: nil, field_90: nil, field_91: nil, field_92: nil, field_93: nil, field_94: nil, field_95: nil } } + let(:attributes) { { bulk_upload:, field_100: "1", field_101: nil, field_102: nil, field_103: nil, field_104: nil, field_105: nil, field_106: nil, field_107: nil, field_108: nil, field_109: nil, field_110: nil } } it "errors added to correct fields" do parser.valid? - expect(parser.errors[:field_86]).to be_present - expect(parser.errors[:field_87]).to be_present - expect(parser.errors[:field_88]).to be_present - expect(parser.errors[:field_89]).to be_present - expect(parser.errors[:field_90]).to be_present - expect(parser.errors[:field_91]).to be_present - expect(parser.errors[:field_92]).to be_present - expect(parser.errors[:field_93]).to be_present - expect(parser.errors[:field_94]).to be_present - expect(parser.errors[:field_95]).to be_present + expect(parser.errors[:field_101]).to be_present + expect(parser.errors[:field_102]).to be_present + expect(parser.errors[:field_103]).to be_present + expect(parser.errors[:field_104]).to be_present + expect(parser.errors[:field_105]).to be_present + expect(parser.errors[:field_106]).to be_present + expect(parser.errors[:field_107]).to be_present + expect(parser.errors[:field_108]).to be_present + expect(parser.errors[:field_109]).to be_present + expect(parser.errors[:field_110]).to be_present end end end - describe "#field_100" do + describe "#field_115" do context "when log is a renewal and field 100 is an invalid value" do - let(:attributes) { { bulk_upload:, field_7: 1, field_100: 4 } } + let(:attributes) { { bulk_upload:, field_7: 1, field_115: 4 } } it "adds an error to field 100" do parser.valid? - expect(parser.errors[:field_100]).to be_present - expect(parser.errors[:field_100]).to include(I18n.t("validations.lettings.2026.bulk_upload.prevten.invalid")) + expect(parser.errors[:field_115]).to be_present + expect(parser.errors[:field_115]).to include(I18n.t("validations.lettings.2026.bulk_upload.prevten.invalid")) end end context "when log is a renewal and field 100 is a valid value" do - let(:attributes) { { bulk_upload:, field_7: 1, field_100: 38 } } + let(:attributes) { { bulk_upload:, field_7: 1, field_115: 38 } } it "does not add an error" do parser.valid? - expect(parser.errors[:field_100]).to be_blank + expect(parser.errors[:field_115]).to be_blank end end end - describe "#field_112 - 115 (lettings allocation methods)" do - %i[field_112 field_113 field_114 field_115].each do |field| + describe "#field_127 - 115 (lettings allocation methods)" do + %i[field_127 field_128 field_129 field_130].each do |field| context "when only #{field} is not given" do let(:attributes) do override = {} override[field] = "" - { bulk_upload:, field_112: "2", field_113: "1", field_114: "2", field_115: "1" }.merge(override) + { bulk_upload:, field_127: "2", field_128: "1", field_129: "2", field_130: "1" }.merge(override) end it "adds an error to #{field}" do @@ -1111,35 +1110,35 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do end end - describe "#field_101, field_106 - 15" do + describe "#field_116, field_121 - 15" do context "when there is a reasonable preference but none is given" do - let(:attributes) { { bulk_upload:, field_106: "1", field_107: nil, field_108: nil, field_109: nil, field_110: nil, field_111: nil } } + let(:attributes) { { bulk_upload:, field_121: "1", field_122: nil, field_123: nil, field_124: nil, field_125: nil, field_126: nil } } it "is not permitted" do parser.valid? - expect(parser.errors[:field_107]).to be_present - expect(parser.errors[:field_108]).to be_present - expect(parser.errors[:field_109]).to be_present - expect(parser.errors[:field_110]).to be_present - expect(parser.errors[:field_111]).to be_present + expect(parser.errors[:field_122]).to be_present + expect(parser.errors[:field_123]).to be_present + expect(parser.errors[:field_124]).to be_present + expect(parser.errors[:field_125]).to be_present + expect(parser.errors[:field_126]).to be_present end end context "when some reasonable preference options are set as invalid values" do - let(:attributes) { setup_section_params.merge({ bulk_upload:, field_106: "2", field_107: "2", field_108: "3", field_109: "2", field_110: "3", field_111: "-4" }) } + let(:attributes) { setup_section_params.merge({ bulk_upload:, field_121: "2", field_122: "2", field_123: "3", field_124: "2", field_125: "3", field_126: "-4" }) } it "adds errors" do parser.valid? - expect(parser.errors[:field_107]).to be_present - expect(parser.errors[:field_108]).to be_present - expect(parser.errors[:field_109]).to be_present - expect(parser.errors[:field_110]).to be_present - expect(parser.errors[:field_111]).to be_present + expect(parser.errors[:field_122]).to be_present + expect(parser.errors[:field_123]).to be_present + expect(parser.errors[:field_124]).to be_present + expect(parser.errors[:field_125]).to be_present + expect(parser.errors[:field_126]).to be_present end end context "when some reasonable preference options are selected" do - let(:attributes) { setup_section_params.merge({ bulk_upload:, field_106: "1", field_107: "1", field_108: nil, field_109: "1", field_110: nil, field_111: nil }) } + let(:attributes) { setup_section_params.merge({ bulk_upload:, field_121: "1", field_122: "1", field_123: nil, field_124: "1", field_125: nil, field_126: nil }) } it "sets the rest of the options to 0" do parser.valid? @@ -1152,7 +1151,7 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do end end - describe "#field_116, field_146, field_147, field_148" do # referral + describe "#field_131, field_132, field_133, field_134" do # referral context "when org is LA" do let(:owning_org) { create(:organisation, :la, :with_old_visible_id) } @@ -1161,64 +1160,64 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do context "and not renewal" do let(:renewal_attributes) { org_attributes.merge({ field_7: nil }) } - context "and field_116 is valid" do - let(:attributes) { renewal_attributes.merge({ field_116: 1 }) } + context "and field_131 is valid" do + let(:attributes) { renewal_attributes.merge({ field_131: 1 }) } it "does not add an error" do parser.valid? - expect(parser.errors[:field_116]).to be_blank - expect(parser.errors[:field_146]).to be_blank - expect(parser.errors[:field_147]).to be_blank - expect(parser.errors[:field_148]).to be_blank + expect(parser.errors[:field_131]).to be_blank + expect(parser.errors[:field_132]).to be_blank + expect(parser.errors[:field_133]).to be_blank + expect(parser.errors[:field_134]).to be_blank end end - context "and field_116 is invalid" do - let(:attributes) { renewal_attributes.merge({ field_116: 5 }) } # PRP option + context "and field_131 is invalid" do + let(:attributes) { renewal_attributes.merge({ field_131: 5 }) } # PRP option it "adds errors to all referral fields" do parser.valid? - expect(parser.errors[:field_116]).to be_present - expect(parser.errors[:field_146]).to be_present - expect(parser.errors[:field_147]).to be_present - expect(parser.errors[:field_148]).to be_present + expect(parser.errors[:field_131]).to be_present + expect(parser.errors[:field_132]).to be_present + expect(parser.errors[:field_133]).to be_present + expect(parser.errors[:field_134]).to be_present end end - context "and field_116 is blank" do - let(:attributes) { renewal_attributes.merge({ field_116: nil }) } + context "and field_131 is blank" do + let(:attributes) { renewal_attributes.merge({ field_131: nil }) } it "adds errors to all referral fields" do parser.valid? - expect(parser.errors[:field_116]).to be_present - expect(parser.errors[:field_146]).to be_present - expect(parser.errors[:field_147]).to be_present - expect(parser.errors[:field_148]).to be_present + expect(parser.errors[:field_131]).to be_present + expect(parser.errors[:field_132]).to be_present + expect(parser.errors[:field_133]).to be_present + expect(parser.errors[:field_134]).to be_present end end context "and other fields are given" do - let(:attributes) { renewal_attributes.merge({ field_116: 1, field_146: 5, field_147: 1, field_144: 1 }) } + let(:attributes) { renewal_attributes.merge({ field_131: 1, field_132: 5, field_133: 1, field_87: 1 }) } it "adds errors to all referral fields" do parser.valid? - expect(parser.errors[:field_116]).to be_present - expect(parser.errors[:field_146]).to be_present - expect(parser.errors[:field_147]).to be_present - expect(parser.errors[:field_148]).to be_present + expect(parser.errors[:field_131]).to be_present + expect(parser.errors[:field_132]).to be_present + expect(parser.errors[:field_133]).to be_present + expect(parser.errors[:field_134]).to be_present end end end context "and is renewal" do - let(:attributes) { org_attributes.merge({ field_7: 1, field_116: 1, field_146: 5, field_147: 1, field_148: 1 }) } + let(:attributes) { org_attributes.merge({ field_7: 1, field_131: 1, field_132: 5, field_133: 1, field_134: 1 }) } it "does not add an error for referral fields" do parser.valid? - expect(parser.errors[:field_116]).to be_blank - expect(parser.errors[:field_146]).to be_blank - expect(parser.errors[:field_147]).to be_blank - expect(parser.errors[:field_148]).to be_blank + expect(parser.errors[:field_131]).to be_blank + expect(parser.errors[:field_132]).to be_blank + expect(parser.errors[:field_133]).to be_blank + expect(parser.errors[:field_134]).to be_blank end end end @@ -1231,141 +1230,141 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do context "and not renewal" do let(:renewal_attributes) { org_attributes.merge({ field_7: nil }) } - context "and field_146 is valid and does not expect an answer for field_147" do - let(:attributes) { renewal_attributes.merge({ field_146: 5 }) } + context "and field_132 is valid and does not expect an answer for field_133" do + let(:attributes) { renewal_attributes.merge({ field_132: 5 }) } it "does not add an error" do parser.valid? - expect(parser.errors[:field_116]).to be_blank - expect(parser.errors[:field_146]).to be_blank - expect(parser.errors[:field_147]).to be_blank - expect(parser.errors[:field_148]).to be_blank + expect(parser.errors[:field_131]).to be_blank + expect(parser.errors[:field_132]).to be_blank + expect(parser.errors[:field_133]).to be_blank + expect(parser.errors[:field_134]).to be_blank end context "and later fields are given" do - let(:attributes) { renewal_attributes.merge({ field_146: 5, field_147: 1, field_148: 1 }) } + let(:attributes) { renewal_attributes.merge({ field_132: 5, field_133: 1, field_134: 1 }) } it "adds errors to all referral fields" do parser.valid? - expect(parser.errors[:field_116]).to be_present - expect(parser.errors[:field_146]).to be_present - expect(parser.errors[:field_147]).to be_present - expect(parser.errors[:field_148]).to be_present + expect(parser.errors[:field_131]).to be_present + expect(parser.errors[:field_132]).to be_present + expect(parser.errors[:field_133]).to be_present + expect(parser.errors[:field_134]).to be_present end end end - context "and field_146 is invalid" do - let(:attributes) { renewal_attributes.merge({ field_146: 1 }) } # LA option + context "and field_132 is invalid" do + let(:attributes) { renewal_attributes.merge({ field_132: 1 }) } # LA option it "adds errors to all referral fields" do parser.valid? - expect(parser.errors[:field_116]).to be_present - expect(parser.errors[:field_146]).to be_present - expect(parser.errors[:field_147]).to be_present - expect(parser.errors[:field_148]).to be_present + expect(parser.errors[:field_131]).to be_present + expect(parser.errors[:field_132]).to be_present + expect(parser.errors[:field_133]).to be_present + expect(parser.errors[:field_134]).to be_present end end - context "and field_146 is blank" do - let(:attributes) { renewal_attributes.merge({ field_146: nil }) } + context "and field_132 is blank" do + let(:attributes) { renewal_attributes.merge({ field_132: nil }) } it "adds errors to all referral fields" do parser.valid? - expect(parser.errors[:field_116]).to be_present - expect(parser.errors[:field_146]).to be_present - expect(parser.errors[:field_147]).to be_present - expect(parser.errors[:field_148]).to be_present + expect(parser.errors[:field_131]).to be_present + expect(parser.errors[:field_132]).to be_present + expect(parser.errors[:field_133]).to be_present + expect(parser.errors[:field_134]).to be_present end end - context "and field_146 is valid and expects an answer for field_147" do - let(:field_146_attributes) { renewal_attributes.merge({ field_146: 6 }) } + context "and field_132 is valid and expects an answer for field_133" do + let(:field_146_attributes) { renewal_attributes.merge({ field_132: 6 }) } - context "and field_147 is valid and does not expect an answer for field_148" do - let(:attributes) { field_146_attributes.merge({ field_147: 2 }) } + context "and field_133 is valid and does not expect an answer for field_134" do + let(:attributes) { field_146_attributes.merge({ field_133: 2 }) } it "does not add an error" do parser.valid? - expect(parser.errors[:field_116]).to be_blank - expect(parser.errors[:field_146]).to be_blank - expect(parser.errors[:field_147]).to be_blank - expect(parser.errors[:field_148]).to be_blank + expect(parser.errors[:field_131]).to be_blank + expect(parser.errors[:field_132]).to be_blank + expect(parser.errors[:field_133]).to be_blank + expect(parser.errors[:field_134]).to be_blank end context "and later fields are given" do - let(:attributes) { field_146_attributes.merge({ field_147: 2, field_148: 1 }) } + let(:attributes) { field_146_attributes.merge({ field_133: 2, field_134: 1 }) } it "adds errors to all referral fields" do parser.valid? - expect(parser.errors[:field_116]).to be_present - expect(parser.errors[:field_146]).to be_present - expect(parser.errors[:field_147]).to be_present - expect(parser.errors[:field_148]).to be_present + expect(parser.errors[:field_131]).to be_present + expect(parser.errors[:field_132]).to be_present + expect(parser.errors[:field_133]).to be_present + expect(parser.errors[:field_134]).to be_present end end end - context "and field_147 is invalid" do - let(:attributes) { field_146_attributes.merge({ field_147: 5 }) } # needs field_146 to be 7 + context "and field_133 is invalid" do + let(:attributes) { field_146_attributes.merge({ field_133: 5 }) } # needs field_132 to be 7 it "adds errors to all referral fields" do parser.valid? - expect(parser.errors[:field_116]).to be_present - expect(parser.errors[:field_146]).to be_present - expect(parser.errors[:field_147]).to be_present - expect(parser.errors[:field_148]).to be_present + expect(parser.errors[:field_131]).to be_present + expect(parser.errors[:field_132]).to be_present + expect(parser.errors[:field_133]).to be_present + expect(parser.errors[:field_134]).to be_present end end - context "and field_147 is blank" do - let(:attributes) { field_146_attributes.merge({ field_147: nil }) } + context "and field_133 is blank" do + let(:attributes) { field_146_attributes.merge({ field_133: nil }) } it "adds errors to all referral fields" do parser.valid? - expect(parser.errors[:field_116]).to be_present - expect(parser.errors[:field_146]).to be_present - expect(parser.errors[:field_147]).to be_present - expect(parser.errors[:field_148]).to be_present + expect(parser.errors[:field_131]).to be_present + expect(parser.errors[:field_132]).to be_present + expect(parser.errors[:field_133]).to be_present + expect(parser.errors[:field_134]).to be_present end end - context "and field_147 is valid and expects an answer for field_148" do - let(:field_147_attributes) { field_146_attributes.merge({ field_147: 1 }) } + context "and field_133 is valid and expects an answer for field_134" do + let(:field_147_attributes) { field_146_attributes.merge({ field_133: 1 }) } - context "and field_148 is valid" do - let(:attributes) { field_147_attributes.merge({ field_148: 1 }) } + context "and field_134 is valid" do + let(:attributes) { field_147_attributes.merge({ field_134: 1 }) } it "does not add an error" do parser.valid? - expect(parser.errors[:field_116]).to be_blank - expect(parser.errors[:field_146]).to be_blank - expect(parser.errors[:field_147]).to be_blank - expect(parser.errors[:field_148]).to be_blank + expect(parser.errors[:field_131]).to be_blank + expect(parser.errors[:field_132]).to be_blank + expect(parser.errors[:field_133]).to be_blank + expect(parser.errors[:field_134]).to be_blank end end - context "and field_148 is invalid" do - let(:attributes) { field_147_attributes.merge({ field_148: 11 }) } # needs field_147 to be 7 + context "and field_134 is invalid" do + let(:attributes) { field_147_attributes.merge({ field_134: 11 }) } # needs field_133 to be 7 it "adds errors to all referral fields" do parser.valid? - expect(parser.errors[:field_116]).to be_present - expect(parser.errors[:field_146]).to be_present - expect(parser.errors[:field_147]).to be_present - expect(parser.errors[:field_148]).to be_present + expect(parser.errors[:field_131]).to be_present + expect(parser.errors[:field_132]).to be_present + expect(parser.errors[:field_133]).to be_present + expect(parser.errors[:field_134]).to be_present end end - context "and field_148 is blank" do - let(:attributes) { field_147_attributes.merge({ field_148: nil }) } + context "and field_134 is blank" do + let(:attributes) { field_147_attributes.merge({ field_134: nil }) } it "adds errors to all referral fields" do parser.valid? - expect(parser.errors[:field_116]).to be_present - expect(parser.errors[:field_146]).to be_present - expect(parser.errors[:field_147]).to be_present - expect(parser.errors[:field_148]).to be_present + expect(parser.errors[:field_131]).to be_present + expect(parser.errors[:field_132]).to be_present + expect(parser.errors[:field_133]).to be_present + expect(parser.errors[:field_134]).to be_present end end end @@ -1373,14 +1372,14 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do end context "and is renewal" do - let(:attributes) { org_attributes.merge({ field_7: 1, field_116: 1, field_146: 5, field_147: 1, field_148: 1 }) } + let(:attributes) { org_attributes.merge({ field_7: 1, field_131: 1, field_132: 5, field_133: 1, field_134: 1 }) } it "does not add an error for referral fields" do parser.valid? - expect(parser.errors[:field_116]).to be_blank - expect(parser.errors[:field_146]).to be_blank - expect(parser.errors[:field_147]).to be_blank - expect(parser.errors[:field_148]).to be_blank + expect(parser.errors[:field_131]).to be_blank + expect(parser.errors[:field_132]).to be_blank + expect(parser.errors[:field_133]).to be_blank + expect(parser.errors[:field_134]).to be_blank end end end @@ -1691,7 +1690,7 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do it "adds a setup error" do parser.valid? - expect(parser.errors.where(:field_7, category: :setup).map(&:message)).to include(I18n.t("validations.lettings.2026.bulk_upload.invalid_option", question: "is this letting a renewal?")) + expect(parser.errors.where(:field_7, category: :setup).map(&:message)).to include(I18n.t("validations.lettings.2026.bulk_upload.invalid_option", question: "is this letting a renewal of social housing to the same tenant in the same property?")) end end end @@ -1961,7 +1960,7 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do describe "#field_48" do # age2 context "when null but gender given" do - let(:attributes) { setup_section_params.merge({ field_48: "", field_49: "F" }) } + let(:attributes) { setup_section_params.merge({ field_48: "", field_50: "F" }) } it "returns an error" do parser.valid? @@ -1970,9 +1969,9 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do end end - describe "#field_45" do - context "when field_45 is a 3 digit nationality code" do - let(:attributes) { setup_section_params.merge({ field_45: "036" }) } + describe "#field_46" do + context "when field_46 is a 3 digit nationality code" do + let(:attributes) { setup_section_params.merge({ field_46: "036" }) } it "is correctly set" do expect(parser.log.nationality_all).to be(36) @@ -1980,8 +1979,8 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do end end - context "when field_45 is a nationality code without the trailing 0s" do - let(:attributes) { setup_section_params.merge({ field_45: "36" }) } + context "when field_46 is a nationality code without the trailing 0s" do + let(:attributes) { setup_section_params.merge({ field_46: "36" }) } it "is correctly set" do expect(parser.log.nationality_all).to be(36) @@ -1989,8 +1988,8 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do end end - context "when field_45 is a nationality code with trailing 0s" do - let(:attributes) { setup_section_params.merge({ field_45: "0036" }) } + context "when field_46 is a nationality code with trailing 0s" do + let(:attributes) { setup_section_params.merge({ field_46: "0036" }) } it "is correctly set" do expect(parser.log.nationality_all).to be(36) @@ -1998,8 +1997,8 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do end end - context "when field_45 is 0" do - let(:attributes) { setup_section_params.merge({ field_45: "0" }) } + context "when field_46 is 0" do + let(:attributes) { setup_section_params.merge({ field_46: "0" }) } it "is correctly set" do expect(parser.log.nationality_all).to be(0) @@ -2007,8 +2006,8 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do end end - context "when field_45 is 000" do - let(:attributes) { setup_section_params.merge({ field_45: "000" }) } + context "when field_46 is 000" do + let(:attributes) { setup_section_params.merge({ field_46: "000" }) } it "is correctly set" do expect(parser.log.nationality_all).to be(0) @@ -2016,8 +2015,8 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do end end - context "when field_45 is 0000" do - let(:attributes) { setup_section_params.merge({ field_45: "0000" }) } + context "when field_46 is 0000" do + let(:attributes) { setup_section_params.merge({ field_46: "0000" }) } it "is correctly set" do expect(parser.log.nationality_all).to be(0) @@ -2025,8 +2024,8 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do end end - context "when field_45 is 826" do - let(:attributes) { setup_section_params.merge({ field_45: "826" }) } + context "when field_46 is 826" do + let(:attributes) { setup_section_params.merge({ field_46: "826" }) } it "is correctly set" do expect(parser.log.nationality_all).to be(826) @@ -2034,8 +2033,8 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do end end - context "when field_45 is 826 with trailing 0s" do - let(:attributes) { setup_section_params.merge({ field_45: "0826" }) } + context "when field_46 is 826 with trailing 0s" do + let(:attributes) { setup_section_params.merge({ field_46: "0826" }) } it "is correctly set" do expect(parser.log.nationality_all).to be(826) @@ -2043,79 +2042,79 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do end end - context "when field_45 is not a valid option" do - let(:attributes) { setup_section_params.merge({ field_45: "123123" }) } + context "when field_46 is not a valid option" do + let(:attributes) { setup_section_params.merge({ field_46: "123123" }) } it "is correctly set" do expect(parser.log.nationality_all).to be_nil expect(parser.log.nationality_all_group).to be_nil end - it "adds an error to field_45" do + it "adds an error to field_46" do parser.valid? - expect(parser.errors["field_45"]).to include(I18n.t("validations.lettings.2026.bulk_upload.nationality.invalid")) + expect(parser.errors["field_46"]).to include(I18n.t("validations.lettings.2026.bulk_upload.nationality.invalid")) end end end describe "soft validations" do context "when soft validation is triggered" do - let(:attributes) { setup_section_params.merge({ field_42: 22, field_46: 5 }) } + let(:attributes) { setup_section_params.merge({ field_41: 22, field_47: 5 }) } it "adds an error to the relevant fields" do parser.valid? - expect(parser.errors.where(:field_42, category: :soft_validation)).to be_present - expect(parser.errors.where(:field_46, category: :soft_validation)).to be_present + expect(parser.errors.where(:field_41, category: :soft_validation)).to be_present + expect(parser.errors.where(:field_47, category: :soft_validation)).to be_present end it "populates with correct error message" do parser.valid? - expect(parser.errors.where(:field_42, category: :soft_validation).first.message).to eql("You told us this person is aged 22 years and retired. The minimum expected retirement age in England is 66.") - expect(parser.errors.where(:field_46, category: :soft_validation).first.message).to eql("You told us this person is aged 22 years and retired. The minimum expected retirement age in England is 66.") + expect(parser.errors.where(:field_41, category: :soft_validation).first.message).to eql("You told us this person is aged 22 years and retired. The minimum expected retirement age in England is 66.") + expect(parser.errors.where(:field_47, category: :soft_validation).first.message).to eql("You told us this person is aged 22 years and retired. The minimum expected retirement age in England is 66.") end end context "when a soft validation is triggered that relates both to fields that are and are not routed to" do - let(:attributes) { setup_section_params.merge({ field_78: "1", field_43: "M", field_49: "M", field_53: "M", field_130: 1, field_132: 1, field_134: 1 }) } + let(:attributes) { setup_section_params.merge({ field_93: "1", field_42: "M", field_50: "M", field_56: "M", field_43: 1, field_51: 1, field_57: 1 }) } it "adds errors to fields that are routed to" do parser.valid? + expect(parser.errors.where(:field_42, category: :soft_validation)).to be_present expect(parser.errors.where(:field_43, category: :soft_validation)).to be_present - expect(parser.errors.where(:field_130, category: :soft_validation)).to be_present - expect(parser.errors.where(:field_49, category: :soft_validation)).to be_present - expect(parser.errors.where(:field_132, category: :soft_validation)).to be_present + expect(parser.errors.where(:field_50, category: :soft_validation)).to be_present + expect(parser.errors.where(:field_51, 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_57, category: :soft_validation)).not_to be_present - expect(parser.errors.where(:field_136, category: :soft_validation)).not_to be_present - expect(parser.errors.where(:field_61, category: :soft_validation)).not_to be_present - expect(parser.errors.where(:field_138, category: :soft_validation)).not_to be_present + expect(parser.errors.where(:field_62, category: :soft_validation)).not_to be_present + expect(parser.errors.where(:field_63, category: :soft_validation)).not_to be_present + expect(parser.errors.where(:field_68, category: :soft_validation)).not_to be_present + expect(parser.errors.where(:field_69, category: :soft_validation)).not_to be_present end end context "when soft validation is triggered and not required" do - let(:attributes) { setup_section_params.merge({ field_124: 120, field_125: 120, field_126: 120, field_127: 120, field_123: 1, field_29: 1, field_4: 1, field_11: "2", field_25: "E09000008" }) } + let(:attributes) { setup_section_params.merge({ field_142: 120, field_143: 120, field_144: 120, field_145: 120, field_141: 1, field_28: 1, field_4: 1, field_11: "2", field_25: "E09000008" }) } it "adds an error to the relevant fields" do parser.valid? - expect(parser.errors.where(:field_124, category: :soft_validation)).to be_present + expect(parser.errors.where(:field_142, category: :soft_validation)).to be_present end it "populates with correct error message" do parser.valid? - expect(parser.errors.where(:field_124, category: :soft_validation).count).to be(1) - expect(parser.errors.where(:field_124, category: :soft_validation).first.message).to eql("You told us the rent is £120.00 every week. This is higher than we would expect.") + expect(parser.errors.where(:field_142, category: :soft_validation).count).to be(1) + expect(parser.errors.where(:field_142, 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 end context "when an invalid ecstat1 is given" do - let(:attributes) { setup_section_params.merge({ field_46: 11, field_119: 123, field_118: 1 }) } + let(:attributes) { setup_section_params.merge({ field_47: 11, field_137: 123, field_136: 1 }) } it "does not run net income soft validations validation" do parser.valid? - expect(parser.errors.where(:field_46).count).to be(1) + expect(parser.errors.where(:field_47).count).to be(1) end end end @@ -2232,14 +2231,14 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do end [ - %w[age1_known details_known_1 age1 field_42 field_47 field_49], - %w[age2_known details_known_2 age2 field_48 field_47 field_49], - %w[age3_known details_known_3 age3 field_52 field_51 field_53], - %w[age4_known details_known_4 age4 field_56 field_55 field_57], - %w[age5_known details_known_5 age5 field_60 field_59 field_61], - %w[age6_known details_known_6 age6 field_64 field_63 field_65], - %w[age7_known details_known_7 age7 field_68 field_67 field_69], - %w[age8_known details_known_8 age8 field_72 field_71 field_73], + %w[age1_known details_known_1 age1 field_41 field_49 field_50], + %w[age2_known details_known_2 age2 field_48 field_49 field_50], + %w[age3_known details_known_3 age3 field_54 field_55 field_56], + %w[age4_known details_known_4 age4 field_60 field_61 field_62], + %w[age5_known details_known_5 age5 field_66 field_67 field_68], + %w[age6_known details_known_6 age6 field_72 field_73 field_74], + %w[age7_known details_known_7 age7 field_78 field_79 field_80], + %w[age8_known details_known_8 age8 field_84 field_85 field_86], ].each do |known, details_known, age, field, relationship, gender| describe "##{known} and ##{age}" do context "when #{field} is blank" do @@ -2341,141 +2340,141 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do describe "#beds" do context "when property is a bedsit" do - let(:attributes) { setup_section_params.merge({ field_26: 2, field_29: 2 }) } + let(:attributes) { setup_section_params.merge({ field_26: 2, field_28: 2 }) } - it "sets value to 1 even if field_29 contradicts this" do + it "sets value to 1 even if field_28 contradicts this" do expect(parser.log.beds).to be(1) end end context "when property is not a bedsit" do - let(:attributes) { setup_section_params.merge({ field_26: 1, field_29: 2 }) } + let(:attributes) { setup_section_params.merge({ field_26: 1, field_28: 2 }) } - it "sets value to field_29" do + it "sets value to field_28" do expect(parser.log.beds).to be(2) end end end describe "#cbl" do - context "when field_112 is yes ie 1" do - let(:attributes) { { bulk_upload:, field_112: 1 } } + context "when field_127 is yes ie 1" do + let(:attributes) { { bulk_upload:, field_127: 1 } } it "sets value to 1" do expect(parser.log.cbl).to be(1) end end - context "when field_112 is no ie 2" do - let(:attributes) { { bulk_upload:, field_112: 2 } } + context "when field_127 is no ie 2" do + let(:attributes) { { bulk_upload:, field_127: 2 } } it "sets value to 0" do expect(parser.log.cbl).to be(0) end end - context "when field_112 is not a permitted value" do - let(:attributes) { { bulk_upload:, field_112: 3 } } + context "when field_127 is not a permitted value" do + let(:attributes) { { bulk_upload:, field_127: 3 } } it "adds an error" do parser.valid? - expect(parser.errors[:field_112]).to include(I18n.t("validations.lettings.2026.bulk_upload.invalid_option", question: "was the letting made under the Choice-Based Lettings (CBL)?")) + expect(parser.errors[:field_127]).to include(I18n.t("validations.lettings.2026.bulk_upload.invalid_option", question: "was the letting made under the Choice-Based Lettings (CBL)?")) end end end describe "#chr" do - context "when field_114 is yes ie 1" do - let(:attributes) { { bulk_upload:, field_114: 1 } } + context "when field_129 is yes ie 1" do + let(:attributes) { { bulk_upload:, field_129: 1 } } it "sets value to 1" do expect(parser.log.chr).to be(1) end end - context "when field_114 is no ie 2" do - let(:attributes) { { bulk_upload:, field_114: 2 } } + context "when field_129 is no ie 2" do + let(:attributes) { { bulk_upload:, field_129: 2 } } it "sets value to 0" do expect(parser.log.chr).to be(0) end end - context "when field_114 is not a permitted value" do - let(:attributes) { { bulk_upload:, field_114: 3 } } + context "when field_129 is not a permitted value" do + let(:attributes) { { bulk_upload:, field_129: 3 } } it "adds an error" do parser.valid? - expect(parser.errors[:field_114]).to include(I18n.t("validations.lettings.2026.bulk_upload.invalid_option", question: "was the letting made under the Common Housing Register (CHR)?")) + expect(parser.errors[:field_129]).to include(I18n.t("validations.lettings.2026.bulk_upload.invalid_option", question: "was the letting made under the Common Housing Register (CHR)?")) end end end describe "#cap" do - context "when field_113 is yes ie 1" do - let(:attributes) { { bulk_upload:, field_113: 1 } } + context "when field_128 is yes ie 1" do + let(:attributes) { { bulk_upload:, field_128: 1 } } it "sets value to 1" do expect(parser.log.cap).to be(1) end end - context "when field_113 is no ie 2" do - let(:attributes) { { bulk_upload:, field_113: 2 } } + context "when field_128 is no ie 2" do + let(:attributes) { { bulk_upload:, field_128: 2 } } it "sets value to 0" do expect(parser.log.cap).to be(0) end end - context "when field_113 is not a permitted value" do - let(:attributes) { { bulk_upload:, field_113: 3 } } + context "when field_128 is not a permitted value" do + let(:attributes) { { bulk_upload:, field_128: 3 } } it "adds an error" do parser.valid? - expect(parser.errors[:field_113]).to include(I18n.t("validations.lettings.2026.bulk_upload.invalid_option", question: "was the letting made under the Common Allocation Policy (CAP)?")) + expect(parser.errors[:field_128]).to include(I18n.t("validations.lettings.2026.bulk_upload.invalid_option", question: "was the letting made under the Common Allocation Policy (CAP)?")) end end end describe "#accessible_register" do - context "when field_115 is yes ie 1" do - let(:attributes) { { bulk_upload:, field_115: 1 } } + context "when field_130 is yes ie 1" do + let(:attributes) { { bulk_upload:, field_130: 1 } } it "sets value to 1" do expect(parser.log.accessible_register).to be(1) end end - context "when field_115 is no ie 2" do - let(:attributes) { { bulk_upload:, field_115: 2 } } + context "when field_130 is no ie 2" do + let(:attributes) { { bulk_upload:, field_130: 2 } } it "sets value to 0" do expect(parser.log.accessible_register).to be(0) end end - context "when field_115 is not a permitted value" do - let(:attributes) { { bulk_upload:, field_115: 3 } } + context "when field_130 is not a permitted value" do + let(:attributes) { { bulk_upload:, field_130: 3 } } it "adds an error" do parser.valid? - expect(parser.errors[:field_115]).to include(I18n.t("validations.lettings.2026.bulk_upload.invalid_option", question: "was the letting made under the Accessible Register?")) + expect(parser.errors[:field_130]).to include(I18n.t("validations.lettings.2026.bulk_upload.invalid_option", question: "was the letting made under the Accessible Register?")) end end end describe "#letting_allocation_unknown" do - 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 } } + context "when field_127, 113, 114, 115 are no ie 2" do + let(:attributes) { { bulk_upload:, field_127: 2, field_128: 2, field_129: 2, field_130: 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, 113, 114, 115 is yes ie 1" do - let(:attributes) { { bulk_upload:, field_115: 1 } } + context "when any one of field_127, 113, 114, 115 is yes ie 1" do + let(:attributes) { { bulk_upload:, field_130: 1 } } it "sets value to 0" do expect(parser.log.letting_allocation_unknown).to be(0) @@ -2497,14 +2496,14 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do let(:attributes) do { bulk_upload:, - field_43: "F", - field_49: "M", - field_53: "X", - field_57: "R", - field_61: "F", - field_65: "M", - field_69: "X", - field_73: "R", + field_42: "F", + field_50: "M", + field_56: "X", + field_62: "R", + field_68: "F", + field_74: "M", + field_80: "X", + field_86: "R", } end @@ -2524,14 +2523,14 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do let(:attributes) do { bulk_upload:, - field_46: "1", - field_50: "2", - field_54: "6", - field_58: "7", - field_62: "8", - field_66: "9", - field_70: "0", - field_74: "10", + field_47: "1", + field_53: "2", + field_59: "6", + field_65: "7", + field_71: "8", + field_77: "9", + field_83: "0", + field_89: "10", } end @@ -2551,13 +2550,13 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do let(:attributes) do { bulk_upload:, - field_47: "1", - field_51: "2", + field_49: "1", field_55: "2", - field_59: "3", - field_63: "1", - field_67: "2", - field_71: "2", + field_61: "2", + field_67: "3", + field_73: "1", + field_79: "2", + field_85: "2", } end @@ -2574,7 +2573,7 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do describe "#net_income_known" do context "when 1" do - let(:attributes) { { bulk_upload:, field_117: "1" } } + let(:attributes) { { bulk_upload:, field_135: "1" } } it "sets value from correct mapping" do expect(parser.log.net_income_known).to eq(0) @@ -2582,7 +2581,7 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do end context "when 2" do - let(:attributes) { { bulk_upload:, field_117: "2" } } + let(:attributes) { { bulk_upload:, field_135: "2" } } it "sets value from correct mapping" do expect(parser.log.net_income_known).to eq(1) @@ -2590,7 +2589,7 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do end context "when 3" do - let(:attributes) { { bulk_upload:, field_117: "3" } } + let(:attributes) { { bulk_upload:, field_135: "3" } } it "sets value from correct mapping" do expect(parser.log.net_income_known).to eq(2) @@ -2615,7 +2614,7 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do end describe "#sheltered" do - let(:attributes) { { bulk_upload:, field_36: "1" } } + let(:attributes) { { bulk_upload:, field_35: "1" } } it "sets value from correct mapping" do expect(parser.log.sheltered).to eq(1) @@ -2624,16 +2623,16 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do describe "illness fields" do mapping = [ - { attribute: :illness_type_1, field: :field_94 }, - { attribute: :illness_type_2, field: :field_88 }, - { attribute: :illness_type_3, field: :field_91 }, - { attribute: :illness_type_4, field: :field_86 }, - { attribute: :illness_type_5, field: :field_87 }, - { attribute: :illness_type_6, field: :field_89 }, - { attribute: :illness_type_7, field: :field_90 }, - { attribute: :illness_type_8, field: :field_93 }, - { attribute: :illness_type_9, field: :field_92 }, - { attribute: :illness_type_10, field: :field_95 }, + { attribute: :illness_type_1, field: :field_109 }, + { attribute: :illness_type_2, field: :field_103 }, + { attribute: :illness_type_3, field: :field_106 }, + { attribute: :illness_type_4, field: :field_101 }, + { attribute: :illness_type_5, field: :field_102 }, + { attribute: :illness_type_6, field: :field_104 }, + { attribute: :illness_type_7, field: :field_105 }, + { attribute: :illness_type_8, field: :field_108 }, + { attribute: :illness_type_9, field: :field_107 }, + { attribute: :illness_type_10, field: :field_110 }, ] mapping.each do |hash| @@ -2666,7 +2665,7 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do end describe "#tenancyother" do - let(:attributes) { { bulk_upload:, field_40: "some other tenancy" } } + let(:attributes) { { bulk_upload:, field_39: "some other tenancy" } } it "sets value to given free text string" do expect(parser.log.tenancyother).to eql("some other tenancy") @@ -2674,7 +2673,7 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do end describe "#tenancylength" do - let(:attributes) { { bulk_upload:, field_41: "2" } } + let(:attributes) { { bulk_upload:, field_40: "2" } } it "sets value to given free text string" do expect(parser.log.tenancylength).to eq(2) @@ -2682,7 +2681,7 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do end describe "#earnings" do - let(:attributes) { { bulk_upload:, field_119: "104.50" } } + let(:attributes) { { bulk_upload:, field_137: "104.50" } } it "rounds to the nearest whole pound" do expect(parser.log.earnings).to eq(105) @@ -2691,7 +2690,7 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do describe "#reasonother" do context "when reason is 'Other'" do - let(:attributes) { { bulk_upload:, field_98: "20", field_99: "some other reason" } } + let(:attributes) { { bulk_upload:, field_113: "20", field_114: "some other reason" } } it "is set to given free text string" do expect(parser.log.reasonother).to eql("some other reason") @@ -2699,7 +2698,7 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do end context "when reason is not 'Other'" do - let(:attributes) { { bulk_upload:, field_98: "50", field_99: "some other reason" } } + let(:attributes) { { bulk_upload:, field_113: "50", field_114: "some other reason" } } it "is set to nil" do expect(parser.log.reasonother).to be_nil @@ -2708,7 +2707,7 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do end describe "#ppcodenk" do - let(:attributes) { { bulk_upload:, field_102: "2" } } + let(:attributes) { { bulk_upload:, field_117: "2" } } it "sets correct value from mapping" do expect(parser.log.ppcodenk).to eq(1) @@ -2717,7 +2716,7 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do describe "#household_charge" do context "when log is general needs" do - let(:attributes) { { bulk_upload:, field_4: 1, field_122: "1" } } + let(:attributes) { { bulk_upload:, field_4: 1, field_140: "1" } } it "sets correct value from mapping" do expect(parser.log.household_charge).to be_nil @@ -2725,7 +2724,7 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do end context "when log is supported housing" do - let(:attributes) { { bulk_upload:, field_4: 2, field_122: "1" } } + let(:attributes) { { bulk_upload:, field_4: 2, field_140: "1" } } it "sets correct value from mapping" do expect(parser.log.household_charge).to eq(1) @@ -2734,14 +2733,14 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do end describe "#supcharg" do - let(:attributes) { setup_section_params.merge({ field_124: "330", field_125: "0", field_126: "0", field_127: "123.45" }) } + let(:attributes) { setup_section_params.merge({ field_142: "330", field_143: "0", field_144: "0", field_145: "123.45" }) } it "sets value given" do expect(parser.log.supcharg).to eq(123.45) end context "when other charges are not given" do - let(:attributes) { setup_section_params.merge({ field_127: "123.45", field_124: nil, field_125: nil, field_126: nil }) } + let(:attributes) { setup_section_params.merge({ field_145: "123.45", field_142: nil, field_143: nil, field_144: nil }) } it "does not set charges values" do parser.log.save! @@ -2754,15 +2753,15 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do it "adds an error to all missing charges" do parser.valid? - expect(parser.errors[:field_124]).to eql([I18n.t("validations.lettings.2026.bulk_upload.charges.missing_charges", sentence_fragment: "basic rent")]) - expect(parser.errors[:field_125]).to eql([I18n.t("validations.lettings.2026.bulk_upload.charges.missing_charges", sentence_fragment: "service charge")]) - expect(parser.errors[:field_126]).to eql([I18n.t("validations.lettings.2026.bulk_upload.charges.missing_charges", sentence_fragment: "personal service charge")]) - expect(parser.errors[:field_127]).to eql([I18n.t("validations.lettings.2026.bulk_upload.charges.related_to_missing_charge")]) + expect(parser.errors[:field_142]).to eql([I18n.t("validations.lettings.2026.bulk_upload.charges.missing_charges", sentence_fragment: "basic rent")]) + expect(parser.errors[:field_143]).to eql([I18n.t("validations.lettings.2026.bulk_upload.charges.missing_charges", sentence_fragment: "service charge")]) + expect(parser.errors[:field_144]).to eql([I18n.t("validations.lettings.2026.bulk_upload.charges.missing_charges", sentence_fragment: "personal service charge")]) + expect(parser.errors[:field_145]).to eql([I18n.t("validations.lettings.2026.bulk_upload.charges.related_to_missing_charge")]) end end context "when supscharg is not given" do - let(:attributes) { setup_section_params.merge({ field_123: 1, field_124: "350.45", field_125: "0", field_126: "0", field_127: nil }) } + let(:attributes) { setup_section_params.merge({ field_141: 1, field_142: "350.45", field_143: "0", field_144: "0", field_145: nil }) } it "does not set charges values" do parser.log.save! @@ -2776,16 +2775,16 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do it "adds an error to all charges" do parser.valid? - expect(parser.errors[:field_124]).to eql([I18n.t("validations.lettings.2026.bulk_upload.charges.related_to_missing_charge")]) - expect(parser.errors[:field_125]).to eql([I18n.t("validations.lettings.2026.bulk_upload.charges.related_to_missing_charge")]) - expect(parser.errors[:field_126]).to eql([I18n.t("validations.lettings.2026.bulk_upload.charges.related_to_missing_charge")]) - expect(parser.errors[:field_127]).to eql([I18n.t("validations.lettings.2026.bulk_upload.charges.missing_charges", sentence_fragment: "support charge")]) + expect(parser.errors[:field_142]).to eql([I18n.t("validations.lettings.2026.bulk_upload.charges.related_to_missing_charge")]) + expect(parser.errors[:field_143]).to eql([I18n.t("validations.lettings.2026.bulk_upload.charges.related_to_missing_charge")]) + expect(parser.errors[:field_144]).to eql([I18n.t("validations.lettings.2026.bulk_upload.charges.related_to_missing_charge")]) + expect(parser.errors[:field_145]).to eql([I18n.t("validations.lettings.2026.bulk_upload.charges.missing_charges", sentence_fragment: "support charge")]) end end end describe "#pscharge" do - let(:attributes) { { bulk_upload:, field_124: "111.45", field_125: "0", field_126: "123.45", field_127: "0" } } + let(:attributes) { { bulk_upload:, field_142: "111.45", field_143: "0", field_144: "123.45", field_145: "0" } } it "sets value given" do expect(parser.log.pscharge).to eq(123.45) @@ -2793,7 +2792,7 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do end describe "#scharge" do - let(:attributes) { { bulk_upload:, field_124: "111.45", field_125: "123.45", field_126: "0", field_127: "0" } } + let(:attributes) { { bulk_upload:, field_142: "111.45", field_143: "123.45", field_144: "0", field_145: "0" } } it "sets value given" do expect(parser.log.scharge).to eq(123.45) @@ -2810,7 +2809,7 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do describe "#mrcdate" do context "when valid" do - let(:attributes) { { bulk_upload:, field_33: "13", field_34: "12", field_35: "22" } } + let(:attributes) { { bulk_upload:, field_32: "13", field_33: "12", field_34: "22" } } it "sets value given" do expect(parser.log.mrcdate).to eq(Date.new(2022, 12, 13)) @@ -2818,7 +2817,7 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do end context "when valid (4 digit year)" do - let(:attributes) { { bulk_upload:, field_33: "13", field_34: "12", field_35: "2022" } } + let(:attributes) { { bulk_upload:, field_32: "13", field_33: "12", field_34: "2022" } } it "sets value given" do expect(parser.log.mrcdate).to eq(Date.new(2022, 12, 13)) @@ -2826,7 +2825,7 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do end context "when invalid" do - let(:attributes) { { bulk_upload:, field_33: "13", field_34: "13", field_35: "22" } } + let(:attributes) { { bulk_upload:, field_32: "13", field_33: "13", field_34: "22" } } it "does not raise an error" do expect { parser.log.mrcdate }.not_to raise_error @@ -2836,7 +2835,7 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do describe "#majorrepairs" do context "when mrcdate given" do - let(:attributes) { { bulk_upload:, field_33: "13", field_34: "12", field_35: "22" } } + let(:attributes) { { bulk_upload:, field_32: "13", field_33: "12", field_34: "22" } } it "sets #majorrepairs to 1" do expect(parser.log.majorrepairs).to eq(1) @@ -2844,7 +2843,7 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do end context "when mrcdate not given" do - let(:attributes) { { bulk_upload:, field_33: "", field_34: "", field_35: "", field_4: 1 } } + let(:attributes) { { bulk_upload:, field_32: "", field_33: "", field_34: "", field_4: 1 } } it "sets #majorrepairs to 0" do expect(parser.log.majorrepairs).to eq(0) @@ -2854,7 +2853,7 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do describe "#voiddate" do context "when valid" do - let(:attributes) { { bulk_upload:, field_30: "13", field_31: "12", field_32: "22" } } + let(:attributes) { { bulk_upload:, field_29: "13", field_30: "12", field_31: "22" } } it "sets value given" do expect(parser.log.voiddate).to eq(Date.new(2022, 12, 13)) @@ -2862,7 +2861,7 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do end context "when valid (4 digit year)" do - let(:attributes) { { bulk_upload:, field_30: "13", field_31: "12", field_32: "2022" } } + let(:attributes) { { bulk_upload:, field_29: "13", field_30: "12", field_31: "2022" } } it "sets value given" do expect(parser.log.voiddate).to eq(Date.new(2022, 12, 13)) @@ -2870,7 +2869,7 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do end context "when invalid" do - let(:attributes) { { bulk_upload:, field_30: "13", field_31: "13", field_32: "22" } } + let(:attributes) { { bulk_upload:, field_29: "13", field_30: "13", field_31: "22" } } it "does not raise an error" do expect { parser.log.voiddate }.not_to raise_error @@ -2911,7 +2910,7 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do end describe "#prevloc" do - let(:attributes) { { bulk_upload:, field_105: "E07000223" } } + let(:attributes) { { bulk_upload:, field_120: "E07000223" } } it "sets to given value" do expect(parser.log.prevloc).to eql("E07000223") @@ -2920,7 +2919,7 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do describe "#previous_la_known" do context "when known" do - let(:attributes) { { bulk_upload:, field_105: "E07000223" } } + let(:attributes) { { bulk_upload:, field_120: "E07000223" } } it "sets to 1" do expect(parser.log.previous_la_known).to eq(1) @@ -2928,7 +2927,7 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do end context "when not known" do - let(:attributes) { { bulk_upload:, field_105: "", field_4: 1 } } + let(:attributes) { { bulk_upload:, field_120: "", field_4: 1 } } it "sets to 0" do expect(parser.log.previous_la_known).to eq(0) @@ -2956,7 +2955,7 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do describe "#housingneeds" do context "when no disabled needs" do - let(:attributes) { { bulk_upload:, field_83: "1" } } + let(:attributes) { { bulk_upload:, field_98: "1" } } it "sets to 2" do expect(parser.log.housingneeds).to eq(2) @@ -2964,7 +2963,7 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do end context "when dont know about disabled needs" do - let(:attributes) { { bulk_upload:, field_84: "1" } } + let(:attributes) { { bulk_upload:, field_99: "1" } } it "sets to 3" do expect(parser.log.housingneeds).to eq(3) @@ -2972,7 +2971,7 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do end context "when housingneeds are given" do - let(:attributes) { { bulk_upload:, field_83: "0", field_81: "1", field_82: "1" } } + let(:attributes) { { bulk_upload:, field_98: "0", field_96: "1", field_97: "1" } } it "sets correct housingneeds" do expect(parser.log.housingneeds).to eq(1) @@ -2981,8 +2980,8 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do end end - context "when housingneeds are given and field_82 is nil" do - let(:attributes) { { bulk_upload:, field_83: nil, field_81: "1", field_82: "1" } } + context "when housingneeds are given and field_97 is nil" do + let(:attributes) { { bulk_upload:, field_98: nil, field_96: "1", field_97: "1" } } it "sets correct housingneeds" do expect(parser.log.housingneeds).to eq(1) @@ -2992,7 +2991,7 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do end context "when housingneeds are not given" do - let(:attributes) { { bulk_upload:, field_79: nil, field_80: nil, field_81: nil, field_83: nil } } + let(:attributes) { { bulk_upload:, field_94: nil, field_95: nil, field_96: nil, field_98: nil } } it "sets correct housingneeds" do expect(parser.log.housingneeds).to eq(1) @@ -3001,106 +3000,106 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do end context "when housingneeds a and b are selected" do - let(:attributes) { { bulk_upload:, field_79: "1", field_80: "1" } } + let(:attributes) { { bulk_upload:, field_94: "1", field_95: "1" } } it "sets error on housingneeds a and b" do parser.valid? - expect(parser.errors[:field_79]).to include(I18n.t("validations.lettings.2026.bulk_upload.housingneeds_type.only_one_option_permitted")) - expect(parser.errors[:field_80]).to include(I18n.t("validations.lettings.2026.bulk_upload.housingneeds_type.only_one_option_permitted")) - expect(parser.errors[:field_81]).to be_blank + expect(parser.errors[:field_94]).to include(I18n.t("validations.lettings.2026.bulk_upload.housingneeds_type.only_one_option_permitted")) + expect(parser.errors[:field_95]).to include(I18n.t("validations.lettings.2026.bulk_upload.housingneeds_type.only_one_option_permitted")) + expect(parser.errors[:field_96]).to be_blank end end context "when housingneeds a and c are selected" do - let(:attributes) { { bulk_upload:, field_79: "1", field_81: "1" } } + let(:attributes) { { bulk_upload:, field_94: "1", field_96: "1" } } it "sets error on housingneeds a and c" do parser.valid? - expect(parser.errors[:field_79]).to include(I18n.t("validations.lettings.2026.bulk_upload.housingneeds_type.only_one_option_permitted")) - expect(parser.errors[:field_81]).to include(I18n.t("validations.lettings.2026.bulk_upload.housingneeds_type.only_one_option_permitted")) - expect(parser.errors[:field_80]).to be_blank + expect(parser.errors[:field_94]).to include(I18n.t("validations.lettings.2026.bulk_upload.housingneeds_type.only_one_option_permitted")) + expect(parser.errors[:field_96]).to include(I18n.t("validations.lettings.2026.bulk_upload.housingneeds_type.only_one_option_permitted")) + expect(parser.errors[:field_95]).to be_blank end end context "when housingneeds b and c are selected" do - let(:attributes) { { bulk_upload:, field_80: "1", field_81: "1" } } + let(:attributes) { { bulk_upload:, field_95: "1", field_96: "1" } } it "sets error on housingneeds b and c" do parser.valid? - expect(parser.errors[:field_80]).to include(I18n.t("validations.lettings.2026.bulk_upload.housingneeds_type.only_one_option_permitted")) - expect(parser.errors[:field_81]).to include(I18n.t("validations.lettings.2026.bulk_upload.housingneeds_type.only_one_option_permitted")) - expect(parser.errors[:field_79]).to be_blank + expect(parser.errors[:field_95]).to include(I18n.t("validations.lettings.2026.bulk_upload.housingneeds_type.only_one_option_permitted")) + expect(parser.errors[:field_96]).to include(I18n.t("validations.lettings.2026.bulk_upload.housingneeds_type.only_one_option_permitted")) + expect(parser.errors[:field_94]).to be_blank end end context "when housingneeds a and g are selected" do - let(:attributes) { { bulk_upload:, field_79: "1", field_83: "1" } } + let(:attributes) { { bulk_upload:, field_94: "1", field_98: "1" } } it "sets error on housingneeds a and g" do parser.valid? - expect(parser.errors[:field_83]).to include(I18n.t("validations.lettings.2026.bulk_upload.housingneeds.no_disabled_needs_conjunction")) - expect(parser.errors[:field_79]).to include(I18n.t("validations.lettings.2026.bulk_upload.housingneeds.no_disabled_needs_conjunction")) - expect(parser.errors[:field_80]).to be_blank - expect(parser.errors[:field_81]).to be_blank + expect(parser.errors[:field_98]).to include(I18n.t("validations.lettings.2026.bulk_upload.housingneeds.no_disabled_needs_conjunction")) + expect(parser.errors[:field_94]).to include(I18n.t("validations.lettings.2026.bulk_upload.housingneeds.no_disabled_needs_conjunction")) + expect(parser.errors[:field_95]).to be_blank + expect(parser.errors[:field_96]).to be_blank end end context "when only housingneeds g is selected" do - let(:attributes) { { bulk_upload:, field_79: "0", field_83: "1" } } + let(:attributes) { { bulk_upload:, field_94: "0", field_98: "1" } } it "does not add any housingneeds errors" do parser.valid? - expect(parser.errors[:field_55]).to be_blank - expect(parser.errors[:field_79]).to be_blank - expect(parser.errors[:field_80]).to be_blank - expect(parser.errors[:field_81]).to be_blank + expect(parser.errors[:field_61]).to be_blank + expect(parser.errors[:field_94]).to be_blank + expect(parser.errors[:field_95]).to be_blank + expect(parser.errors[:field_96]).to be_blank end end context "when housingneeds a and h are selected" do - let(:attributes) { { bulk_upload:, field_79: "1", field_84: "1" } } + let(:attributes) { { bulk_upload:, field_94: "1", field_99: "1" } } it "sets error on housingneeds a and h" do parser.valid? - expect(parser.errors[:field_84]).to include(I18n.t("validations.lettings.2026.bulk_upload.housingneeds.dont_know_disabled_needs_conjunction")) - expect(parser.errors[:field_79]).to include(I18n.t("validations.lettings.2026.bulk_upload.housingneeds.dont_know_disabled_needs_conjunction")) - expect(parser.errors[:field_80]).to be_blank - expect(parser.errors[:field_81]).to be_blank + expect(parser.errors[:field_99]).to include(I18n.t("validations.lettings.2026.bulk_upload.housingneeds.dont_know_disabled_needs_conjunction")) + expect(parser.errors[:field_94]).to include(I18n.t("validations.lettings.2026.bulk_upload.housingneeds.dont_know_disabled_needs_conjunction")) + expect(parser.errors[:field_95]).to be_blank + expect(parser.errors[:field_96]).to be_blank end end context "when only housingneeds h is selected" do - let(:attributes) { { bulk_upload:, field_79: "0", field_84: "1" } } + let(:attributes) { { bulk_upload:, field_94: "0", field_99: "1" } } it "does not add any housingneeds errors" do parser.valid? - expect(parser.errors[:field_84]).to be_blank - expect(parser.errors[:field_79]).to be_blank - expect(parser.errors[:field_80]).to be_blank - expect(parser.errors[:field_81]).to be_blank + expect(parser.errors[:field_99]).to be_blank + expect(parser.errors[:field_94]).to be_blank + expect(parser.errors[:field_95]).to be_blank + expect(parser.errors[:field_96]).to be_blank end end end describe "#housingneeds_type" do - context "when field_79 is 1" do - let(:attributes) { { bulk_upload:, field_79: "1" } } + context "when field_94 is 1" do + let(:attributes) { { bulk_upload:, field_94: "1" } } it "set to 0" do expect(parser.log.housingneeds_type).to eq(0) end end - context "when field_80 is 1" do - let(:attributes) { { bulk_upload:, field_80: "1" } } + context "when field_95 is 1" do + let(:attributes) { { bulk_upload:, field_95: "1" } } it "set to 1" do expect(parser.log.housingneeds_type).to eq(1) end end - context "when field_81 is 1" do - let(:attributes) { { bulk_upload:, field_81: "1" } } + context "when field_96 is 1" do + let(:attributes) { { bulk_upload:, field_96: "1" } } it "set to 2" do expect(parser.log.housingneeds_type).to eq(2) @@ -3109,8 +3108,8 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do end describe "#housingneeds_other" do - context "when field_54 is 1" do - let(:attributes) { { bulk_upload:, field_82: "1" } } + context "when field_59 is 1" do + let(:attributes) { { bulk_upload:, field_97: "1" } } it "sets to 1" do expect(parser.log.housingneeds_other).to eq(1)