Browse Source

Remove numbers from answers in the ui

pull/213/head
Kat 4 years ago
parent
commit
2a79f0ed27
  1. 48
      app/models/constants/case_log.rb
  2. 14
      app/models/validations/financial_validations.rb
  3. 148
      config/forms/2021_2022.json
  4. 4
      docs/api/DLUHC-CORE-Data.v1.json
  5. 4
      spec/factories/case_log.rb
  6. 4
      spec/features/form/helpers.rb
  7. 6
      spec/fixtures/complete_case_log.json
  8. 14
      spec/fixtures/forms/2021_2022.json
  9. 8
      spec/models/case_log_spec.rb
  10. 2
      spec/models/form/question_spec.rb

48
app/models/constants/case_log.rb

@ -203,22 +203,22 @@ module Constants::CaseLog
}.freeze
BENEFITS = {
"1. All" => 1,
"2. Some" => 2,
"3. None" => 3,
"4. Don’t know" => 4,
"All" => 1,
"Some" => 2,
"None" => 3,
"Don’t know" => 4,
}.freeze
PERIOD = {
"1. Weekly for 52 weeks" => 1,
"2. Every 2 weeks" => 2,
"3. Every 4 weeks" => 3,
"4. Every calendar month" => 4,
"5. Weekly for 50 weeks" => 5,
"6. Weekly for 49 weeks" => 6,
"7. Weekly for 48 weeks" => 7,
"8. Weekly for 47 weeks" => 8,
"9. Weekly for 46 weeks" => 9,
"Weekly for 52 weeks" => 1,
"Every 2 weeks" => 2,
"Every 4 weeks" => 3,
"Every calendar month" => 4,
"Weekly for 50 weeks" => 5,
"Weekly for 49 weeks" => 6,
"Weekly for 48 weeks" => 7,
"Weekly for 47 weeks" => 8,
"Weekly for 46 weeks" => 9,
}.freeze
LATIME = {
@ -233,13 +233,13 @@ module Constants::CaseLog
}.freeze
HOUSING_BENEFIT = {
"1. Housing benefit" => 1,
"6. Universal Credit with housing element (excluding housing benefit)" => 6,
"7. Universal Credit (without housing element)" => 7,
"8. Housing benefit and Universal Credit (without housing element)" => 8,
"9. None" => 9,
"3. Don't know" => 3,
"10. Tenant prefers not to say" => 100,
"Housing benefit" => 1,
"Universal Credit with housing element (excluding housing benefit)" => 6,
"Universal Credit (without housing element)" => 7,
"Housing benefit and Universal Credit (without housing element)" => 8,
"None" => 9,
"Don't know" => 3,
"Tenant prefers not to say" => 100,
}.freeze
REASON = {
@ -1082,8 +1082,8 @@ module Constants::CaseLog
"Tenant prefers not to say" => 3,
}.freeze
HAS_BENEFITS_OPTIONS = ["1. Housing benefit",
"6. Universal Credit with housing element (excluding housing benefit)",
"7. Universal Credit (without housing element)",
"8. Housing benefit and Universal Credit (without housing element)"].freeze
HAS_BENEFITS_OPTIONS = ["Housing benefit",
"Universal Credit with housing element (excluding housing benefit)",
"Universal Credit (without housing element)",
"Housing benefit and Universal Credit (without housing element)"].freeze
end

14
app/models/validations/financial_validations.rb

