From 9c4b9bba6a279f20a2a0aab50a6775a464ffa290 Mon Sep 17 00:00:00 2001 From: samyou-softwire Date: Fri, 20 Feb 2026 14:05:57 +0000 Subject: [PATCH] CLDC-4203: Renumber sex/gender fields --- .../bulk_upload/lettings_log_to_csv.rb | 33 +- .../lettings/year2026/row_parser.rb | 936 +++++++++--------- .../lettings/year2026/row_parser_spec.rb | 854 ++++++++-------- 3 files changed, 910 insertions(+), 913 deletions(-) diff --git a/app/helpers/bulk_upload/lettings_log_to_csv.rb b/app/helpers/bulk_upload/lettings_log_to_csv.rb index bc851d654..d2dd06e96 100644 --- a/app/helpers/bulk_upload/lettings_log_to_csv.rb +++ b/app/helpers/bulk_upload/lettings_log_to_csv.rb @@ -144,39 +144,55 @@ class BulkUpload::LettingsLogToCsv log.tenancylength, 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.gender_same_as_sex2, + log.gender_description2, log.ecstat2, # 50 relat_number(log.relat3), log.age3 || overrides[:age3], log.sexrab3, + log.gender_same_as_sex3, + log.gender_description3, log.ecstat3, relat_number(log.relat4), log.age4 || overrides[:age4], log.sexrab4, + log.gender_same_as_sex4, + log.gender_description4, log.ecstat4, relat_number(log.relat5), log.age5 || overrides[:age5], # 60 log.sexrab5, + log.gender_same_as_sex5, + log.gender_description5, log.ecstat5, relat_number(log.relat6), log.age6 || overrides[:age6], log.sexrab6, + log.gender_same_as_sex6, # 140 + log.gender_description6, log.ecstat6, relat_number(log.relat7), log.age7 || overrides[:age7], log.sexrab7, + log.gender_same_as_sex7, + log.gender_description7, log.ecstat7, # 70 relat_number(log.relat8), log.age8 || overrides[:age8], log.sexrab8, + log.gender_same_as_sex8, + log.gender_description8, log.ecstat8, log.armedforces, log.leftreg, @@ -238,23 +254,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 diff --git a/app/services/bulk_upload/lettings/year2026/row_parser.rb b/app/services/bulk_upload/lettings/year2026/row_parser.rb index 3c43d2112..46de397d9 100644 --- a/app/services/bulk_upload/lettings/year2026/row_parser.rb +++ b/app/services/bulk_upload/lettings/year2026/row_parser.rb @@ -47,110 +47,108 @@ class BulkUpload::Lettings::Year2026::RowParser 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: "Lead tenant's sex, as registered at birth", - field_43: "Which of these best describes the lead tenant’s ethnic background?", - field_44: "What is the lead tenant’s nationality?", - field_45: "Which of these best describes the lead tenant’s working situation?", - field_46: "Is person 2 the partner of the lead tenant?", - field_47: "What is person 2’s age?", - field_48: "Person 2's sex, as registered at birth", - field_49: "Which of these best describes person 2’s working situation?", - field_50: "Is person 3 the partner of the lead tenant?", - field_51: "What is person 3’s age?", - field_52: "Person 3's sex, as registered at birth", - field_53: "Which of these best describes person 3’s working situation?", - field_54: "Is person 4 the partner of the lead tenant?", - field_55: "What is person 4’s age?", - field_56: "Person 4's sex, as registered at birth", - field_57: "Which of these best describes person 4’s working situation?", - field_58: "Is person 5 the partner of the lead tenant?", - field_59: "What is person 5’s age?", - field_60: "Person 5's sex, as registered at birth", - field_61: "Which of these best describes person 5’s working situation?", - field_62: "Is person 6 the partner of the lead tenant?", - field_63: "What is person 6’s age?", - field_64: "Person 6's sex, as registered at birth", - field_65: "Which of these best describes person 6’s working situation?", - field_66: "Is person 7 the partner of the lead tenant?", - field_67: "What is person 7’s age?", - field_68: "Person 7's sex, as registered at birth", - field_69: "Which of these best describes person 7’s working situation?", - field_70: "Is person 8 the partner of the lead tenant?", - field_71: "What is person 8’s age?", - field_72: "Person 8's sex, as registered at birth", - field_73: "Which of these best describes person 8’s working situation?", - field_74: "Does anybody in the household have links to the UK armed forces?", - field_75: "Is this person still serving in the UK armed forces?", - field_76: "Was this person seriously injured or ill as a result of serving in the UK armed forces?", - field_77: "Is anybody in the household pregnant?", - field_78: "Does anybody in the household have any disabled access needs?", - 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 a physical or mental health condition (or other illness) expected to last 12 months or more?", - field_85: "Does this person’s condition affect their dexterity?", - field_86: "Does this person’s condition affect their learning or understanding or concentrating?", - field_87: "Does this person’s condition affect their hearing?", - field_88: "Does this person’s condition affect their memory?", - field_89: "Does this person’s condition affect their mental health?", - field_90: "Does this person’s condition affect their mobility?", - field_91: "Does this person’s condition affect them socially or behaviourally?", - field_92: "Does this person’s condition affect their stamina or breathing or fatigue?", - field_93: "Does this person’s condition affect their vision?", - field_94: "Does this person’s condition affect them in another way?", - field_95: "How long has the household continuously lived in the local authority area of the new letting?", - field_96: "How long has the household been on the local authority waiting list for the new letting?", - field_97: "What is the tenant’s main reason for the household leaving their last settled home?", - field_98: "If 'Other', what was the main reason for leaving their last settled home?", - field_99: "Where was the household immediately before this letting?", - field_100: "Did the household experience homelessness immediately before this letting?", - field_101: "Do you know the postcode of the household’s last settled home?", - field_102: "What is 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 local authority of the household’s last settled home?", - field_105: "Was the household given 'reasonable preference' by the local authority?", - field_106: "Reasonable preference reason - They were homeless or about to lose their home (within 56 days)", - field_107: "Reasonable preference reason - They were living in insanitary, overcrowded or unsatisfactory housing", - field_108: "Reasonable preference reason - They needed to move on medical and welfare reasons (including disability)", - field_109: "Reasonable preference reason - They needed to move to avoid hardship to themselves or others", - field_110: "Reasonable preference reason - Don’t know", - field_111: "Was the letting made under the Choice-Based Lettings (CBL)?", - field_112: "Was the letting made under the Common Allocation Policy (CAP)?", - field_113: "Was the letting made under the Common Housing Register (CHR)?", - field_114: "Was the letting made under the Accessible Register?", - field_115: "What was the source of referral for this letting? - LA properties", - field_116: "Do you know the household’s combined total income after tax?", - field_117: "How often does the household receive income?", - field_118: "How much income does the household have in total?", - field_119: "Is the tenant likely to be receiving any of these housing-related benefits?", - field_120: "How much of the household’s income is from Universal Credit, state pensions or benefits?", - field_121: "Does the household pay rent or other charges for the accommodation?", - field_122: "How often does the household pay rent and other charges?", - field_123: "What is the basic rent?", - field_124: "What is the service charge?", - field_125: "What is the personal service charge?", - field_126: "What is the support charge?", - field_127: "After the household has received any housing-related benefits, will they still need to pay for rent and charges?", - field_128: "What do you expect the outstanding amount to be?", - - field_129: "Is the gender the lead tenant identifies with the same as their sex registered at birth?", - field_130: "If 'No', enter the lead tenant's gender identity", - field_131: "Is the gender person 2 identifies with the same as their sex registered at birth?", - field_132: "If 'No', enter person 2's gender identity", - field_133: "Is the gender person 3 identifies with the same as their sex registered at birth?", - field_134: "If 'No', enter person 3's gender identity", - field_135: "Is the gender person 4 identifies with the same as their sex registered at birth?", - field_136: "If 'No', enter person 4's gender identity", - field_137: "Is the gender person 5 identifies with the same as their sex registered at birth?", - field_138: "If 'No', enter person 5's gender identity", - field_139: "Is the gender person 6 identifies with the same as their sex registered at birth?", - field_140: "If 'No', enter person 6's gender identity", - field_141: "Is the gender person 7 identifies with the same as their sex registered at birth?", - field_142: "If 'No', enter person 7's gender identity", - field_143: "Is the gender person 8 identifies with the same as their sex registered at birth?", - field_144: "If 'No', enter person 8's gender identity", - + field_43: "Is the gender the lead tenant identifies with the same as their sex registered at birth?", + field_44: "If 'No', enter the 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: "Is person 2 the partner of the lead tenant?", + field_49: "What is person 2’s age?", + field_50: "Person 2's sex, as registered at birth", + field_51: "Is the gender 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: "Is person 3 the partner of the lead tenant?", + field_55: "What is person 3’s age?", + field_56: "Person 3's sex, as registered at birth", + field_57: "Is the gender 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: "Is person 4 the partner of the lead tenant?", + field_61: "What is person 4’s age?", + field_62: "Person 4's sex, as registered at birth", + field_63: "Is the gender 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: "Is person 5 the partner of the lead tenant?", + field_67: "What is person 5’s age?", + field_68: "Person 5's sex, as registered at birth", + field_69: "Is the gender 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: "Is person 6 the partner of the lead tenant?", + field_73: "What is person 6’s age?", + field_74: "Person 6's sex, as registered at birth", + field_75: "Is the gender 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: "Is person 7 the partner of the lead tenant?", + field_79: "What is person 7’s age?", + field_80: "Person 7's sex, as registered at birth", + field_81: "Is the gender 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: "Is person 8 the partner of the lead tenant?", + field_85: "What is person 8’s age?", + field_86: "Person 8's sex, as registered at birth", + field_87: "Is the gender 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: "Does anybody in the household have any disabled access needs?", + field_95: "Does anybody in the household have any disabled access needs?", + field_96: "Does anybody in the household have any disabled access needs?", + field_97: "Does anybody in the household have any disabled access needs?", + field_98: "Does anybody in the household have any disabled access needs?", + field_99: "Does anybody in the household have any disabled access needs?", + 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 waiting list for 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: "What is the postcode of the household’s last settled home?", + field_119: "What is the postcode of the household’s 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 insanitary, overcrowded or unsatisfactory housing", + field_124: "Reasonable preference reason - They needed to move on 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: "Was the letting made under the Choice-Based Lettings (CBL)?", + field_128: "Was the letting made under the Common Allocation Policy (CAP)?", + field_129: "Was the letting made under the Common Housing Register (CHR)?", + field_130: "Was the letting made under the Accessible Register?", + field_131: "What was the source of referral for this letting? - LA properties", + field_132: "Do you know the household’s combined total income after tax?", + field_133: "How often does the household receive income?", + field_134: "How much income does the household have in total?", + field_135: "Is the tenant likely to be receiving any of these housing-related benefits?", + field_136: "How much of the household’s income is from Universal Credit, state pensions or benefits?", + field_137: "Does the household pay rent or other charges for the accommodation?", + field_138: "How often does the household pay rent and other charges?", + field_139: "What is the basic rent?", + field_140: "What is the service charge?", + field_141: "What is the personal service charge?", + field_142: "What is the support charge?", + field_143: "After the household has received any housing-related benefits, will they still need to pay for rent and charges?", + field_144: "What do you expect the outstanding amount to be?", field_145: "What was the source of referral for this letting? - PRP properties part 1", field_146: "What was the source of referral for this letting? - PRP properties part 2", field_147: "What was the source of referral for this letting? - PRP properties part 3", @@ -216,52 +214,36 @@ class BulkUpload::Lettings::Year2026::RowParser attribute :field_15, :integer attribute :field_41, :string attribute :field_42, :string - attribute :field_43, :integer - attribute :field_44, :integer attribute :field_45, :integer attribute :field_46, :integer - attribute :field_47, :string - attribute :field_48, :string - attribute :field_49, :integer - attribute :field_50, :integer - attribute :field_51, :string - attribute :field_52, :string + attribute :field_47, :integer + attribute :field_48, :integer + attribute :field_49, :string + attribute :field_50, :string attribute :field_53, :integer attribute :field_54, :integer attribute :field_55, :string attribute :field_56, :string - attribute :field_57, :integer - attribute :field_58, :integer - attribute :field_59, :string - attribute :field_60, :string - attribute :field_61, :integer - attribute :field_62, :integer - attribute :field_63, :string - attribute :field_64, :string + attribute :field_59, :integer + attribute :field_60, :integer + attribute :field_61, :string + attribute :field_62, :string attribute :field_65, :integer attribute :field_66, :integer attribute :field_67, :string attribute :field_68, :string - attribute :field_69, :integer - attribute :field_70, :integer - attribute :field_71, :string - attribute :field_72, :string - attribute :field_73, :integer - attribute :field_74, :integer - attribute :field_75, :integer - attribute :field_76, :integer + attribute :field_71, :integer + attribute :field_72, :integer + attribute :field_73, :string + attribute :field_74, :string attribute :field_77, :integer attribute :field_78, :integer - attribute :field_79, :integer - attribute :field_80, :integer - attribute :field_81, :integer - attribute :field_82, :integer + attribute :field_79, :string + attribute :field_80, :string attribute :field_83, :integer attribute :field_84, :integer - attribute :field_85, :integer - attribute :field_86, :integer - attribute :field_87, :integer - attribute :field_88, :integer + attribute :field_85, :string + attribute :field_86, :string attribute :field_89, :integer attribute :field_90, :integer attribute :field_91, :integer @@ -271,13 +253,13 @@ class BulkUpload::Lettings::Year2026::RowParser attribute :field_95, :integer attribute :field_96, :integer attribute :field_97, :integer - attribute :field_98, :string + attribute :field_98, :integer attribute :field_99, :integer attribute :field_100, :integer attribute :field_101, :integer - attribute :field_102, :string - attribute :field_103, :string - attribute :field_104, :string + attribute :field_102, :integer + attribute :field_103, :integer + attribute :field_104, :integer attribute :field_105, :integer attribute :field_106, :integer attribute :field_107, :integer @@ -287,38 +269,54 @@ 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, :decimal - attribute :field_119, :integer - 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, :decimal - attribute :field_124, :decimal - attribute :field_125, :decimal - attribute :field_126, :decimal + attribute :field_123, :integer + attribute :field_124, :integer + attribute :field_125, :integer + attribute :field_126, :integer attribute :field_127, :integer - attribute :field_128, :decimal - - attribute :field_129, :string - attribute :field_130, :string - attribute :field_131, :string - attribute :field_132, :string - attribute :field_133, :string - attribute :field_134, :string - attribute :field_135, :string - attribute :field_136, :string + attribute :field_128, :integer + attribute :field_129, :integer + attribute :field_130, :integer + attribute :field_131, :integer + attribute :field_132, :integer + attribute :field_133, :integer + attribute :field_134, :decimal + attribute :field_135, :integer + attribute :field_136, :integer attribute :field_137, :integer - attribute :field_138, :string - attribute :field_139, :integer - attribute :field_140, :string - attribute :field_141, :integer - attribute :field_142, :string + attribute :field_138, :integer + attribute :field_139, :decimal + attribute :field_140, :decimal + attribute :field_141, :decimal + attribute :field_142, :decimal attribute :field_143, :integer - attribute :field_144, :string + attribute :field_144, :decimal + + attribute :field_43, :string + attribute :field_44, :string + attribute :field_51, :string + attribute :field_52, :string + attribute :field_57, :string + attribute :field_58, :string + attribute :field_63, :string + attribute :field_64, :string + attribute :field_69, :integer + attribute :field_70, :string + attribute :field_75, :integer + attribute :field_76, :string + attribute :field_81, :integer + attribute :field_82, :string + attribute :field_87, :integer + attribute :field_88, :string attribute :field_145, :integer attribute :field_146, :integer @@ -389,7 +387,7 @@ class BulkUpload::Lettings::Year2026::RowParser }, on: :after_log - validates :field_111, + 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, @@ -397,11 +395,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_111.present? }, + if: -> { field_127.present? }, }, on: :after_log - validates :field_112, + 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, @@ -409,11 +407,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_112.present? }, + if: -> { field_128.present? }, }, on: :after_log - validates :field_113, + 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, @@ -421,11 +419,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_113.present? }, + if: -> { field_129.present? }, }, on: :after_log - validates :field_114, + validates :field_130, presence: { message: I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "was the letting made under the Accessible Register?"), category: :not_answered, @@ -433,18 +431,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_114.present? }, + if: -> { field_130.present? }, }, 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_47, 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_51, 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_55, 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_59, 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_63, 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_67, 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_71, 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_49, 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_55, 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_61, 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_67, 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_73, 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_79, 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_85, 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 @@ -581,10 +579,10 @@ class BulkUpload::Lettings::Year2026::RowParser !supported_housing? ? "field_24" : nil, # postcode # TODO: CLDC-4119: add postcode to hash for supported housing "field_41", # age1 "field_42", # sexrab1 - "field_45", # ecstat1 + "field_47", # ecstat1 ) - if [field_123, field_124, field_125, field_126].all?(&:present?) - hash.merge({ "tcharge" => [field_123, field_124, field_125, field_126].sum }) + if [field_139, field_140, field_141, field_142].all?(&:present?) + hash.merge({ "tcharge" => [field_139, field_140, field_141, field_142].sum }) else hash end @@ -593,7 +591,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_123 field_124 field_125 field_126].each do |sub_field| + %w[field_139 field_140 field_141 field_142].each do |sub_field| errors.add(sub_field, I18n.t("#{ERROR_BASE_KEY}.spreadsheet_dupe"), category: :setup) end else @@ -702,14 +700,14 @@ private end def validate_nationality - if field_44.present? && !valid_nationality_options.include?(field_44.to_s) - errors.add(:field_44, 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_106 field_107 field_108 field_109 field_110].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] @@ -720,9 +718,9 @@ private def validate_prevten_value_when_renewal return unless renewal? - return if field_99.blank? || [6, 30, 31, 32, 33, 34, 35, 38].include?(field_99) + return if field_115.blank? || [6, 30, 31, 32, 33, 34, 35, 38].include?(field_115) - errors.add(:field_99, I18n.t("#{ERROR_BASE_KEY}.prevten.invalid")) + errors.add(:field_115, I18n.t("#{ERROR_BASE_KEY}.prevten.invalid")) end def duplicate_check_fields @@ -747,41 +745,41 @@ private end def validate_no_and_dont_know_disabled_needs_conjunction - if field_82 == 1 && field_83 == 1 - errors.add(:field_82, I18n.t("#{ERROR_BASE_KEY}.housingneeds.no_and_dont_know_disabled_needs_conjunction")) - errors.add(:field_83, 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_83 == 1 && [field_78, field_79, field_80, field_81].count(1).positive? - %i[field_83 field_78 field_79 field_80 field_81].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_82 == 1 && [field_78, field_79, field_80, field_81].count(1).positive? - %i[field_82 field_78 field_79 field_80 field_81].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_78, field_79, field_80].count(1) > 1 - %i[field_78 field_79 field_80].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_78, field_79, field_80, field_81, field_82, field_83].all?(&:blank?) - errors.add(:field_82, I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "anybody with disabled access needs.")) - errors.add(:field_81, I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "other access needs.")) - %i[field_78 field_79 field_80].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 @@ -789,16 +787,16 @@ private def validate_reasonable_preference_dont_know if rp_dontknow_conflict? - errors.add(:field_110, I18n.t("#{ERROR_BASE_KEY}.reasonpref.conflict.dont_know")) - %i[field_106 field_107 field_108 field_109].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_106 field_107 field_108 field_109 field_110] - if field_105 == 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 @@ -806,7 +804,7 @@ private end def validate_condition_effects - illness_option_fields = %i[field_93 field_87 field_90 field_85 field_86 field_88 field_89 field_92 field_91 field_94] + 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 @@ -821,12 +819,12 @@ private end def household_no_illness? - field_84 != 1 + field_100 != 1 end def validate_leaving_reason_for_renewal - if renewal? && ![50, 51, 52, 53].include?(field_97) - errors.add(:field_97, 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 @@ -967,13 +965,13 @@ private end def validate_all_charges_given - return if supported_housing? && field_123 == 1 + return if supported_housing? && field_139 == 1 blank_charge_fields, other_charge_fields = { - field_123: "basic rent", - field_124: "service charge", - field_125: "personal service charge", - field_126: "support charge", + field_139: "basic rent", + field_140: "service charge", + field_141: "personal service charge", + field_142: "support charge", }.partition { |field, _| public_send(field).blank? }.map(&:to_h) blank_charge_fields.each do |field, charge| @@ -989,7 +987,7 @@ private end def all_charges_given? - field_123.present? && field_124.present? && field_125.present? && field_126.present? + field_139.present? && field_140.present? && field_141.present? && field_142.present? end def setup_question?(question) @@ -1012,20 +1010,20 @@ private errors.add(:field_25, error_message) unless supported_housing? # la # TODO: CLDC-4119: add LA to error fields for supported housing errors.add(:field_41, error_message) # age1 errors.add(:field_42, error_message) # sexrab1 - errors.add(:field_45, error_message) # ecstat1 - errors.add(:field_121, error_message) unless general_needs? # household_charge - errors.add(:field_123, error_message) # brent - errors.add(:field_124, error_message) # scharge - errors.add(:field_125, error_message) # pscharge - errors.add(:field_126, error_message) # chcharge + errors.add(:field_47, error_message) # ecstat1 + errors.add(:field_137, error_message) unless general_needs? # household_charge + errors.add(:field_139, error_message) # brent + errors.add(:field_140, error_message) # scharge + errors.add(:field_141, error_message) # pscharge + errors.add(:field_142, error_message) # chcharge end end def field_referral_register_la_valid? if owning_organisation&.la? - [1, 2, 3, 4].include?(field_115) + [1, 2, 3, 4].include?(field_131) else - field_115.blank? + field_131.blank? end end @@ -1067,7 +1065,7 @@ private return if renewal? return if referral_fields_valid? - %i[field_115 field_145 field_146 field_147].each do |field| + %i[field_131 field_145 field_146 field_147].each do |field| errors.add(field, I18n.t("#{ERROR_BASE_KEY}.referral.invalid_option")) end end @@ -1104,119 +1102,119 @@ private age1_known: %i[field_41], age1: %i[field_41], - age2_known: %i[field_47], - age2: %i[field_47], - age3_known: %i[field_51], - age3: %i[field_51], - age4_known: %i[field_55], - age4: %i[field_55], - age5_known: %i[field_59], - age5: %i[field_59], - age6_known: %i[field_63], - age6: %i[field_63], - age7_known: %i[field_67], - age7: %i[field_67], - age8_known: %i[field_71], - age8: %i[field_71], + age2_known: %i[field_49], + age2: %i[field_49], + age3_known: %i[field_55], + age3: %i[field_55], + age4_known: %i[field_61], + age4: %i[field_61], + age5_known: %i[field_67], + age5: %i[field_67], + age6_known: %i[field_73], + age6: %i[field_73], + age7_known: %i[field_79], + age7: %i[field_79], + age8_known: %i[field_85], + age8: %i[field_85], sexrab1: %i[field_42], - sexrab2: %i[field_48], - sexrab3: %i[field_52], - sexrab4: %i[field_56], - sexrab5: %i[field_60], - sexrab6: %i[field_64], - sexrab7: %i[field_68], - sexrab8: %i[field_72], - - ethnic_group: %i[field_43], - ethnic: %i[field_43], - nationality_all: %i[field_44], - nationality_all_group: %i[field_44], - - relat2: %i[field_46], - relat3: %i[field_50], - relat4: %i[field_54], - relat5: %i[field_58], - relat6: %i[field_62], - relat7: %i[field_66], - relat8: %i[field_70], - - ecstat1: %i[field_45], - ecstat2: %i[field_49], - ecstat3: %i[field_53], - ecstat4: %i[field_57], - ecstat5: %i[field_61], - ecstat6: %i[field_65], - ecstat7: %i[field_69], - ecstat8: %i[field_73], - - armedforces: %i[field_74], - leftreg: %i[field_75], - reservist: %i[field_76], - preg_occ: %i[field_77], - housingneeds: %i[field_77], - - illness: %i[field_84], - - layear: %i[field_95], - waityear: %i[field_96], - reason: %i[field_97], - reasonother: %i[field_98], - prevten: %i[field_99], - homeless: %i[field_100], - - prevloc: %i[field_104], - previous_la_known: %i[field_104], - ppcodenk: %i[field_101], - ppostcode_full: %i[field_102 field_103], - - reasonpref: %i[field_105], - rp_homeless: %i[field_106], - rp_insan_unsat: %i[field_107], - rp_medwel: %i[field_108], - rp_hardship: %i[field_109], - rp_dontknow: %i[field_110], - - cbl: %i[field_111], - cap: %i[field_112], - chr: %i[field_113], - accessible_register: %i[field_114], - letting_allocation: %i[field_111 field_112 field_113 field_114], - - referral_register: %i[field_115 field_145], + 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_48], + relat3: %i[field_54], + relat4: %i[field_60], + relat5: %i[field_66], + relat6: %i[field_72], + relat7: %i[field_78], + relat8: %i[field_84], + + 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_145], referral_noms: %i[field_146], referral_org: %i[field_147], - net_income_known: %i[field_116], - incfreq: %i[field_117], - earnings: %i[field_118], - hb: %i[field_119], - benefits: %i[field_120], - - period: %i[field_122], - brent: %i[field_123], - scharge: %i[field_124], - pscharge: %i[field_125], - supcharg: %i[field_126], - tcharge: %i[field_123 field_124 field_125 field_126], - household_charge: %i[field_121], - hbrentshortfall: %i[field_127], - tshortfall: %i[field_128], + net_income_known: %i[field_132], + incfreq: %i[field_133], + earnings: %i[field_134], + hb: %i[field_135], + benefits: %i[field_136], + + period: %i[field_138], + brent: %i[field_139], + scharge: %i[field_140], + pscharge: %i[field_141], + supcharg: %i[field_142], + tcharge: %i[field_139 field_140 field_141 field_142], + household_charge: %i[field_137], + hbrentshortfall: %i[field_143], + tshortfall: %i[field_144], unitletas: %i[field_17], rsnvac: %i[field_16], sheltered: %i[field_35], - illness_type_1: %i[field_93], - illness_type_2: %i[field_87], - illness_type_3: %i[field_90], - illness_type_4: %i[field_85], - illness_type_5: %i[field_86], - illness_type_6: %i[field_88], - illness_type_7: %i[field_89], - illness_type_8: %i[field_92], - illness_type_9: %i[field_91], - illness_type_10: %i[field_94], + 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], @@ -1234,22 +1232,22 @@ private county: [:field_22], uprn_selection: [:field_19], - gender_same_as_sex1: %i[field_129], - gender_same_as_sex2: %i[field_130], - gender_same_as_sex3: %i[field_131], - gender_same_as_sex4: %i[field_132], - gender_same_as_sex5: %i[field_133], - gender_same_as_sex6: %i[field_134], - gender_same_as_sex7: %i[field_135], - gender_same_as_sex8: %i[field_136], - gender_description1: %i[field_137], - gender_description2: %i[field_138], - gender_description3: %i[field_139], - gender_description4: %i[field_140], - gender_description5: %i[field_141], - gender_description6: %i[field_142], - gender_description7: %i[field_143], - gender_description8: %i[field_144], + gender_same_as_sex1: %i[field_43], + gender_same_as_sex2: %i[field_44], + gender_same_as_sex3: %i[field_51], + gender_same_as_sex4: %i[field_52], + gender_same_as_sex5: %i[field_57], + gender_same_as_sex6: %i[field_58], + gender_same_as_sex7: %i[field_63], + gender_same_as_sex8: %i[field_64], + gender_description1: %i[field_69], + gender_description2: %i[field_70], + gender_description3: %i[field_75], + gender_description4: %i[field_76], + gender_description5: %i[field_81], + gender_description6: %i[field_82], + gender_description7: %i[field_87], + gender_description8: %i[field_88], }.compact end @@ -1290,56 +1288,56 @@ private 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_47 if attributes["age2_known"]&.zero? && field_47&.match(/\A\d{1,3}\z|\AR\z/) + attributes["age2"] = field_49 if attributes["age2_known"]&.zero? && field_49&.match(/\A\d{1,3}\z|\AR\z/) attributes["age3_known"] = age3_known? - attributes["age3"] = field_51 if attributes["age3_known"]&.zero? && field_51&.match(/\A\d{1,3}\z|\AR\z/) + attributes["age3"] = field_55 if attributes["age3_known"]&.zero? && field_55&.match(/\A\d{1,3}\z|\AR\z/) attributes["age4_known"] = age4_known? - attributes["age4"] = field_55 if attributes["age4_known"]&.zero? && field_55&.match(/\A\d{1,3}\z|\AR\z/) + attributes["age4"] = field_61 if attributes["age4_known"]&.zero? && field_61&.match(/\A\d{1,3}\z|\AR\z/) attributes["age5_known"] = age5_known? - attributes["age5"] = field_59 if attributes["age5_known"]&.zero? && field_59&.match(/\A\d{1,3}\z|\AR\z/) + attributes["age5"] = field_67 if attributes["age5_known"]&.zero? && field_67&.match(/\A\d{1,3}\z|\AR\z/) attributes["age6_known"] = age6_known? - attributes["age6"] = field_63 if attributes["age6_known"]&.zero? && field_63&.match(/\A\d{1,3}\z|\AR\z/) + attributes["age6"] = field_73 if attributes["age6_known"]&.zero? && field_73&.match(/\A\d{1,3}\z|\AR\z/) attributes["age7_known"] = age7_known? - attributes["age7"] = field_67 if attributes["age7_known"]&.zero? && field_67&.match(/\A\d{1,3}\z|\AR\z/) + attributes["age7"] = field_79 if attributes["age7_known"]&.zero? && field_79&.match(/\A\d{1,3}\z|\AR\z/) attributes["age8_known"] = age8_known? - attributes["age8"] = field_71 if attributes["age8_known"]&.zero? && field_71&.match(/\A\d{1,3}\z|\AR\z/) + attributes["age8"] = field_85 if attributes["age8_known"]&.zero? && field_85&.match(/\A\d{1,3}\z|\AR\z/) attributes["sexrab1"] = field_42 - attributes["sexrab2"] = field_48 - attributes["sexrab3"] = field_52 - attributes["sexrab4"] = field_56 - attributes["sexrab5"] = field_60 - attributes["sexrab6"] = field_64 - attributes["sexrab7"] = field_68 - attributes["sexrab8"] = field_72 + 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_43 - attributes["nationality_all"] = field_44 if field_44.present? && valid_nationality_options.include?(field_44.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_46) - attributes["relat3"] = relationship_from_input_value(field_50) - attributes["relat4"] = relationship_from_input_value(field_54) - attributes["relat5"] = relationship_from_input_value(field_58) - attributes["relat6"] = relationship_from_input_value(field_62) - attributes["relat7"] = relationship_from_input_value(field_66) - attributes["relat8"] = relationship_from_input_value(field_70) - - attributes["ecstat1"] = field_45 - attributes["ecstat2"] = field_49 - attributes["ecstat3"] = field_53 - attributes["ecstat4"] = field_57 - attributes["ecstat5"] = field_61 - attributes["ecstat6"] = field_65 - attributes["ecstat7"] = field_69 - attributes["ecstat8"] = field_73 + attributes["relat2"] = relationship_from_input_value(field_48) + attributes["relat3"] = relationship_from_input_value(field_54) + attributes["relat4"] = relationship_from_input_value(field_60) + attributes["relat5"] = relationship_from_input_value(field_66) + attributes["relat6"] = relationship_from_input_value(field_72) + attributes["relat7"] = relationship_from_input_value(field_78) + attributes["relat8"] = relationship_from_input_value(field_84) + + 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) @@ -1349,36 +1347,36 @@ private attributes["details_known_7"] = details_known?(7) attributes["details_known_8"] = details_known?(8) - attributes["armedforces"] = field_74 + attributes["armedforces"] = field_90 attributes["leftreg"] = leftreg - attributes["reservist"] = field_76 + attributes["reservist"] = field_92 - attributes["preg_occ"] = field_77 + attributes["preg_occ"] = field_93 attributes["housingneeds"] = housingneeds attributes["housingneeds_type"] = housingneeds_type attributes["housingneeds_other"] = housingneeds_other - attributes["illness"] = field_84 + attributes["illness"] = field_100 - attributes["layear"] = field_95 - attributes["waityear"] = field_96 - attributes["reason"] = field_97 - attributes["reasonother"] = field_98 if reason_is_other? - attributes["prevten"] = field_99 - attributes["homeless"] = field_100 + 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_105 - attributes["rp_homeless"] = field_106 unless rp_dontknow_conflict? - attributes["rp_insan_unsat"] = field_107 unless rp_dontknow_conflict? - attributes["rp_medwel"] = field_108 unless rp_dontknow_conflict? - attributes["rp_hardship"] = field_109 unless rp_dontknow_conflict? - attributes["rp_dontknow"] = field_110 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 @@ -1392,19 +1390,19 @@ private attributes["net_income_known"] = net_income_known attributes["earnings"] = earnings - attributes["incfreq"] = field_117 - attributes["hb"] = field_119 - attributes["benefits"] = field_120 - - attributes["period"] = field_122 - attributes["brent"] = field_123 if all_charges_given? - attributes["scharge"] = field_124 if all_charges_given? - attributes["pscharge"] = field_125 if all_charges_given? - attributes["supcharg"] = field_126 if all_charges_given? - attributes["household_charge"] = supported_housing? ? field_121 : nil - attributes["hbrentshortfall"] = field_127 + attributes["incfreq"] = field_133 + attributes["hb"] = field_135 + attributes["benefits"] = field_136 + + attributes["period"] = field_138 + attributes["brent"] = field_139 if all_charges_given? + attributes["scharge"] = field_140 if all_charges_given? + attributes["pscharge"] = field_141 if all_charges_given? + attributes["supcharg"] = field_142 if all_charges_given? + attributes["household_charge"] = supported_housing? ? field_137 : nil + attributes["hbrentshortfall"] = field_143 attributes["tshortfall_known"] = tshortfall_known - attributes["tshortfall"] = field_128 + attributes["tshortfall"] = field_144 attributes["hhmemb"] = hhmemb @@ -1412,16 +1410,16 @@ private attributes["rsnvac"] = rsnvac attributes["sheltered"] = field_35 - attributes["illness_type_1"] = field_93 - attributes["illness_type_2"] = field_87 - attributes["illness_type_3"] = field_90 - attributes["illness_type_4"] = field_85 - attributes["illness_type_5"] = field_86 - attributes["illness_type_6"] = field_88 - attributes["illness_type_7"] = field_89 - attributes["illness_type_8"] = field_92 - attributes["illness_type_9"] = field_91 - attributes["illness_type_10"] = field_94 + 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 @@ -1456,22 +1454,22 @@ private attributes["postcode_full_input"] = postcode_full attributes["select_best_address_match"] = true if field_18.blank? - attributes["gender_same_as_sex1"] = field_129 - attributes["gender_description1"] = field_130 - attributes["gender_same_as_sex2"] = field_131 - attributes["gender_description2"] = field_132 - attributes["gender_same_as_sex3"] = field_133 - attributes["gender_description3"] = field_134 - attributes["gender_same_as_sex4"] = field_135 - attributes["gender_description4"] = field_136 - attributes["gender_same_as_sex5"] = field_137 - attributes["gender_description5"] = field_138 - attributes["gender_same_as_sex6"] = field_139 - attributes["gender_description6"] = field_140 - attributes["gender_same_as_sex7"] = field_141 - attributes["gender_description7"] = field_142 - attributes["gender_same_as_sex8"] = field_143 - attributes["gender_description8"] = field_144 + 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 @@ -1535,9 +1533,9 @@ private end def ethnic_group_from_ethnic - return nil if field_43.blank? + return nil if field_45.blank? - case field_43 + case field_45 when 1, 2, 3, 18, 20 0 when 4, 5, 6, 7 @@ -1560,13 +1558,13 @@ private end [ - { person: 2, field: :field_47 }, - { person: 3, field: :field_51 }, - { person: 4, field: :field_55 }, - { person: 5, field: :field_59 }, - { person: 6, field: :field_63 }, - { person: 7, field: :field_67 }, - { person: 8, field: :field_71 }, + { person: 2, field: :field_49 }, + { person: 3, field: :field_55 }, + { person: 4, field: :field_61 }, + { person: 5, field: :field_67 }, + { person: 6, field: :field_73 }, + { person: 7, field: :field_79 }, + { person: 8, field: :field_85 }, ].each do |hash| define_method("age#{hash[:person]}_known?") do return 1 if public_send(hash[:field]) == "R" @@ -1579,53 +1577,53 @@ private end def person_2_present? - field_46.present? || field_47.present? || field_48.present? || field_131.present? || field_132.present? + field_48.present? || field_49.present? || field_50.present? || field_51.present? || field_52.present? end def person_3_present? - field_50.present? || field_51.present? || field_52.present? || field_133.present? || field_134.present? + field_54.present? || field_55.present? || field_56.present? || field_57.present? || field_58.present? end def person_4_present? - field_54.present? || field_55.present? || field_56.present? || field_135.present? || field_136.present? + field_60.present? || field_61.present? || field_62.present? || field_63.present? || field_64.present? end def person_5_present? - field_58.present? || field_59.present? || field_60.present? || field_137.present? || field_138.present? + field_66.present? || field_67.present? || field_68.present? || field_69.present? || field_70.present? end def person_6_present? - field_62.present? || field_63.present? || field_64.present? || field_139.present? || field_140.present? + field_72.present? || field_73.present? || field_74.present? || field_75.present? || field_76.present? end def person_7_present? - field_66.present? || field_67.present? || field_68.present? || field_141.present? || field_142.present? + field_78.present? || field_79.present? || field_80.present? || field_81.present? || field_82.present? end def person_8_present? - field_70.present? || field_71.present? || field_72.present? || field_143.present? || field_144.present? + field_84.present? || field_85.present? || field_86.present? || field_87.present? || field_88.present? end def leftreg - field_75 + field_91 end def housingneeds - if field_82 == 1 + if field_98 == 1 2 - elsif field_83 == 1 + elsif field_99 == 1 3 - elsif field_82.blank? || field_82&.zero? + elsif field_98.blank? || field_98&.zero? 1 end end def housingneeds_type - if field_78 == 1 + if field_94 == 1 0 - elsif field_79 == 1 + elsif field_95 == 1 1 - elsif field_80 == 1 + elsif field_96 == 1 2 else 3 @@ -1633,12 +1631,12 @@ private end def housingneeds_other - return 1 if field_81 == 1 - return 0 if [field_78, field_79, field_80].include?(1) + return 1 if field_97 == 1 + return 0 if [field_94, field_95, field_96].include?(1) end def prevloc - field_104 + field_120 end def previous_la_known @@ -1646,7 +1644,7 @@ private end def ppcodenk - case field_101 + case field_117 when 1 0 when 2 @@ -1655,11 +1653,11 @@ private end def ppostcode_full - "#{field_102} #{field_103}".strip.gsub(/\s+/, " ") + "#{field_118} #{field_119}".strip.gsub(/\s+/, " ") end def cbl - case field_111 + case field_127 when 2 0 when 1 @@ -1668,7 +1666,7 @@ private end def cap - case field_112 + case field_128 when 2 0 when 1 @@ -1677,7 +1675,7 @@ private end def chr - case field_113 + case field_129 when 2 0 when 1 @@ -1686,7 +1684,7 @@ private end def accessible_register - case field_114 + case field_130 when 2 0 when 1 @@ -1699,7 +1697,7 @@ private end def net_income_known - case field_116 + case field_132 when 1 0 when 2 @@ -1710,11 +1708,11 @@ private end def earnings - field_118.round if field_118.present? + field_134.round if field_134.present? end def tshortfall_known - field_127 == 1 ? 0 : 1 + field_143 == 1 ? 0 : 1 end def hhmemb @@ -1769,7 +1767,7 @@ private end def reason_is_other? - field_97 == 20 + field_113 == 20 end def bulk_upload_organisation @@ -1788,10 +1786,10 @@ private end def rp_dontknow_conflict? - other_reason_fields = %i[field_106 field_107 field_108 field_109] - if field_105 == 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_110 == 1 + dont_know_selected = field_126 == 1 return true if selected_reasons.any? && dont_know_selected end @@ -1807,7 +1805,7 @@ private return unless referral_fields_valid? if owning_organisation.la? - field_115 + field_131 else field_145 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 8fa0ec40c..100c56f7f 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_128: 2 } } + let(:attributes) { { bulk_upload:, field_144: 2 } } it "does not add keep adding errors to the pile" do parser.valid? @@ -150,94 +150,94 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do field_15: "1", field_41: "42", - field_47: "41", - field_51: "17", - field_55: "18", - field_59: "16", - field_63: "14", - field_67: "12", - field_71: "20", + field_49: "41", + field_55: "17", + field_61: "18", + field_67: "16", + field_73: "14", + field_79: "12", + field_85: "20", field_42: "F", - field_48: "M", - field_52: "F", - field_56: "M", - field_60: "F", - field_64: "M", + field_50: "M", + field_56: "F", + field_62: "M", field_68: "F", - field_72: "M", + field_74: "M", + field_80: "F", + field_86: "M", - field_43: "17", - field_44: "826", + field_45: "17", + field_46: "826", - field_46: "1", - field_50: "2", + field_48: "1", field_54: "2", - field_58: "3", - field_62: "2", - field_66: "2", - field_70: "2", - - field_45: "1", - field_49: "2", - field_53: "7", - field_57: "7", - field_61: "8", - field_65: "9", - field_69: "0", - field_73: "10", - - field_74: "1", - field_75: "4", - field_76: "1", - - field_77: "1", - - field_78: "1", - field_79: "0", - field_80: "0", - field_81: "1", - field_82: "0", + field_60: "2", + field_66: "3", + field_72: "2", + field_78: "2", + field_84: "2", + + field_47: "1", + field_53: "2", + field_59: "7", + field_65: "7", + field_71: "8", + field_77: "9", + field_83: "0", + field_89: "10", + + field_90: "1", + field_91: "4", + field_92: "1", + + field_93: "1", + + field_94: "1", + field_95: "0", + field_96: "0", + field_97: "1", + field_98: "0", + + field_100: "3", + + field_111: "11", + field_112: "2", + field_113: "31", + field_115: "3", + field_116: "11", - field_84: "3", + field_117: "1", + field_118: "EC1N", + field_119: "2TD", - field_95: "11", - field_96: "2", - field_97: "31", - field_99: "3", - field_100: "11", + field_121: "1", + field_122: "1", + field_123: "", + field_124: "1", + field_125: "", + field_126: "", - field_101: "1", - field_102: "EC1N", - field_103: "2TD", + field_127: "1", + field_128: "2", + field_129: "2", + field_130: "2", - field_105: "1", - field_106: "1", - field_107: "", - field_108: "1", - field_109: "", - field_110: "", + field_131: "1", - field_111: "1", - field_112: "2", - field_113: "2", - field_114: "2", - - field_115: "1", - - field_116: "1", - field_117: "2", - field_118: "2300", - field_119: "1", - field_120: "4", - - field_122: "4", - field_123: "1234.56", - field_124: "43.32", - field_125: "13.14", - field_126: "101.11", - field_127: "1", - field_128: "34.56", + field_132: "1", + field_133: "2", + field_134: "2300", + field_135: "1", + field_136: "4", + + field_138: "4", + field_139: "1234.56", + field_140: "43.32", + field_141: "13.14", + field_142: "101.11", + field_143: "1", + field_144: "34.56", field_16: "15", field_29: now.day.to_s, @@ -248,22 +248,22 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do field_18: "12", - field_129: "1", - field_130: "", - field_131: "2", - field_132: "identity", - field_133: "3", - field_134: "", - field_135: "1", - field_136: "", - field_137: "2", - field_138: "identity", - field_139: "3", - field_140: "", - field_141: "1", - field_142: "", - field_143: "2", - field_144: "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 @@ -315,11 +315,11 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do :field_25, # LA :field_41, # age1 :field_42, # sexrab1 - :field_45, # ecstat1 - :field_123, # brent - :field_124, # scharge - :field_125, # pscharge - :field_126, # supcharg + :field_47, # ecstat1 + :field_139, # brent + :field_140, # scharge + :field_141, # pscharge + :field_142, # supcharg ].each do |field| expect(parser.errors[field]).to include(error_message) end @@ -344,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_35: 3, field_121: 0 }) } + let(:attributes) { valid_attributes.merge({ field_4: "2", field_5: "S#{scheme.id}", field_6: location.old_visible_id, field_35: 3, field_137: 0 }) } before do parser.log.save! @@ -369,11 +369,11 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do :field_6, # location :field_41, # age1 :field_42, # sexrab1 - :field_45, # ecstat1 - :field_123, # brent - :field_124, # scharge - :field_125, # pscharge - :field_126, # supcharg + :field_47, # ecstat1 + :field_139, # brent + :field_140, # scharge + :field_141, # pscharge + :field_142, # supcharg ].each do |field| expect(parser.errors[field]).to include(error_message) end @@ -411,11 +411,11 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do :field_6, # location :field_41, # age1 :field_42, # sexrab1 - :field_45, # ecstat1 - :field_123, # brent - :field_124, # scharge - :field_125, # pscharge - :field_126, # supcharg + :field_47, # ecstat1 + :field_139, # brent + :field_140, # scharge + :field_141, # pscharge + :field_142, # supcharg ].each do |field| expect(parser.errors[field]).to include(error_message) end @@ -454,7 +454,7 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do :field_6, # location :field_41, # age1 :field_42, # sexrab1 - :field_45, # ecstat1 + :field_47, # ecstat1 ].each do |field| expect(parser.errors[field]).to include(error_message) end @@ -473,7 +473,7 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do field_11: "2", field_6: location.id, field_1: owning_org.old_visible_id, - field_121: 0, + field_137: 0, field_35: 4 }) end @@ -500,8 +500,8 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do :field_6, # location :field_41, # age1 :field_42, # sexrab1 - :field_45, # ecstat1 - :field_121, # household_charge + :field_47, # ecstat1 + :field_137, # household_charge ].each do |field| expect(parser.errors[field]).to include(error_message) end @@ -517,8 +517,8 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do let(:attributes) do setup_section_params.merge({ field_5: nil, field_6: nil, - field_123: 300, - field_122: 1, + field_139: 300, + field_138: 1, field_28: 1, field_4: 1, field_11: "2", @@ -554,7 +554,7 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do :field_25, # LA :field_41, # age1 :field_42, # sexrab1 - :field_45, # ecstat1 + :field_47, # ecstat1 ].each do |field| expect(parser.errors[field]).to be_blank end @@ -587,8 +587,8 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do end context "with a valid ethnic value" do - context "when field_43 is 20" do - let(:attributes) { valid_attributes.merge({ field_43: "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) @@ -608,13 +608,13 @@ 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_122: 3, field_126: 80 }) } + let(:attributes) { valid_attributes.merge({ field_138: 3, field_142: 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_122]) + expect(parser.errors.map(&:attribute)).to eql(%i[field_138]) end end end @@ -630,21 +630,21 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do end context "when other null error is added" do - let(:attributes) { setup_section_params.merge({ field_111: 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_111]).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_114: "100" }) } + let(:attributes) { setup_section_params.merge({ field_130: "100" }) } it "does not add an additional error" do parser.valid? - expect(parser.errors[:field_114].length).to eq(1) - expect(parser.errors[:field_114]).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 @@ -893,213 +893,213 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do end end - describe "#field_97" do # leaving reason + describe "#field_113" do # leaving reason context "when field_7 is 1 meaning it is a renewal" do - context "when field_97 is 50" do - let(:attributes) { { bulk_upload:, field_97: "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_97]).to be_blank + expect(parser.errors[:field_113]).to be_blank end end - context "when field_97 is 51" do - let(:attributes) { { bulk_upload:, field_97: "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_97]).to be_blank + expect(parser.errors[:field_113]).to be_blank end end - context "when field_97 is 52" do - let(:attributes) { { bulk_upload:, field_97: "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_97]).to be_blank + expect(parser.errors[:field_113]).to be_blank end end - context "when field_97 is 53" do - let(:attributes) { { bulk_upload:, field_97: "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_97]).to be_blank + expect(parser.errors[:field_113]).to be_blank end end - context "when field_97 is not 50, 51, 52 or 53" do - let(:attributes) { { bulk_upload:, field_97: "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_97]).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_97: "7" }) } + let(:attributes) { setup_section_params.merge({ field_113: "7" }) } it "returns an error" do parser.valid? - expect(parser.errors[:field_97]).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_78, #field_79, #field_80" do + describe "#field_94, #field_95, #field_96" do context "when one item selected" do - let(:attributes) { { bulk_upload:, field_78: "1" } } + let(:attributes) { { bulk_upload:, field_94: "1" } } it "is permitted" do parser.valid? - expect(parser.errors[:field_78]).to be_blank - expect(parser.errors[:field_79]).to be_blank - expect(parser.errors[:field_80]).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_78: "1", field_79: "1" } } + let(:attributes) { { bulk_upload:, field_94: "1", field_95: "1" } } it "is not permitted" do parser.valid? - expect(parser.errors[:field_78]).to be_present - expect(parser.errors[:field_79]).to be_present + expect(parser.errors[:field_94]).to be_present + expect(parser.errors[:field_95]).to be_present end end end - describe "#field_82" do + describe "#field_98" do context "when 1 and another disability field selected" do - let(:attributes) { { bulk_upload:, field_82: "1", field_81: "1" } } + let(:attributes) { { bulk_upload:, field_98: "1", field_97: "1" } } it "is not permitted" do parser.valid? - expect(parser.errors[:field_82]).to be_present + expect(parser.errors[:field_98]).to be_present end end end - describe "#field_83" do + describe "#field_99" do context "when 1 and another disability field selected" do - let(:attributes) { { bulk_upload:, field_83: "1", field_81: "1" } } + let(:attributes) { { bulk_upload:, field_99: "1", field_97: "1" } } it "is not permitted" do parser.valid? - expect(parser.errors[:field_83]).to be_present + expect(parser.errors[:field_99]).to be_present end end end - describe "#field_82, #field_83" do + describe "#field_98, #field_99" do context "when both 1" do - let(:attributes) { { bulk_upload:, field_82: "1", field_83: "1" } } + let(:attributes) { { bulk_upload:, field_98: "1", field_99: "1" } } it "is not permitted" do parser.valid? - expect(parser.errors[:field_82]).to be_present - expect(parser.errors[:field_83]).to be_present + expect(parser.errors[:field_98]).to be_present + expect(parser.errors[:field_99]).to be_present end end end - describe "#field_78 - #field_83" do + describe "#field_94 - #field_99" do context "when all blank" do - let(:attributes) { setup_section_params.merge({ field_78: nil, field_79: nil, field_80: nil, field_81: nil, field_82: nil, field_83: 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_78]).to be_present - 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_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_81 is blank" do - let(:attributes) { setup_section_params.merge({ field_78: "1", field_81: 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_78]).to be_blank - expect(parser.errors[:field_81]).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_84, field_93 - 99" do + describe "#field_100, field_109 - 99" do context "when no illness but illnesses answered" do - let(:attributes) { { bulk_upload:, field_84: "2", field_85: "1", field_86: "1", field_87: "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_85]).to be_present - expect(parser.errors[:field_86]).to be_present - expect(parser.errors[:field_87]).to be_present - expect(parser.errors[:field_88]).not_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_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_84: "1", field_85: nil, 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 } } + 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_85]).to be_present - 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_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_99" 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_99: 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_99]).to be_present - expect(parser.errors[:field_99]).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_99: 38 } } + let(:attributes) { { bulk_upload:, field_7: 1, field_115: 38 } } it "does not add an error" do parser.valid? - expect(parser.errors[:field_99]).to be_blank + expect(parser.errors[:field_115]).to be_blank end end end - describe "#field_111 - 115 (lettings allocation methods)" do - %i[field_111 field_112 field_113 field_114].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_111: "2", field_112: "1", field_113: "2", field_114: "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 @@ -1110,35 +1110,35 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do end end - describe "#field_100, field_105 - 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_105: "1", field_106: nil, field_107: nil, field_108: nil, field_109: nil, field_110: 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_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 + 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_105: "2", field_106: "2", field_107: "3", field_108: "2", field_109: "3", field_110: "-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_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 + 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_105: "1", field_106: "1", field_107: nil, field_108: "1", field_109: nil, field_110: 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? @@ -1151,7 +1151,7 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do end end - describe "#field_115, field_145, field_146, field_147" do # referral + describe "#field_131, field_145, field_146, field_147" do # referral context "when org is LA" do let(:owning_org) { create(:organisation, :la, :with_old_visible_id) } @@ -1160,36 +1160,36 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do context "and not renewal" do let(:renewal_attributes) { org_attributes.merge({ field_7: nil }) } - context "and field_115 is valid" do - let(:attributes) { renewal_attributes.merge({ field_115: 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_115]).to be_blank + expect(parser.errors[:field_131]).to be_blank expect(parser.errors[:field_145]).to be_blank expect(parser.errors[:field_146]).to be_blank expect(parser.errors[:field_147]).to be_blank end end - context "and field_115 is invalid" do - let(:attributes) { renewal_attributes.merge({ field_115: 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_115]).to be_present + expect(parser.errors[:field_131]).to be_present expect(parser.errors[:field_145]).to be_present expect(parser.errors[:field_146]).to be_present expect(parser.errors[:field_147]).to be_present end end - context "and field_115 is blank" do - let(:attributes) { renewal_attributes.merge({ field_115: 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_115]).to be_present + expect(parser.errors[:field_131]).to be_present expect(parser.errors[:field_145]).to be_present expect(parser.errors[:field_146]).to be_present expect(parser.errors[:field_147]).to be_present @@ -1197,11 +1197,11 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do end context "and other fields are given" do - let(:attributes) { renewal_attributes.merge({ field_115: 1, field_145: 5, field_146: 1, field_143: 1 }) } + let(:attributes) { renewal_attributes.merge({ field_131: 1, field_145: 5, field_146: 1, field_87: 1 }) } it "adds errors to all referral fields" do parser.valid? - expect(parser.errors[:field_115]).to be_present + expect(parser.errors[:field_131]).to be_present expect(parser.errors[:field_145]).to be_present expect(parser.errors[:field_146]).to be_present expect(parser.errors[:field_147]).to be_present @@ -1210,11 +1210,11 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do end context "and is renewal" do - let(:attributes) { org_attributes.merge({ field_7: 1, field_115: 1, field_145: 5, field_146: 1, field_147: 1 }) } + let(:attributes) { org_attributes.merge({ field_7: 1, field_131: 1, field_145: 5, field_146: 1, field_147: 1 }) } it "does not add an error for referral fields" do parser.valid? - expect(parser.errors[:field_115]).to be_blank + expect(parser.errors[:field_131]).to be_blank expect(parser.errors[:field_145]).to be_blank expect(parser.errors[:field_146]).to be_blank expect(parser.errors[:field_147]).to be_blank @@ -1235,7 +1235,7 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do it "does not add an error" do parser.valid? - expect(parser.errors[:field_115]).to be_blank + expect(parser.errors[:field_131]).to be_blank expect(parser.errors[:field_145]).to be_blank expect(parser.errors[:field_146]).to be_blank expect(parser.errors[:field_147]).to be_blank @@ -1246,7 +1246,7 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do it "adds errors to all referral fields" do parser.valid? - expect(parser.errors[:field_115]).to be_present + expect(parser.errors[:field_131]).to be_present expect(parser.errors[:field_145]).to be_present expect(parser.errors[:field_146]).to be_present expect(parser.errors[:field_147]).to be_present @@ -1259,7 +1259,7 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do it "adds errors to all referral fields" do parser.valid? - expect(parser.errors[:field_115]).to be_present + expect(parser.errors[:field_131]).to be_present expect(parser.errors[:field_145]).to be_present expect(parser.errors[:field_146]).to be_present expect(parser.errors[:field_147]).to be_present @@ -1271,7 +1271,7 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do it "adds errors to all referral fields" do parser.valid? - expect(parser.errors[:field_115]).to be_present + expect(parser.errors[:field_131]).to be_present expect(parser.errors[:field_145]).to be_present expect(parser.errors[:field_146]).to be_present expect(parser.errors[:field_147]).to be_present @@ -1286,7 +1286,7 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do it "does not add an error" do parser.valid? - expect(parser.errors[:field_115]).to be_blank + expect(parser.errors[:field_131]).to be_blank expect(parser.errors[:field_145]).to be_blank expect(parser.errors[:field_146]).to be_blank expect(parser.errors[:field_147]).to be_blank @@ -1297,7 +1297,7 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do it "adds errors to all referral fields" do parser.valid? - expect(parser.errors[:field_115]).to be_present + expect(parser.errors[:field_131]).to be_present expect(parser.errors[:field_145]).to be_present expect(parser.errors[:field_146]).to be_present expect(parser.errors[:field_147]).to be_present @@ -1310,7 +1310,7 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do it "adds errors to all referral fields" do parser.valid? - expect(parser.errors[:field_115]).to be_present + expect(parser.errors[:field_131]).to be_present expect(parser.errors[:field_145]).to be_present expect(parser.errors[:field_146]).to be_present expect(parser.errors[:field_147]).to be_present @@ -1322,7 +1322,7 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do it "adds errors to all referral fields" do parser.valid? - expect(parser.errors[:field_115]).to be_present + expect(parser.errors[:field_131]).to be_present expect(parser.errors[:field_145]).to be_present expect(parser.errors[:field_146]).to be_present expect(parser.errors[:field_147]).to be_present @@ -1337,7 +1337,7 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do it "does not add an error" do parser.valid? - expect(parser.errors[:field_115]).to be_blank + expect(parser.errors[:field_131]).to be_blank expect(parser.errors[:field_145]).to be_blank expect(parser.errors[:field_146]).to be_blank expect(parser.errors[:field_147]).to be_blank @@ -1349,7 +1349,7 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do it "adds errors to all referral fields" do parser.valid? - expect(parser.errors[:field_115]).to be_present + expect(parser.errors[:field_131]).to be_present expect(parser.errors[:field_145]).to be_present expect(parser.errors[:field_146]).to be_present expect(parser.errors[:field_147]).to be_present @@ -1361,7 +1361,7 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do it "adds errors to all referral fields" do parser.valid? - expect(parser.errors[:field_115]).to be_present + expect(parser.errors[:field_131]).to be_present expect(parser.errors[:field_145]).to be_present expect(parser.errors[:field_146]).to be_present expect(parser.errors[:field_147]).to be_present @@ -1372,11 +1372,11 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do end context "and is renewal" do - let(:attributes) { org_attributes.merge({ field_7: 1, field_115: 1, field_145: 5, field_146: 1, field_147: 1 }) } + let(:attributes) { org_attributes.merge({ field_7: 1, field_131: 1, field_145: 5, field_146: 1, field_147: 1 }) } it "does not add an error for referral fields" do parser.valid? - expect(parser.errors[:field_115]).to be_blank + expect(parser.errors[:field_131]).to be_blank expect(parser.errors[:field_145]).to be_blank expect(parser.errors[:field_146]).to be_blank expect(parser.errors[:field_147]).to be_blank @@ -1958,20 +1958,20 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do end end - describe "#field_47" do # age2 + describe "#field_49" do # age2 context "when null but gender given" do - let(:attributes) { setup_section_params.merge({ field_47: "", field_48: "F" }) } + let(:attributes) { setup_section_params.merge({ field_49: "", field_50: "F" }) } it "returns an error" do parser.valid? - expect(parser.errors[:field_47]).to be_present + expect(parser.errors[:field_49]).to be_present end end end - describe "#field_44" do - context "when field_44 is a 3 digit nationality code" do - let(:attributes) { setup_section_params.merge({ field_44: "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) @@ -1979,8 +1979,8 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do end end - context "when field_44 is a nationality code without the trailing 0s" do - let(:attributes) { setup_section_params.merge({ field_44: "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) @@ -1988,8 +1988,8 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do end end - context "when field_44 is a nationality code with trailing 0s" do - let(:attributes) { setup_section_params.merge({ field_44: "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) @@ -1997,8 +1997,8 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do end end - context "when field_44 is 0" do - let(:attributes) { setup_section_params.merge({ field_44: "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) @@ -2006,8 +2006,8 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do end end - context "when field_44 is 000" do - let(:attributes) { setup_section_params.merge({ field_44: "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) @@ -2015,8 +2015,8 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do end end - context "when field_44 is 0000" do - let(:attributes) { setup_section_params.merge({ field_44: "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) @@ -2024,8 +2024,8 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do end end - context "when field_44 is 826" do - let(:attributes) { setup_section_params.merge({ field_44: "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) @@ -2033,8 +2033,8 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do end end - context "when field_44 is 826 with trailing 0s" do - let(:attributes) { setup_section_params.merge({ field_44: "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) @@ -2042,79 +2042,79 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do end end - context "when field_44 is not a valid option" do - let(:attributes) { setup_section_params.merge({ field_44: "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_44" do + it "adds an error to field_46" do parser.valid? - expect(parser.errors["field_44"]).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_41: 22, field_45: 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_41, category: :soft_validation)).to be_present - expect(parser.errors.where(:field_45, 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_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_45, 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_77: "1", field_42: "M", field_48: "M", field_52: "M", field_129: 1, field_131: 1, field_133: 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_129, category: :soft_validation)).to be_present - expect(parser.errors.where(:field_48, category: :soft_validation)).to be_present - expect(parser.errors.where(:field_131, category: :soft_validation)).to be_present + expect(parser.errors.where(:field_43, 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_156, category: :soft_validation)).not_to be_present - expect(parser.errors.where(:field_135, 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_160, category: :soft_validation)).not_to be_present - expect(parser.errors.where(:field_137, 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_123: 120, field_124: 120, field_125: 120, field_126: 120, field_122: 1, field_28: 1, field_4: 1, field_11: "2", field_25: "E09000008" }) } + let(:attributes) { setup_section_params.merge({ field_139: 120, field_140: 120, field_141: 120, field_142: 120, field_138: 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_123, category: :soft_validation)).to be_present + expect(parser.errors.where(:field_139, category: :soft_validation)).to be_present end it "populates with correct error message" do parser.valid? - expect(parser.errors.where(:field_123, category: :soft_validation).count).to be(1) - expect(parser.errors.where(:field_123, 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_139, category: :soft_validation).count).to be(1) + expect(parser.errors.where(:field_139, 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_45: 11, field_118: 123, field_117: 1 }) } + let(:attributes) { setup_section_params.merge({ field_47: 11, field_134: 123, field_133: 1 }) } it "does not run net income soft validations validation" do parser.valid? - expect(parser.errors.where(:field_45).count).to be(1) + expect(parser.errors.where(:field_47).count).to be(1) end end end @@ -2231,14 +2231,14 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do end [ - %w[age1_known details_known_1 age1 field_41 field_46 field_48], - %w[age2_known details_known_2 age2 field_47 field_46 field_48], - %w[age3_known details_known_3 age3 field_51 field_50 field_52], - %w[age4_known details_known_4 age4 field_55 field_54 field_56], - %w[age5_known details_known_5 age5 field_59 field_58 field_60], - %w[age6_known details_known_6 age6 field_63 field_62 field_64], - %w[age7_known details_known_7 age7 field_67 field_66 field_68], - %w[age8_known details_known_8 age8 field_71 field_70 field_72], + %w[age1_known details_known_1 age1 field_41 field_48 field_50], + %w[age2_known details_known_2 age2 field_49 field_48 field_50], + %w[age3_known details_known_3 age3 field_55 field_54 field_56], + %w[age4_known details_known_4 age4 field_61 field_60 field_62], + %w[age5_known details_known_5 age5 field_67 field_66 field_68], + %w[age6_known details_known_6 age6 field_73 field_72 field_74], + %w[age7_known details_known_7 age7 field_79 field_78 field_80], + %w[age8_known details_known_8 age8 field_85 field_84 field_86], ].each do |known, details_known, age, field, relationship, gender| describe "##{known} and ##{age}" do context "when #{field} is blank" do @@ -2357,124 +2357,124 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do end describe "#cbl" do - context "when field_111 is yes ie 1" do - let(:attributes) { { bulk_upload:, field_111: 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_111 is no ie 2" do - let(:attributes) { { bulk_upload:, field_111: 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_111 is not a permitted value" do - let(:attributes) { { bulk_upload:, field_111: 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_111]).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_113 is yes ie 1" do - let(:attributes) { { bulk_upload:, field_113: 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_113 is no ie 2" do - let(:attributes) { { bulk_upload:, field_113: 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_113 is not a permitted value" do - let(:attributes) { { bulk_upload:, field_113: 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_113]).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_112 is yes ie 1" do - let(:attributes) { { bulk_upload:, field_112: 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_112 is no ie 2" do - let(:attributes) { { bulk_upload:, field_112: 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_112 is not a permitted value" do - let(:attributes) { { bulk_upload:, field_112: 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_112]).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_114 is yes ie 1" do - let(:attributes) { { bulk_upload:, field_114: 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_114 is no ie 2" do - let(:attributes) { { bulk_upload:, field_114: 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_114 is not a permitted value" do - let(:attributes) { { bulk_upload:, field_114: 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_114]).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_111, 113, 114, 115 are no ie 2" do - let(:attributes) { { bulk_upload:, field_111: 2, field_112: 2, field_113: 2, field_114: 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_111, 113, 114, 115 is yes ie 1" do - let(:attributes) { { bulk_upload:, field_114: 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,13 +2497,13 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do { bulk_upload:, field_42: "F", - field_48: "M", - field_52: "X", - field_56: "R", - field_60: "F", - field_64: "M", - field_68: "X", - field_72: "R", + field_50: "M", + field_56: "X", + field_62: "R", + field_68: "F", + field_74: "M", + field_80: "X", + field_86: "R", } end @@ -2523,14 +2523,14 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do let(:attributes) do { bulk_upload:, - field_45: "1", - field_49: "2", - field_53: "6", - field_57: "7", - field_61: "8", - field_65: "9", - field_69: "0", - field_73: "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 @@ -2550,13 +2550,13 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do let(:attributes) do { bulk_upload:, - field_46: "1", - field_50: "2", + field_48: "1", field_54: "2", - field_58: "3", - field_62: "1", - field_66: "2", - field_70: "2", + field_60: "2", + field_66: "3", + field_72: "1", + field_78: "2", + field_84: "2", } end @@ -2573,7 +2573,7 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do describe "#net_income_known" do context "when 1" do - let(:attributes) { { bulk_upload:, field_116: "1" } } + let(:attributes) { { bulk_upload:, field_132: "1" } } it "sets value from correct mapping" do expect(parser.log.net_income_known).to eq(0) @@ -2581,7 +2581,7 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do end context "when 2" do - let(:attributes) { { bulk_upload:, field_116: "2" } } + let(:attributes) { { bulk_upload:, field_132: "2" } } it "sets value from correct mapping" do expect(parser.log.net_income_known).to eq(1) @@ -2589,7 +2589,7 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do end context "when 3" do - let(:attributes) { { bulk_upload:, field_116: "3" } } + let(:attributes) { { bulk_upload:, field_132: "3" } } it "sets value from correct mapping" do expect(parser.log.net_income_known).to eq(2) @@ -2623,16 +2623,16 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do describe "illness fields" do mapping = [ - { attribute: :illness_type_1, field: :field_93 }, - { attribute: :illness_type_2, field: :field_87 }, - { attribute: :illness_type_3, field: :field_90 }, - { attribute: :illness_type_4, field: :field_85 }, - { attribute: :illness_type_5, field: :field_86 }, - { attribute: :illness_type_6, field: :field_88 }, - { attribute: :illness_type_7, field: :field_89 }, - { attribute: :illness_type_8, field: :field_92 }, - { attribute: :illness_type_9, field: :field_91 }, - { attribute: :illness_type_10, field: :field_94 }, + { 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| @@ -2681,7 +2681,7 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do end describe "#earnings" do - let(:attributes) { { bulk_upload:, field_118: "104.50" } } + let(:attributes) { { bulk_upload:, field_134: "104.50" } } it "rounds to the nearest whole pound" do expect(parser.log.earnings).to eq(105) @@ -2690,7 +2690,7 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do describe "#reasonother" do context "when reason is 'Other'" do - let(:attributes) { { bulk_upload:, field_97: "20", field_98: "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") @@ -2698,7 +2698,7 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do end context "when reason is not 'Other'" do - let(:attributes) { { bulk_upload:, field_97: "50", field_98: "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 @@ -2707,7 +2707,7 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do end describe "#ppcodenk" do - let(:attributes) { { bulk_upload:, field_101: "2" } } + let(:attributes) { { bulk_upload:, field_117: "2" } } it "sets correct value from mapping" do expect(parser.log.ppcodenk).to eq(1) @@ -2716,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_121: "1" } } + let(:attributes) { { bulk_upload:, field_4: 1, field_137: "1" } } it "sets correct value from mapping" do expect(parser.log.household_charge).to eq(nil) @@ -2724,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_121: "1" } } + let(:attributes) { { bulk_upload:, field_4: 2, field_137: "1" } } it "sets correct value from mapping" do expect(parser.log.household_charge).to eq(1) @@ -2733,14 +2733,14 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do end describe "#supcharg" do - let(:attributes) { setup_section_params.merge({ field_123: "330", field_124: "0", field_125: "0", field_126: "123.45" }) } + let(:attributes) { setup_section_params.merge({ field_139: "330", field_140: "0", field_141: "0", field_142: "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_126: "123.45", field_123: nil, field_124: nil, field_125: nil }) } + let(:attributes) { setup_section_params.merge({ field_142: "123.45", field_139: nil, field_140: nil, field_141: nil }) } it "does not set charges values" do parser.log.save! @@ -2753,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_123]).to eql([I18n.t("validations.lettings.2026.bulk_upload.charges.missing_charges", sentence_fragment: "basic rent")]) - expect(parser.errors[:field_124]).to eql([I18n.t("validations.lettings.2026.bulk_upload.charges.missing_charges", sentence_fragment: "service charge")]) - expect(parser.errors[:field_125]).to eql([I18n.t("validations.lettings.2026.bulk_upload.charges.missing_charges", sentence_fragment: "personal service charge")]) - expect(parser.errors[:field_126]).to eql([I18n.t("validations.lettings.2026.bulk_upload.charges.related_to_missing_charge")]) + expect(parser.errors[:field_139]).to eql([I18n.t("validations.lettings.2026.bulk_upload.charges.missing_charges", sentence_fragment: "basic rent")]) + expect(parser.errors[:field_140]).to eql([I18n.t("validations.lettings.2026.bulk_upload.charges.missing_charges", sentence_fragment: "service charge")]) + expect(parser.errors[:field_141]).to eql([I18n.t("validations.lettings.2026.bulk_upload.charges.missing_charges", sentence_fragment: "personal service charge")]) + expect(parser.errors[:field_142]).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_122: 1, field_123: "350.45", field_124: "0", field_125: "0", field_126: nil }) } + let(:attributes) { setup_section_params.merge({ field_138: 1, field_139: "350.45", field_140: "0", field_141: "0", field_142: nil }) } it "does not set charges values" do parser.log.save! @@ -2775,16 +2775,16 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do it "adds an error to all charges" do parser.valid? - expect(parser.errors[:field_123]).to eql([I18n.t("validations.lettings.2026.bulk_upload.charges.related_to_missing_charge")]) - 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.missing_charges", sentence_fragment: "support charge")]) + expect(parser.errors[:field_139]).to eql([I18n.t("validations.lettings.2026.bulk_upload.charges.related_to_missing_charge")]) + expect(parser.errors[:field_140]).to eql([I18n.t("validations.lettings.2026.bulk_upload.charges.related_to_missing_charge")]) + expect(parser.errors[:field_141]).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: "support charge")]) end end end describe "#pscharge" do - let(:attributes) { { bulk_upload:, field_123: "111.45", field_124: "0", field_125: "123.45", field_126: "0" } } + let(:attributes) { { bulk_upload:, field_139: "111.45", field_140: "0", field_141: "123.45", field_142: "0" } } it "sets value given" do expect(parser.log.pscharge).to eq(123.45) @@ -2792,7 +2792,7 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do end describe "#scharge" do - let(:attributes) { { bulk_upload:, field_123: "111.45", field_124: "123.45", field_125: "0", field_126: "0" } } + let(:attributes) { { bulk_upload:, field_139: "111.45", field_140: "123.45", field_141: "0", field_142: "0" } } it "sets value given" do expect(parser.log.scharge).to eq(123.45) @@ -2910,7 +2910,7 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do end describe "#prevloc" do - let(:attributes) { { bulk_upload:, field_104: "E07000223" } } + let(:attributes) { { bulk_upload:, field_120: "E07000223" } } it "sets to given value" do expect(parser.log.prevloc).to eql("E07000223") @@ -2919,7 +2919,7 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do describe "#previous_la_known" do context "when known" do - let(:attributes) { { bulk_upload:, field_104: "E07000223" } } + let(:attributes) { { bulk_upload:, field_120: "E07000223" } } it "sets to 1" do expect(parser.log.previous_la_known).to eq(1) @@ -2927,7 +2927,7 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do end context "when not known" do - let(:attributes) { { bulk_upload:, field_104: "", 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) @@ -2955,7 +2955,7 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do describe "#housingneeds" do context "when no disabled needs" do - let(:attributes) { { bulk_upload:, field_82: "1" } } + let(:attributes) { { bulk_upload:, field_98: "1" } } it "sets to 2" do expect(parser.log.housingneeds).to eq(2) @@ -2963,7 +2963,7 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do end context "when dont know about disabled needs" do - let(:attributes) { { bulk_upload:, field_83: "1" } } + let(:attributes) { { bulk_upload:, field_99: "1" } } it "sets to 3" do expect(parser.log.housingneeds).to eq(3) @@ -2971,7 +2971,7 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do end context "when housingneeds are given" do - let(:attributes) { { bulk_upload:, field_82: "0", field_80: "1", field_81: "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) @@ -2980,8 +2980,8 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do end end - context "when housingneeds are given and field_81 is nil" do - let(:attributes) { { bulk_upload:, field_82: nil, field_80: "1", field_81: "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) @@ -2991,7 +2991,7 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do end context "when housingneeds are not given" do - let(:attributes) { { bulk_upload:, field_78: nil, field_79: nil, field_80: nil, field_82: 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) @@ -3000,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_78: "1", field_79: "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_78]).to include(I18n.t("validations.lettings.2026.bulk_upload.housingneeds_type.only_one_option_permitted")) - 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 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_78: "1", field_80: "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_78]).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_79]).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_79: "1", field_80: "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_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_78]).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_78: "1", field_82: "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_82]).to include(I18n.t("validations.lettings.2026.bulk_upload.housingneeds.no_disabled_needs_conjunction")) - expect(parser.errors[:field_78]).to include(I18n.t("validations.lettings.2026.bulk_upload.housingneeds.no_disabled_needs_conjunction")) - expect(parser.errors[:field_79]).to be_blank - expect(parser.errors[:field_80]).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_78: "0", field_82: "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_54]).to be_blank - expect(parser.errors[:field_78]).to be_blank - expect(parser.errors[:field_79]).to be_blank - expect(parser.errors[:field_80]).to be_blank + expect(parser.errors[:field_60]).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_78: "1", field_83: "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_83]).to include(I18n.t("validations.lettings.2026.bulk_upload.housingneeds.dont_know_disabled_needs_conjunction")) - expect(parser.errors[:field_78]).to include(I18n.t("validations.lettings.2026.bulk_upload.housingneeds.dont_know_disabled_needs_conjunction")) - expect(parser.errors[:field_79]).to be_blank - expect(parser.errors[:field_80]).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_78: "0", field_83: "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_83]).to be_blank - expect(parser.errors[:field_78]).to be_blank - expect(parser.errors[:field_79]).to be_blank - expect(parser.errors[:field_80]).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_78 is 1" do - let(:attributes) { { bulk_upload:, field_78: "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_79 is 1" do - let(:attributes) { { bulk_upload:, field_79: "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_80 is 1" do - let(:attributes) { { bulk_upload:, field_80: "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) @@ -3108,8 +3108,8 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do end describe "#housingneeds_other" do - context "when field_53 is 1" do - let(:attributes) { { bulk_upload:, field_81: "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)