Browse Source

Update hb question options

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

14
app/models/constants/case_log.rb

@ -229,13 +229,13 @@ module Constants::CaseLog
}.freeze }.freeze
HOUSING_BENEFIT = { HOUSING_BENEFIT = {
"Housing Benefit, but not Universal Credit" => 1, "1. Housing benefit" => 1,
"Universal Credit with housing element, but not Housing Benefit" => 6, "6. Universal Credit with housing element (excluding housing benefit)" => 6,
"Universal Credit without housing element and no Housing Benefit" => 7, "7. Universal Credit (without housing element)" => 7,
"Universal Credit and Housing Benefit" => 8, "8. Housing benefit and Universal Credit (without housing element)" => 8,
"Not Housing Benefit or Universal Credit" => 9, "9. None" => 9,
"Don’t know" => 3, "3. Don't know" => 3,
"Prefer not to say" => 100, "10. Tenant prefers not to say" => 100,
}.freeze }.freeze
REASON = { REASON = {

14
app/models/validations/financial_validations.rb

@ -38,15 +38,15 @@ module Validations::FinancialValidations
def validate_hbrentshortfall(record) def validate_hbrentshortfall(record)
is_present = record.hbrentshortfall.present? is_present = record.hbrentshortfall.present?
is_yes = record.hbrentshortfall == "Yes" is_yes = record.hbrentshortfall == "Yes"
hb_donotknow = record.hb == "Don’t know" hb_donotknow = record.hb == "3. Don't know"
hb_no_hb_or_uc = record.hb == "Not Housing Benefit or Universal Credit" hb_none = record.hb == "9. None"
hb_uc_no_hb = record.hb == "Universal Credit without housing element and no Housing Benefit" hb_uc_no_hb = record.hb == "7. Universal Credit (without housing element)"
hb_no_uc = record.hb == "Housing Benefit, but not Universal Credit" hb_no_uc = record.hb == "1. Housing benefit"
hb_uc_no_he_hb = record.hb == "Universal Credit with housing element, but not Housing Benefit" hb_uc_no_he_hb = record.hb == "6. Universal Credit with housing element (excluding housing benefit)"
hb_and_uc = record.hb == "Universal Credit and Housing Benefit" hb_and_uc = record.hb == "8. Housing benefit and Universal Credit (without housing element)"
conditions = [ conditions = [
{ condition: is_yes && (hb_donotknow || hb_no_hb_or_uc || 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" }, { 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" },
{ condition: (hb_no_uc || hb_uc_no_he_hb || hb_and_uc) && !is_present, error: "Must be completed if Universal credit and/or Housing Benefit received" }, { condition: (hb_no_uc || hb_uc_no_he_hb || hb_and_uc) && !is_present, error: "Must be completed if Universal credit and/or Housing Benefit received" },
] ]

54
config/forms/2021_2022.json

@ -1799,10 +1799,10 @@
} }
}, },
"rent_and_charges": { "rent_and_charges": {
"label": "Rent and charges", "label": "Finances",
"subsections": { "subsections": {
"income_and_benefits": { "income_and_benefits": {
"label": "Income and benefits", "label": "Income, benefits and outgoings",
"depends_on": { "about_this_log": "completed" }, "depends_on": { "about_this_log": "completed" },
"pages": { "pages": {
"net_income_known": { "net_income_known": {
@ -1826,7 +1826,9 @@
} }
}, },
"weekly_net_income": { "weekly_net_income": {
"depends_on": { "net_income_known": "Yes – the household has a weekly income" }, "depends_on": {
"net_income_known": "Yes – the household has a weekly income"
},
"header": "", "header": "",
"description": "", "description": "",
"questions": { "questions": {
@ -1852,7 +1854,9 @@
} }
}, },
"monthly_net_income": { "monthly_net_income": {
"depends_on": { "net_income_known": "Yes – the household has a monthly income" }, "depends_on": {
"net_income_known": "Yes – the household has a monthly income"
},
"header": "", "header": "",
"description": "", "description": "",
"questions": { "questions": {
@ -1878,7 +1882,9 @@
} }
}, },
"yearly_net_income": { "yearly_net_income": {
"depends_on": { "net_income_known": "Yes – the household has a yearly income" }, "depends_on": {
"net_income_known": "Yes – the household has a yearly income"
},
"header": "", "header": "",
"description": "", "description": "",
"questions": { "questions": {
@ -1903,43 +1909,43 @@
} }
} }
}, },
"net_income_uc_proportion": { "housing_benefit": {
"header": "", "header": "",
"description": "", "description": "",
"questions": { "questions": {
"benefits": { "hb": {
"check_answer_label": "Benefits as a proportion of income", "check_answer_label": "Universal Credit & Housing Benefit",
"header": "How much of the tenant’s income is from Universal Credit, state pensions or benefits?", "header": "Is the household likely to be receiving any of these housing-related benefits?",
"hint_text": "", "hint_text": "",
"type": "radio", "type": "radio",
"answer_options": { "answer_options": {
"0": "All", "0": "1. Housing benefit",
"1": "Some", "1": "6. Universal Credit with housing element (excluding housing benefit)",
"2": "None", "2": "8. Housing benefit and Universal Credit (without housing element)",
"3": "7. Universal Credit (without housing element)",
"4": "9. None",
"divider": true, "divider": true,
"3": "Don’t know" "5": "3. Don't know",
"6": "10. Tenant prefers not to say"
} }
} }
} }
}, },
"housing_benefit": { "net_income_uc_proportion": {
"header": "", "header": "",
"description": "", "description": "",
"questions": { "questions": {
"hb": { "benefits": {
"check_answer_label": "Housing-related benefits received", "check_answer_label": "Benefits as a proportion of income",
"header": "Is the tenant likely to be in receipt of any of these housing-related benefits?", "header": "How much of the tenant’s income is from Universal Credit, state pensions or benefits?",
"hint_text": "", "hint_text": "",
"type": "radio", "type": "radio",
"answer_options": { "answer_options": {
"0": "Housing Benefit, but not Universal Credit", "0": "All",
"1": "Universal Credit with housing element, but not Housing Benefit", "1": "Some",
"2": "Universal Credit without housing element and no Housing Benefit", "2": "None",
"3": "Universal Credit and Housing Benefit",
"4": "Not Housing Benefit or Universal Credit",
"divider": true, "divider": true,
"5": "Don’t know", "3": "Don’t know"
"6": "Prefer not to say"
} }
} }
} }

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

@ -323,7 +323,7 @@
"earnings": 1000, "earnings": 1000,
"incfreq": "Monthly", "incfreq": "Monthly",
"benefits": "Some", "benefits": "Some",
"hb": "Universal Credit with housing element, but not Housing Benefit", "hb": "6. Universal Credit with housing element (excluding housing benefit)",
"period": "Weekly", "period": "Weekly",
"brent": 200, "brent": 200,
"scharge": 50, "scharge": 50,

2
spec/features/form/helpers.rb

@ -12,7 +12,7 @@ module Helpers
click_button("Save and continue") click_button("Save and continue")
choose("case-log-benefits-all-field") choose("case-log-benefits-all-field")
click_button("Save and continue") click_button("Save and continue")
choose("case-log-hb-prefer-not-to-say-field") choose("case-log-hb-10-tenant-prefers-not-to-say-field")
click_button("Save and continue") click_button("Save and continue")
end end

2
spec/fixtures/complete_case_log.json vendored

@ -77,7 +77,7 @@
"net_income_known": "Yes – the household has a weekly income", "net_income_known": "Yes – the household has a weekly income",
"earnings": 150, "earnings": 150,
"benefits": "Some", "benefits": "Some",
"hb": "Universal Credit with housing element, but not Housing Benefit", "hb": "6. Universal Credit with housing element (excluding housing benefit)",
"period": "Fortnightly", "period": "Fortnightly",
"brent": 200, "brent": 200,
"scharge": 50, "scharge": 50,

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

@ -417,11 +417,11 @@
"header": "Is the tenant likely to be in receipt of any of these housing-related benefits?", "header": "Is the tenant likely to be in receipt of any of these housing-related benefits?",
"type": "radio", "type": "radio",
"answer_options": { "answer_options": {
"0": "Housing Benefit, but not Universal Credit", "0": "1. Housing benefit",
"1": "Prefer not to say" "1": "10. Tenant prefers not to say"
}, },
"conditional_for": { "conditional_for": {
"conditional_question": ["Housing Benefit, but not Universal Credit"] "conditional_question": ["1. Housing benefit"]
} }
}, },
"conditional_question": { "conditional_question": {

2
spec/models/form/question_spec.rb

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

Loading…
Cancel
Save