Browse Source

Update mapping values of reservist field (#962)

Previous to this change, the `reservist` field mapped `0` to yes and `1` to no. This change adjusts the mapping from `1` to yes, `2` to no, and `3` to prefer not to say.
pull/965/head
James Rose 2 years ago committed by GitHub
parent
commit
1bc1ce6144
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      app/models/form/question.rb
  2. 6
      config/forms/2021_2022.json
  3. 6
      config/forms/2022_2023.json
  4. 2
      docs/api/v1.json
  5. 2
      spec/factories/lettings_log.rb
  6. 2
      spec/fixtures/exports/general_needs_log.csv
  7. 2
      spec/fixtures/exports/general_needs_log.xml
  8. 2
      spec/fixtures/exports/supported_housing_logs.xml
  9. 12
      spec/models/validations/household_validations_spec.rb

6
app/models/form/question.rb

@ -313,7 +313,7 @@ private
sheltered: [0, 1],
armedforces: [1, 4, 5],
leftreg: [0],
reservist: [0],
reservist: [1],
preg_occ: [1],
illness: [1],
underoccupation_benefitcap: [4, 5, 6],
@ -337,7 +337,7 @@ private
sheltered: [2],
armedforces: [2],
leftreg: [1],
reservist: [1],
reservist: [2],
preg_occ: [2],
illness: [2],
underoccupation_benefitcap: [2],
@ -389,7 +389,7 @@ private
sheltered: [3],
armedforces: [3],
leftreg: [3],
reservist: [2],
reservist: [3],
preg_occ: [3],
hb: [6],
}.freeze

6
config/forms/2021_2022.json

