Browse Source

Update depends on for postcode and referral

pull/298/head
Kat 3 years ago
parent
commit
8ab603d0ad
  1. 6
      app/models/case_log.rb
  2. 2
      app/models/form/page.rb
  3. 34
      config/forms/2021_2022.json

6
app/models/case_log.rb

@ -111,9 +111,9 @@ class CaseLog < ApplicationRecord
enum rp_medwel: POLAR, _suffix: true enum rp_medwel: POLAR, _suffix: true
enum rp_hardship: POLAR, _suffix: true enum rp_hardship: POLAR, _suffix: true
enum rp_dontknow: POLAR, _suffix: true enum rp_dontknow: POLAR, _suffix: true
enum cbl: POLAR2, _suffix: true enum cbl: POLAR, _suffix: true
enum chr: POLAR2, _suffix: true enum chr: POLAR, _suffix: true
enum cap: POLAR2, _suffix: true enum cap: POLAR, _suffix: true
enum wchair: POLAR2, _suffix: true enum wchair: POLAR2, _suffix: true
enum incfreq: INCFREQ, _suffix: true enum incfreq: INCFREQ, _suffix: true
enum benefits: BENEFITS, _suffix: true enum benefits: BENEFITS, _suffix: true

2
app/models/form/page.rb

@ -49,7 +49,7 @@ private
depends_on.any? do |conditions_set| depends_on.any? do |conditions_set|
conditions_set.all? do |question, value| conditions_set.all? do |question, value|
value.nil? ? case_log[question] == value : !case_log[question].nil? && case_log[question] == value value.nil? ? eval("case_log.#{question}") == value : !eval("case_log.#{question}").nil? && eval("case_log.#{question}") == value
end end
end end
end end

34
config/forms/2021_2022.json

@ -1449,7 +1449,7 @@
"header": "", "header": "",
"description": "", "description": "",
"questions": { "questions": {
"previuos_postcode_known": { "previous_postcode_known": {
"check_answer_label": "Do you know the postcode of the household's last settled accommodation?", "check_answer_label": "Do you know the postcode of the household's last settled accommodation?",
"header": "Do you know the property’s postcode?", "header": "Do you know the property’s postcode?",
"hint_text": "This is also known as the household's 'last settled home'.", "hint_text": "This is also known as the household's 'last settled home'.",
@ -1469,7 +1469,7 @@
"hint_text": "", "hint_text": "",
"type": "text", "type": "text",
"width": 5, "width": 5,
"inferred_answers": { "la": { "is_la_inferred": true } }, "inferred_answers": { "la": { "is_previous_la_inferred": true } },
"inferred_check_answers_value": { "inferred_check_answers_value": {
"condition": { "postcode_known": "No" }, "condition": { "postcode_known": "No" },
"value": "Not known" "value": "Not known"
@ -1483,16 +1483,16 @@
"questions": { "questions": {
"previous_la_known": { "previous_la_known": {
"check_answer_label": "Do you know the local authority of the household’s last settled accommodation?", "check_answer_label": "Do you know the local authority of the household’s last settled accommodation?",
"header": "This is also known as the household's 'last settled home'.", "header": "Do you know the local authority of the household’s last settled accommodation?",
"hint_text": "", "hint_text": "This is also known as the household's 'last settled home'.",
"type": "radio", "type": "radio",
"answer_options": { "answer_options": {
"1": "Yes", "1": "Yes",
"0": "No" "0": "No"
}, }
"depends_on": [{ "is_previous_la_inferred": false }]
} }
} },
"depends_on": [{ "is_previous_la_inferred": false }]
}, },
"previous_la": { "previous_la": {
"header": "", "header": "",
@ -1888,18 +1888,18 @@
"S92000003": "Scotland", "S92000003": "Scotland",
"W92000004": "Wales", "W92000004": "Wales",
"9300000XX": "Outside UK" "9300000XX": "Outside UK"
}, }
"depends_on": [{"previous_la_known": "Yes", "is_previous_la_inferred": false }]
} }
} },
"depends_on": [{"previous_la_known": "Yes", "is_previous_la_inferred": false }]
}, },
"reasonable_preference": { "reasonable_preference": {
"header": "", "header": "",
"description": "", "description": "",
"questions": { "questions": {
"reasonpref": { "reasonpref": {
"check_answer_label": "Was the household given 'reasonable preference' by the local authority?", "check_answer_label": "Was the household given ‘reasonable preference’ by the local authority?",
"header": "Was the household given 'reasonable preference' by the local authority?", "header": "Was the household given ‘reasonable preference’ by the local authority?",
"hint_text": "Households may be given ‘reasonable preference’ for social housing, also known as ‘priority need’, by the local authority.", "hint_text": "Households may be given ‘reasonable preference’ for social housing, also known as ‘priority need’, by the local authority.",
"type": "radio", "type": "radio",
"answer_options": { "answer_options": {
@ -1925,7 +1925,7 @@
"questions": { "questions": {
"reasonable_preference_reason": { "reasonable_preference_reason": {
"check_answer_label": "Reason for reasonable preference", "check_answer_label": "Reason for reasonable preference",
"header": "Why was the household given 'reasonable preference'?", "header": "Why was the household given ‘reasonable preference’?",
"hint_text": "Select all that apply.", "hint_text": "Select all that apply.",
"type": "checkbox", "type": "checkbox",
"answer_options": { "answer_options": {
@ -2029,7 +2029,7 @@
} }
} }
}, },
"depends_on": [{"providertype": "LA", "needstype": "General needs"}] "depends_on": [{"managing_organisation.provider_type": "LA", "needstype": "General needs"}]
}, },
"referral_prp": { "referral_prp": {
"header": "", "header": "",
@ -2080,7 +2080,7 @@
} }
} }
}, },
"depends_on": [{"providertype": "PRP", "needstype": "General needs"}] "depends_on": [{"managing_organisation.provider_type": "PRP", "needstype": "General needs"}]
}, },
"referral_supported_housing": { "referral_supported_housing": {
"header": "", "header": "",
@ -2131,7 +2131,7 @@
} }
} }
}, },
"depends_on": [{"providertype": "LA", "needstype": "Supported housing"}] "depends_on": [{"managing_organisation.provider_type": "LA", "needstype": "Supported housing"}]
}, },
"referral_supported_housing_prp": { "referral_supported_housing_prp": {
"header": "", "header": "",
@ -2185,7 +2185,7 @@
} }
} }
}, },
"depends_on": [{"providertype": "PRP", "needstype": "Supported housing"}] "depends_on": [{"managing_organisation.provider_type": "PRP", "needstype": "Supported housing"}]
} }
} }
}, },

Loading…
Cancel
Save