@ -17,7 +17,7 @@ module Validations::FinancialValidations
is_employed = EMPLOYED_STATUSES.include?(economic_status)
relationship = record["relat#{n}"]
is_partner_or_main = relationship == "Partner" || (relationship.nil? && economic_status.present?)
if is_employed && is_partner_or_main && record.benefits == "1. All"
if is_employed && is_partner_or_main && record.benefits == "All"
record.errors.add :benefits, "income is from Universal Credit, state pensions or benefits cannot be All if the tenant or the partner works part or full time"
end
end
@ -38,12 +38,12 @@ module Validations::FinancialValidations
def validate_hbrentshortfall(record)
is_present = record.hbrentshortfall.present?
is_yes = record.hbrentshortfall == "Yes"
hb_donotknow = record.hb == "3. Don't know"
hb_none = record.hb == "9. None"
hb_uc_no_hb = record.hb == "7. Universal Credit (without housing element)"
hb_no_uc = record.hb == "1. Housing benefit"
hb_uc_no_he_hb = record.hb == "6. Universal Credit with housing element (excluding housing benefit)"
hb_and_uc = record.hb == "8. Housing benefit and Universal Credit (without housing element)"
hb_donotknow = record.hb == "Don't know"
hb_none = record.hb == "None"
hb_uc_no_hb = record.hb == "Universal Credit (without housing element)"
hb_no_uc = record.hb == "Housing benefit"
hb_uc_no_he_hb = record.hb == "Universal Credit with housing element (excluding housing benefit)"
hb_and_uc = record.hb == "Housing benefit and Universal Credit (without housing element)"
conditions = [
{ condition: is_yes && (hb_donotknow || hb_none || hb_uc_no_hb), error: "Outstanding amount for basic rent and/or benefit eligible charges can not be 'Yes' if tenant is not in receipt of housing benefit or universal benefit or if benefit is unknown" },

148
config/forms/2021_2022.json

@ -1913,14 +1913,14 @@
"hint_text": "",
"type": "radio",
"answer_options": {
"0": "1. Housing benefit",
"1": "6. Universal Credit with housing element (excluding housing benefit)",
"2": "8. Housing benefit and Universal Credit (without housing element)",
"3": "7. Universal Credit (without housing element)",
"4": "9. None",
"0": "Housing benefit",
"1": "Universal Credit with housing element (excluding housing benefit)",
"2": "Housing benefit and Universal Credit (without housing element)",
"3": "Universal Credit (without housing element)",
"4": "None",
"divider": true,
"5": "3. Don't know",
"6": "10. Tenant prefers not to say"
"5": "Don't know",
"6": "Tenant prefers not to say"
}
}
}
@ -1935,11 +1935,11 @@
"hint_text": "This excludes child and housing benefit, council tax support and tax credits.",
"type": "radio",
"answer_options": {
"0": "1. All",
"1": "2. Some",
"2": "3. None",
"0": "All",
"1": "Some",
"2": "None",
"divider": true,
"3": "4. Don’t know"
"3": "Don’t know"
}
}
}
@ -1971,15 +1971,15 @@
"hint_text": "",
"type": "radio",
"answer_options": {
"0": "1. Weekly for 52 weeks",
"1": "2. Every 2 weeks",
"2": "3. Every 4 weeks",
"3": "4. Every calendar month",
"4": "5. Weekly for 50 weeks",
"5": "6. Weekly for 49 weeks",
"6": "7. Weekly for 48 weeks",
"7": "8. Weekly for 47 weeks",
"8": "9. Weekly for 46 weeks"
"0": "Weekly for 52 weeks",
"1": "Every 2 weeks",
"2": "Every 4 weeks",
"3": "Every calendar month",
"4": "Weekly for 50 weeks",
"5": "Weekly for 49 weeks",
"6": "Weekly for 48 weeks",
"7": "Weekly for 47 weeks",
"8": "Weekly for 46 weeks"
}
}
},
@ -2017,51 +2017,51 @@
}
},
"depends_on" : [{
"period": "1. Weekly for 52 weeks",
"period": "Weekly for 52 weeks",
"needstype": "Supported housing",
"nocharge": "Yes"
},{
"period": "1. Weekly for 52 weeks",
"period": "Weekly for 52 weeks",
"needstype": "Supported housing",
"nocharge": null
},{
"period": "5. Weekly for 50 weeks",
"period": "Weekly for 50 weeks",
"needstype": "Supported housing",
"nocharge": "Yes"
},{
"period": "5. Weekly for 50 weeks",
"period": "Weekly for 50 weeks",
"needstype": "Supported housing",
"nocharge": null
},{
"period": "6. Weekly for 49 weeks",
"period": "Weekly for 49 weeks",
"needstype": "Supported housing",
"nocharge": "Yes"
},{
"period": "6. Weekly for 49 weeks",
"period": "Weekly for 49 weeks",
"needstype": "Supported housing",
"nocharge": null
},{
"period": "7. Weekly for 48 weeks",
"period": "Weekly for 48 weeks",
"needstype": "Supported housing",
"nocharge": "Yes"
},{
"period": "7. Weekly for 48 weeks",
"period": "Weekly for 48 weeks",
"needstype": "Supported housing",
"nocharge": null
},{
"period": "8. Weekly for 47 weeks",
"period": "Weekly for 47 weeks",
"needstype": "Supported housing",
"nocharge": "Yes"
},{
"period": "8. Weekly for 47 weeks",
"period": "Weekly for 47 weeks",
"needstype": "Supported housing",
"nocharge": null
},{
"period": "9. Weekly for 46 weeks",
"period": "Weekly for 46 weeks",
"needstype": "Supported housing",
"nocharge": "Yes"
},{
"period": "9. Weekly for 46 weeks",
"period": "Weekly for 46 weeks",
"needstype": "Supported housing",
"nocharge": null
}
@ -2095,11 +2095,11 @@
}
},
"depends_on" : [{
"period": "2. Every 2 weeks",
"period": "Every 2 weeks",
"needstype": "Supported housing",
"nocharge": "Yes"
},{
"period": "2. Every 2 weeks",
"period": "Every 2 weeks",
"needstype": "Supported housing",
"nocharge": null
}]
@ -2132,11 +2132,11 @@
}
},
"depends_on" : [{
"period": "3. Every 4 weeks",
"period": "Every 4 weeks",
"needstype": "Supported housing",
"nocharge": "Yes"
},{
"period": "3. Every 4 weeks",
"period": "Every 4 weeks",
"needstype": "Supported housing",
"nocharge": null
}]
@ -2169,11 +2169,11 @@
}
},
"depends_on" : [{
"period": "4. Every calendar month",
"period": "Every calendar month",
"needstype": "Supported housing",
"nocharge": "Yes"
},{
"period": "4. Every calendar month",
"period": "Every calendar month",
"needstype": "Supported housing",
"nocharge": null
}]
@ -2244,100 +2244,100 @@
}
},
"depends_on" : [{
"period": "1. Weekly for 52 weeks",
"period": "Weekly for 52 weeks",
"nocharge": "Yes",
"is_carehome": "No"
},{
"period": "1. Weekly for 52 weeks",
"period": "Weekly for 52 weeks",
"nocharge": null,
"is_carehome": "No"
},{
"period": "5. Weekly for 50 weeks",
"period": "Weekly for 50 weeks",
"nocharge": "Yes",
"is_carehome": "No"
},{
"period": "5. Weekly for 50 weeks",
"period": "Weekly for 50 weeks",
"nocharge": null,
"is_carehome": "No"
},{
"period": "6. Weekly for 49 weeks",
"period": "Weekly for 49 weeks",
"nocharge": "Yes",
"is_carehome": "No"
},{
"period": "6. Weekly for 49 weeks",
"period": "Weekly for 49 weeks",
"nocharge": null,
"is_carehome": "No"
},{
"period": "7. Weekly for 48 weeks",
"period": "Weekly for 48 weeks",
"nocharge": "Yes",
"is_carehome": "No"
},{
"period": "7. Weekly for 48 weeks",
"period": "Weekly for 48 weeks",
"nocharge": null,
"is_carehome": "No"
},{
"period": "8. Weekly for 47 weeks",
"period": "Weekly for 47 weeks",
"nocharge": "Yes",
"is_carehome": "No"
},{
"period": "8. Weekly for 47 weeks",
"period": "Weekly for 47 weeks",
"nocharge": null,
"is_carehome": "No"
},{
"period": "9. Weekly for 46 weeks",
"period": "Weekly for 46 weeks",
"nocharge": "Yes",
"is_carehome": "No"
},{
"period": "9. Weekly for 46 weeks",
"period": "Weekly for 46 weeks",
"nocharge": null,
"is_carehome": "No"
},
{
"period": "1. Weekly for 52 weeks",
"period": "Weekly for 52 weeks",
"nocharge": "Yes",
"is_carehome": null
},{
"period": "1. Weekly for 52 weeks",
"period": "Weekly for 52 weeks",
"nocharge": null,
"is_carehome": null
},{
"period": "5. Weekly for 50 weeks",
"period": "Weekly for 50 weeks",
"nocharge": "Yes",
"is_carehome": null
},{
"period": "5. Weekly for 50 weeks",
"period": "Weekly for 50 weeks",
"nocharge": null,
"is_carehome": null
},{
"period": "6. Weekly for 49 weeks",
"period": "Weekly for 49 weeks",
"nocharge": "Yes",
"is_carehome": null
},{
"period": "6. Weekly for 49 weeks",
"period": "Weekly for 49 weeks",
"nocharge": null,
"is_carehome": null
},{
"period": "7. Weekly for 48 weeks",
"period": "Weekly for 48 weeks",
"nocharge": "Yes",
"is_carehome": null
},{
"period": "7. Weekly for 48 weeks",
"period": "Weekly for 48 weeks",
"nocharge": null,
"is_carehome": null
},{
"period": "8. Weekly for 47 weeks",
"period": "Weekly for 47 weeks",
"nocharge": "Yes",
"is_carehome": null
},{
"period": "8. Weekly for 47 weeks",
"period": "Weekly for 47 weeks",
"nocharge": null,
"is_carehome": null
},{
"period": "9. Weekly for 46 weeks",
"period": "Weekly for 46 weeks",
"nocharge": "Yes",
"is_carehome": null
},{
"period": "9. Weekly for 46 weeks",
"period": "Weekly for 46 weeks",
"nocharge": null,
"is_carehome": null
}
@ -2410,20 +2410,20 @@
},
"depends_on" : [{
"nocharge": "Yes",
"period": "2. Every 2 weeks",
"period": "Every 2 weeks",
"is_carehome": "No"
},{
"nocharge": null,
"period": "2. Every 2 weeks",
"period": "Every 2 weeks",
"is_carehome": "No"
},
{
"nocharge": "Yes",
"period": "2. Every 2 weeks",
"period": "Every 2 weeks",
"is_carehome": null
},{
"nocharge": null,
"period": "2. Every 2 weeks",
"period": "Every 2 weeks",
"is_carehome": null
}]
},
@ -2494,20 +2494,20 @@
},
"depends_on" : [{
"nocharge": "Yes",
"period": "3. Every 4 weeks",
"period": "Every 4 weeks",
"is_carehome": "No"
},{
"nocharge": null,
"period": "3. Every 4 weeks",
"period": "Every 4 weeks",
"is_carehome": "No"
},
{
"nocharge": "Yes",
"period": "3. Every 4 weeks",
"period": "Every 4 weeks",
"is_carehome": null
},{
"nocharge": null,
"period": "3. Every 4 weeks",
"period": "Every 4 weeks",
"is_carehome": null
}]
},
@ -2578,20 +2578,20 @@
},
"depends_on" : [{
"nocharge": "Yes",
"period": "4. Every calendar month",
"period": "Every calendar month",
"is_carehome": "No"
},{
"nocharge": null,
"period": "4. Every calendar month",
"period": "Every calendar month",
"is_carehome": "No"
},
{
"nocharge": "Yes",
"period": "4. Every calendar month",
"period": "Every calendar month",
"is_carehome": null
},{
"nocharge": null,
"period": "4. Every calendar month",
"period": "Every calendar month",
"is_carehome": null
}
]

