From 0095f68c0c65b58bf58fe602a0ff88b6b1b03e4f Mon Sep 17 00:00:00 2001 From: kosiakkatrina <54268893+kosiakkatrina@users.noreply.github.com> Date: Wed, 29 Mar 2023 12:52:55 +0100 Subject: [PATCH] CLDC-1933 Update leftreg values (#1475) * Update leftreg values * Fix export tests --- app/models/form/lettings/questions/leftreg.rb | 6 +++--- app/models/form/question.rb | 4 ++-- .../bulk_upload/lettings/year2022/row_parser.rb | 11 +---------- .../bulk_upload/lettings/year2023/row_parser.rb | 11 +---------- config/forms/2021_2022.json | 6 +++--- config/forms/2022_2023.json | 6 +++--- spec/factories/lettings_log.rb | 2 +- spec/fixtures/exports/general_needs_log.csv | 2 +- spec/fixtures/exports/general_needs_log.xml | 2 +- spec/fixtures/exports/supported_housing_logs.xml | 2 +- 10 files changed, 17 insertions(+), 35 deletions(-) diff --git a/app/models/form/lettings/questions/leftreg.rb b/app/models/form/lettings/questions/leftreg.rb index a6edecbc3..98c6064ac 100644 --- a/app/models/form/lettings/questions/leftreg.rb +++ b/app/models/form/lettings/questions/leftreg.rb @@ -12,9 +12,9 @@ class Form::Lettings::Questions::Leftreg < ::Form::Question end ANSWER_OPTIONS = { - "0" => { "value" => "Yes" }, - "1" => { "value" => "No – they left up to and including 5 years ago" }, - "2" => { "value" => "No – they left more than 5 years ago" }, + "6" => { "value" => "Yes" }, + "4" => { "value" => "No – they left up to and including 5 years ago" }, + "5" => { "value" => "No – they left more than 5 years ago" }, "divider" => { "value" => true }, "3" => { "value" => "Person prefers not to say" }, }.freeze diff --git a/app/models/form/question.rb b/app/models/form/question.rb index aecb20ac6..19b9de163 100644 --- a/app/models/form/question.rb +++ b/app/models/form/question.rb @@ -338,7 +338,7 @@ private startertenancy: [0], sheltered: [0, 1], armedforces: [1, 4, 5], - leftreg: [0], + leftreg: [6], reservist: [1], preg_occ: [1], illness: [1], @@ -362,7 +362,7 @@ private startertenancy: [1], sheltered: [2], armedforces: [2], - leftreg: [1], + leftreg: [4], reservist: [2], preg_occ: [2], illness: [2], diff --git a/app/services/bulk_upload/lettings/year2022/row_parser.rb b/app/services/bulk_upload/lettings/year2022/row_parser.rb index 71c136621..13e2f9d02 100644 --- a/app/services/bulk_upload/lettings/year2022/row_parser.rb +++ b/app/services/bulk_upload/lettings/year2022/row_parser.rb @@ -1102,16 +1102,7 @@ private end def leftreg - case field_114 - when 3 - 3 - when 4 - 1 - when 5 - 2 - when 6 - 0 - end + field_114 end def homeless diff --git a/app/services/bulk_upload/lettings/year2023/row_parser.rb b/app/services/bulk_upload/lettings/year2023/row_parser.rb index 6f03c6387..3af97b50f 100644 --- a/app/services/bulk_upload/lettings/year2023/row_parser.rb +++ b/app/services/bulk_upload/lettings/year2023/row_parser.rb @@ -1165,16 +1165,7 @@ private end def leftreg - case field_80 - when 3 - 3 - when 4 - 1 - when 5 - 2 - when 6 - 0 - end + field_80 end def housingneeds diff --git a/config/forms/2021_2022.json b/config/forms/2021_2022.json index dfcf83fb6..741195f01 100644 --- a/config/forms/2021_2022.json +++ b/config/forms/2021_2022.json @@ -5715,13 +5715,13 @@ "type": "radio", "check_answer_label": "Person still serving in UK armed forces", "answer_options": { - "0": { + "6": { "value": "Yes" }, - "1": { + "4": { "value": "No – they left up to and including 5 years ago" }, - "2": { + "5": { "value": "No – they left more than 5 years ago" }, "divider": { diff --git a/config/forms/2022_2023.json b/config/forms/2022_2023.json index 8e1eca338..3eb134972 100644 --- a/config/forms/2022_2023.json +++ b/config/forms/2022_2023.json @@ -5710,13 +5710,13 @@ "type": "radio", "check_answer_label": "Person still serving in UK armed forces", "answer_options": { - "0": { + "6": { "value": "Yes" }, - "1": { + "4": { "value": "No – they left up to and including 5 years ago" }, - "2": { + "5": { "value": "No – they left more than 5 years ago" }, "divider": { diff --git a/spec/factories/lettings_log.rb b/spec/factories/lettings_log.rb index 994b69c33..ce2b1cee7 100644 --- a/spec/factories/lettings_log.rb +++ b/spec/factories/lettings_log.rb @@ -55,7 +55,7 @@ FactoryBot.define do ecstat2 { 6 } homeless { 1 } underoccupation_benefitcap { 0 } - leftreg { 1 } + leftreg { 4 } reservist { 1 } illness { 1 } preg_occ { 2 } diff --git a/spec/fixtures/exports/general_needs_log.csv b/spec/fixtures/exports/general_needs_log.csv index 37ee27089..e8587eb41 100644 --- a/spec/fixtures/exports/general_needs_log.csv +++ b/spec/fixtures/exports/general_needs_log.csv @@ -1,2 +1,2 @@ status,tenancycode,age1,sex1,ethnic,national,prevten,ecstat1,hhmemb,age2,sex2,ecstat2,age3,sex3,ecstat3,age4,sex4,ecstat4,age5,sex5,ecstat5,age6,sex6,ecstat6,age7,sex7,ecstat7,age8,sex8,ecstat8,homeless,underoccupation_benefitcap,leftreg,reservist,illness,preg_occ,startertenancy,tenancylength,tenancy,ppostcode_full,rsnvac,unittype_gn,beds,offered,wchair,earnings,incfreq,benefits,period,layear,waityear,postcode_full,reasonpref,cbl,chr,cap,reasonother,housingneeds_a,housingneeds_b,housingneeds_c,housingneeds_f,housingneeds_g,housingneeds_h,illness_type_1,illness_type_2,illness_type_3,illness_type_4,illness_type_8,illness_type_5,illness_type_6,illness_type_7,illness_type_9,illness_type_10,rp_homeless,rp_insan_unsat,rp_medwel,rp_hardship,rp_dontknow,tenancyother,irproduct_other,reason,propcode,la,prevloc,hb,hbrentshortfall,mrcdate,incref,startdate,armedforces,unitletas,builtype,voiddate,renttype,needstype,lettype,totchild,totelder,totadult,nocharge,referral,brent,scharge,pscharge,supcharg,tcharge,tshortfall,chcharge,ppcodenk,has_benefits,renewal,wrent,wscharge,wpschrge,wsupchrg,wtcharge,wtshortfall,refused,housingneeds,wchchrg,newprop,relat2,relat3,relat4,relat5,relat6,relat7,relat8,lar,irproduct,joint,sheltered,hhtype,new_old,vacdays,formid,owningorgid,owningorgname,hcnum,maningorgid,maningorgname,manhcnum,createddate,uploaddate -2,BZ737,35,F,2,13,6,0,2,32,M,6,,,,,,,,,,,,,,,,,,,1,4,1,1,1,2,1,5,1,SE2 6RT,6,7,3,2,1,68,1,1,2,2,7,NW1 5TY,1,2,1,2,,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,,,4,123,E09000003,E07000105,6,1,2020-05-05T10:36:49+01:00,0,2022-02-02T10:36:49+00:00,1,2,1,2019-11-03T00:00:00+00:00,2,1,7,0,0,2,0,2,200.0,50.0,40.0,35.0,325.0,12.0,,1,1,0,100.0,25.0,20.0,17.5,162.5,6.0,0,1,,2,P,,,,,,,,,,,4,2,638,{id},{owning_org_id},DLUHC,1234,{managing_org_id},DLUHC,1234,2022-05-01T00:00:00+01:00,2022-05-01T00:00:00+01:00 +2,BZ737,35,F,2,13,6,0,2,32,M,6,,,,,,,,,,,,,,,,,,,1,4,4,1,1,2,1,5,1,SE2 6RT,6,7,3,2,1,68,1,1,2,2,7,NW1 5TY,1,2,1,2,,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,,,4,123,E09000003,E07000105,6,1,2020-05-05T10:36:49+01:00,0,2022-02-02T10:36:49+00:00,1,2,1,2019-11-03T00:00:00+00:00,2,1,7,0,0,2,0,2,200.0,50.0,40.0,35.0,325.0,12.0,,1,1,0,100.0,25.0,20.0,17.5,162.5,6.0,0,1,,2,P,,,,,,,,,,,4,2,638,{id},{owning_org_id},DLUHC,1234,{managing_org_id},DLUHC,1234,2022-05-01T00:00:00+01:00,2022-05-01T00:00:00+01:00 diff --git a/spec/fixtures/exports/general_needs_log.xml b/spec/fixtures/exports/general_needs_log.xml index 11c50ed4e..80a052ec8 100644 --- a/spec/fixtures/exports/general_needs_log.xml +++ b/spec/fixtures/exports/general_needs_log.xml @@ -33,7 +33,7 @@ 1 4 - 1 + 4 1 1 2 diff --git a/spec/fixtures/exports/supported_housing_logs.xml b/spec/fixtures/exports/supported_housing_logs.xml index 3b535c226..09b94e1d3 100644 --- a/spec/fixtures/exports/supported_housing_logs.xml +++ b/spec/fixtures/exports/supported_housing_logs.xml @@ -33,7 +33,7 @@ 1 4 - 1 + 4 1 1 2