@ -5759,16 +5759,16 @@
"type": "radio",
"check_answer_label": "Person seriously injured or ill as result of serving in UK armed forces",
"answer_options": {
"0": {
"1": {
"value": "Yes"
},
"1": {
"2": {
"value": "No"
},
"divider": {
"value": true
},
"2": {
"3": {
"value": "Person prefers not to say"
}
}

6
config/forms/2022_2023.json

@ -5761,16 +5761,16 @@
"type": "radio",
"check_answer_label": "Person seriously injured or ill as result of serving in UK armed forces",
"answer_options": {
"0": {
"1": {
"value": "Yes"
},
"1": {
"2": {
"value": "No"
},
"divider": {
"value": true
},
"2": {
"3": {
"value": "Person prefers not to say"
}
}

2
docs/api/v1.json

@ -311,7 +311,7 @@
"reason": 1,
"underoccupation_benefitcap": 0,
"leftreg": 1,
"reservist": 0,
"reservist": 1,
"illness": 1,
"preg_occ": 0,
"tenancy_code": "BZ757",

2
spec/factories/lettings_log.rb

@ -56,7 +56,7 @@ FactoryBot.define do
homeless { 1 }
underoccupation_benefitcap { 0 }
leftreg { 1 }
reservist { 0 }
reservist { 1 }
illness { 1 }
preg_occ { 2 }
startertenancy { 1 }

2
spec/fixtures/exports/general_needs_log.csv vendored

@ -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,form,owningorgid,owningorgname,hcnum,maningorgid,maningorgname,manhcnum,createddate,uploaddate
2,BZ737,35,F,2,4,6,0,2,32,M,6,,,,,,,,,,,,,,,,,,,1,0,1,0,1,2,1,5,1,SE2 6RT,6,7,3,2,1,68,1,1,2,2,1,NW1 5TY,1,1,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:49Z,0,2022-02-02T10:36:49Z,1,2,1,2019-11-03T00:00:00Z,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-02-08T16:52:15Z,2022-02-08T16:52:15Z
2,BZ737,35,F,2,4,6,0,2,32,M,6,,,,,,,,,,,,,,,,,,,1,0,1,1,1,2,1,5,1,SE2 6RT,6,7,3,2,1,68,1,1,2,2,1,NW1 5TY,1,1,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:49Z,0,2022-02-02T10:36:49Z,1,2,1,2019-11-03T00:00:00Z,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-02-08T16:52:15Z,2022-02-08T16:52:15Z

1 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 form owningorgid owningorgname hcnum maningorgid maningorgname manhcnum createddate uploaddate
2 2 BZ737 35 F 2 4 6 0 2 32 M 6 1 0 1 0 1 1 2 1 5 1 SE2 6RT 6 7 3 2 1 68 1 1 2 2 1 NW1 5TY 1 1 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:49Z 0 2022-02-02T10:36:49Z 1 2 1 2019-11-03T00:00:00Z 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-02-08T16:52:15Z 2022-02-08T16:52:15Z

2
spec/fixtures/exports/general_needs_log.xml vendored

@ -34,7 +34,7 @@
<homeless>1</homeless>
<underoccupation_benefitcap>0</underoccupation_benefitcap>
<leftreg>1</leftreg>
<reservist>0</reservist>
<reservist>1</reservist>
<illness>1</illness>
<preg_occ>2</preg_occ>
<startertenancy>1</startertenancy>

2
spec/fixtures/exports/supported_housing_logs.xml vendored

@ -34,7 +34,7 @@
<homeless>1</homeless>
<underoccupation_benefitcap>0</underoccupation_benefitcap>
<leftreg>1</leftreg>
<reservist>0</reservist>
<reservist>1</reservist>
<illness>1</illness>
<preg_occ>2</preg_occ>
<startertenancy>1</startertenancy>

12
spec/models/validations/household_validations_spec.rb

@ -256,7 +256,7 @@ RSpec.describe Validations::HouseholdValidations do
context "when the tenant or partner was and is not a member of the armed forces" do
it "validates that injured in the armed forces is not yes" do
record.armedforces = 2
record.reservist = 0
record.reservist = 1
household_validator.validate_armed_forces(record)
expect(record.errors["reservist"])
.to include(match I18n.t("validations.household.reservist.injury_not_required"))
@ -266,7 +266,7 @@ RSpec.describe Validations::HouseholdValidations do
context "when the tenant prefers not to say if they were or are in the armed forces" do
it "validates that injured in the armed forces is not yes" do
record.armedforces = 3
record.reservist = 0
record.reservist = 1
household_validator.validate_armed_forces(record)
expect(record.errors["reservist"])
.to include(match I18n.t("validations.household.reservist.injury_not_required"))
@ -276,7 +276,7 @@ RSpec.describe Validations::HouseholdValidations do
context "when the tenant was or is a regular member of the armed forces" do
it "expects that injured in the armed forces can be yes" do
record.armedforces = 0
record.reservist = 0
record.reservist = 1
household_validator.validate_armed_forces(record)
expect(record.errors["reservist"]).to be_empty
end
@ -285,7 +285,7 @@ RSpec.describe Validations::HouseholdValidations do
context "when the tenant was or is a reserve member of the armed forces" do
it "expects that injured in the armed forces can be yes" do
record.armedforces = 1
record.reservist = 0
record.reservist = 1
household_validator.validate_armed_forces(record)
expect(record.errors["reservist"]).to be_empty
end
@ -294,7 +294,7 @@ RSpec.describe Validations::HouseholdValidations do
context "when the tenant’s partner was or is a member of the armed forces" do
it "expects that injured in the armed forces can be yes" do
record.armedforces = 5
record.reservist = 0
record.reservist = 1
household_validator.validate_armed_forces(record)
expect(record.errors["reservist"]).to be_empty
end
@ -319,7 +319,7 @@ RSpec.describe Validations::HouseholdValidations do
it "expects that they served in the armed forces and may have been injured" do
record.armedforces = 1
record.leftreg = 0
record.reservist = 0
record.reservist = 1
household_validator.validate_armed_forces(record)
expect(record.errors["leftreg"]).to be_empty
expect(record.errors["reservist"]).to be_empty

Loading…
Cancel
Save