4
docs/api/DLUHC-CORE-Data.v1.json

@ -322,8 +322,8 @@
"wchair": true,
"earnings": 1000,
"incfreq": "Monthly",
"benefits": "2. Some",
"hb": "6. Universal Credit with housing element (excluding housing benefit)",
"benefits": "Some",
"hb": "Universal Credit with housing element (excluding housing benefit)",
"period": "Weekly",
"brent": 200,
"scharge": 50,

4
spec/factories/case_log.rb

@ -71,8 +71,8 @@ FactoryBot.define do
offered { 2 }
wchair { "Yes" }
earnings { 68 }
benefits { "2. Some" }
period { "2. Every 2 weeks" }
benefits { "Some" }
period { "Every 2 weeks" }
brent { 200 }
scharge { 50 }
pscharge { 40 }

4
spec/features/form/helpers.rb

@ -10,9 +10,9 @@ module Helpers
fill_in("case-log-earnings-field", with: 18_000)
choose("case-log-incfreq-yearly-field")
click_button("Save and continue")
choose("case-log-benefits-1-all-field")
choose("case-log-benefits-all-field")
click_button("Save and continue")
choose("case-log-hb-10-tenant-prefers-not-to-say-field")
choose("case-log-hb-tenant-prefers-not-to-say-field")
click_button("Save and continue")
end

6
spec/fixtures/complete_case_log.json vendored

@ -76,9 +76,9 @@
"wchair": "Yes",
"net_income_known": "Yes – the household has a weekly income",
"earnings": 150,
"benefits": "2. Some",
"hb": "6. Universal Credit with housing element (excluding housing benefit)",
"period": "2. Every 2 weeks",
"benefits": "Some",
"hb": "Universal Credit with housing element (excluding housing benefit)",
"period": "Every 2 weeks",
"brent": 200,
"scharge": 50,
"pscharge": 40,

14
spec/fixtures/forms/2021_2022.json vendored

@ -404,8 +404,8 @@
"header": "How much of the tenant’s income is from Universal Credit, state pensions or benefits?",
"type": "radio",
"answer_options": {
"0": "1. All",
"1": "2. Some"
"0": "All",
"1": "Some"
}
}
}
@ -417,11 +417,11 @@
"header": "Is the tenant likely to be in receipt of any of these housing-related benefits?",
"type": "radio",
"answer_options": {
"0": "1. Housing benefit",
"1": "10. Tenant prefers not to say"
"0": "Housing benefit",
"1": "Tenant prefers not to say"
},
"conditional_for": {
"conditional_question": ["1. Housing benefit"]
"conditional_question": ["Housing benefit"]
}
},
"conditional_question": {
@ -461,8 +461,8 @@
"header": "Which period are rent and other charges due?",
"type": "radio",
"answer_options": {
"0": "1. Weekly for 52 weeks",
"1": "2. Every 2 weeks"
"0": "Weekly for 52 weeks",
"1": "Every 2 weeks"
}
},
"brent": {

8
spec/models/case_log_spec.rb

@ -408,7 +408,7 @@ RSpec.describe Form, type: :model do
it "Cannot be All if person 1 works full time" do
expect {
CaseLog.create!(
benefits: "1. All",
benefits: "All",
ecstat1: "Full-time - 30 hours or more",
owning_organisation: owning_organisation,
managing_organisation: managing_organisation,
@ -419,7 +419,7 @@ RSpec.describe Form, type: :model do
it "Cannot be All if person 1 works part time" do
expect {
CaseLog.create!(
benefits: "1. All",
benefits: "All",
ecstat1: "Part-time - Less than 30 hours",
owning_organisation: owning_organisation,
managing_organisation: managing_organisation,
@ -430,7 +430,7 @@ RSpec.describe Form, type: :model do
it "Cannot be 1 All if any of persons 2-4 are person 1's partner and work part or full time" do
expect {
CaseLog.create!(
benefits: "1. All",
benefits: "All",
relat2: "Partner",
ecstat2: "Part-time - Less than 30 hours",
owning_organisation: owning_organisation,
@ -1038,7 +1038,7 @@ RSpec.describe Form, type: :model do
other_hhmemb: 6,
rent_type: "London living rent",
needstype: "General needs",
hb: "1. Housing benefit",
hb: "Housing benefit",
hbrentshortfall: "No",
})
end

2
spec/models/form/question_spec.rb

@ -145,7 +145,7 @@ RSpec.describe Form::Question, type: :model do
end
it "knows whether it is enabled or not for met conditions" do
case_log.hb = "1. Housing benefit"
case_log.hb = "Housing benefit"
expect(subject.enabled?(case_log)).to be true
end
end

Loading…
Cancel
Save