record.errors.add:net_income_uc_proportion,"income is from Universal Credit, state pensions or benefits cannot be All if the tenant or the partner works part or full time"
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"
ifrecord.reason_for_leaving_last_settled_home=="Do not know"&&record.benefit_cap_spare_room_subsidy!="Do not know"
ifrecord.reason_for_leaving_last_settled_home=="Do not know"&&record.underoccupation_benefitcap!="Do not know"
record.errors.add:benefit_cap_spare_room_subsidy,"must be do not know if tenant’s main reason for leaving is do not know"
record.errors.add:underoccupation_benefitcap,"must be do not know if tenant’s main reason for leaving is do not know"
end
end
end
end
defvalidate_armed_forces_injured(record)
defvalidate_armed_forces_injured(record)
if(record.armed_forces=="Yes - a regular"||record.armed_forces=="Yes - a reserve")&&record.armed_forces_injured.blank?
if(record.armed_forces=="Yes - a regular"||record.armed_forces=="Yes - a reserve")&&record.reservist.blank?
record.errors.add:armed_forces_injured,"You must answer the armed forces injury question if the tenant has served in the armed forces"
record.errors.add:reservist,"You must answer the armed forces injury question if the tenant has served in the armed forces"
end
end
if(record.armed_forces=="No"||record.armed_forces=="Prefer not to say")&&record.armed_forces_injured.present?
if(record.armed_forces=="No"||record.armed_forces=="Prefer not to say")&&record.reservist.present?
record.errors.add:armed_forces_injured,"You must not answer the armed forces injury question if the tenant has not served in the armed forces or prefer not to say was chosen"
record.errors.add:reservist,"You must not answer the armed forces injury question if the tenant has not served in the armed forces or prefer not to say was chosen"
end
end
end
end
defvalidate_armed_forces_active_response(record)
defvalidate_armed_forces_active_response(record)
ifrecord.armed_forces=="Yes - a regular"&&record.armed_forces_active.blank?
ifrecord.armed_forces=="Yes - a regular"&&record.leftreg.blank?
record.errors.add:armed_forces_active,"You must answer the armed forces active question if the tenant has served as a regular in the armed forces"
record.errors.add:leftreg,"You must answer the armed forces active question if the tenant has served as a regular in the armed forces"
end
end
ifrecord.armed_forces!="Yes - a regular"&&record.armed_forces_active.present?
ifrecord.armed_forces!="Yes - a regular"&&record.leftreg.present?
record.errors.add:armed_forces_active,"You must not answer the armed forces active question if the tenant has not served as a regular in the armed forces"
record.errors.add:leftreg,"You must not answer the armed forces active question if the tenant has not served as a regular in the armed forces"
end
end
end
end
defvalidate_household_pregnancy(record)
defvalidate_household_pregnancy(record)
if(record.pregnancy=="Yes"||record.pregnancy=="Prefer not to say")&&!women_of_child_bearing_age_in_household(record)
if(record.preg_occ=="Yes"||record.preg_occ=="Prefer not to say")&&!women_of_child_bearing_age_in_household(record)
record.errors.add:pregnancy,"You must answer no as there are no female tenants aged 16-50 in the property"
record.errors.add:preg_occ,"You must answer no as there are no female tenants aged 16-50 in the property"
ifage>=16&&age<=19&&relationship=="Child - includes young adult and grown-up"&&(economic_status!="Full-time student"||economic_status!="Prefer not to say")
ifage>=16&&age<=19&&relationship=="Child - includes young adult and grown-up"&&(economic_status!="Full-time student"||economic_status!="Prefer not to say")
record.errors.add"person_#{person_num}_economic_status","If age is between 16 and 19 - tenant #{person_num} must be a full time student or prefer not to say."
record.errors.add"ecstat#{person_num}","If age is between 16 and 19 - tenant #{person_num} must be a full time student or prefer not to say."
"header":"Which of these best describes the tenant's gender identity?",
"header":"Which of these best describes the tenant's gender identity?",
"hint_text":"",
"hint_text":"",
@ -233,7 +233,7 @@
"header":"",
"header":"",
"description":"",
"description":"",
"questions":{
"questions":{
"tenant_ethnic_group":{
"ethnic":{
"check_answer_label":"Ethnicity",
"check_answer_label":"Ethnicity",
"header":"What is the tenant's ethnic group?",
"header":"What is the tenant's ethnic group?",
"hint_text":"",
"hint_text":"",
@ -266,7 +266,7 @@
"header":"",
"header":"",
"description":"",
"description":"",
"questions":{
"questions":{
"tenant_nationality":{
"national":{
"check_answer_label":"Nationality",
"check_answer_label":"Nationality",
"header":"What is the tenant's nationality?",
"header":"What is the tenant's nationality?",
"hint_text":"",
"hint_text":"",
@ -296,7 +296,7 @@
"header":"",
"header":"",
"description":"",
"description":"",
"questions":{
"questions":{
"person_1_economic_status":{
"ecstat1":{
"check_answer_label":"Work",
"check_answer_label":"Work",
"header":"Which of these best describes the tenant's working situation?",
"header":"Which of these best describes the tenant's working situation?",
"hint_text":"",
"hint_text":"",
@ -321,7 +321,7 @@
"header":"",
"header":"",
"description":"",
"description":"",
"questions":{
"questions":{
"household_number_of_other_members":{
"hhmemb":{
"check_answer_label":"Number of Other Household Members",
"check_answer_label":"Number of Other Household Members",
"header":"How many other people are there in the household?",
"header":"How many other people are there in the household?",
"hint_text":"The maximum number of others is 7",
"hint_text":"The maximum number of others is 7",
@ -330,37 +330,37 @@
"max":7,
"max":7,
"step":1,
"step":1,
"conditional_for":{
"conditional_for":{
"person_2_relationship":">0",
"relat2":">0",
"person_2_age":">0",
"age2":">0",
"person_2_gender":">0",
"sex2":">0",
"person_2_economic_status":">0",
"ecstat2":">0",
"person_3_relationship":">1",
"relat3":">1",
"person_3_age":">1",
"age3":">1",
"person_3_gender":">1",
"sex3":">1",
"person_3_economic_status":">1",
"ecstat3":">1",
"person_4_relationship":">2",
"relat4":">2",
"person_4_age":">2",
"age4":">2",
"person_4_gender":">2",
"sex4":">2",
"person_4_economic_status":">2",
"ecstat4":">2",
"person_5_relationship":">3",
"relat5":">3",
"person_5_age":">3",
"age5":">3",
"person_5_gender":">3",
"sex5":">3",
"person_5_economic_status":">3",
"ecstat5":">3",
"person_6_relationship":">4",
"relat6":">4",
"person_6_age":">4",
"age6":">4",
"person_6_gender":">4",
"sex6":">4",
"person_6_economic_status":">4",
"ecstat6":">4",
"person_7_relationship":">5",
"relat7":">5",
"person_7_age":">5",
"age7":">5",
"person_7_gender":">5",
"sex7":">5",
"person_7_economic_status":">5",
"ecstat7":">5",
"person_8_relationship":">6",
"relat8":">6",
"person_8_age":">6",
"age8":">6",
"person_8_gender":">6",
"sex8":">6",
"person_8_economic_status":">6"
"ecstat8":">6"
}
}
},
},
"person_2_relationship":{
"relat2":{
"check_answer_label":"Person 2's relationship to lead tenant",
"check_answer_label":"Person 2's relationship to lead tenant",
"header":"What's person 2's relationship to lead tenant",
"header":"What's person 2's relationship to lead tenant",
"hint_text":"",
"hint_text":"",
@ -372,7 +372,7 @@
"3":"Prefer not to say"
"3":"Prefer not to say"
}
}
},
},
"person_2_age":{
"age2":{
"check_answer_label":"Person 2's age",
"check_answer_label":"Person 2's age",
"header":"What's person 2's age",
"header":"What's person 2's age",
"hint_text":"",
"hint_text":"",
@ -381,7 +381,7 @@
"max":150,
"max":150,
"step":1
"step":1
},
},
"person_2_gender":{
"sex2":{
"check_answer_label":"Person 2's gender",
"check_answer_label":"Person 2's gender",
"header":"Which of these best describes person 2's gender identity?",
"header":"Which of these best describes person 2's gender identity?",
"hint_text":"",
"hint_text":"",
@ -393,7 +393,7 @@
"3":"Prefer not to say"
"3":"Prefer not to say"
}
}
},
},
"person_2_economic_status":{
"ecstat2":{
"check_answer_label":"Person 2's Work",
"check_answer_label":"Person 2's Work",
"header":"Which of these best describes person 2's working situation?",
"header":"Which of these best describes person 2's working situation?",
"hint_text":"",
"hint_text":"",
@ -412,7 +412,7 @@
"10":"Prefer not to say"
"10":"Prefer not to say"
}
}
},
},
"person_3_relationship":{
"relat3":{
"check_answer_label":"Person 3's relationship to lead tenant",
"check_answer_label":"Person 3's relationship to lead tenant",
"header":"What's person 3's relationship to lead tenant",
"header":"What's person 3's relationship to lead tenant",
"hint_text":"",
"hint_text":"",
@ -424,7 +424,7 @@
"3":"Prefer not to say"
"3":"Prefer not to say"
}
}
},
},
"person_3_age":{
"age3":{
"check_answer_label":"Person 3's age",
"check_answer_label":"Person 3's age",
"header":"What's person 3's age",
"header":"What's person 3's age",
"hint_text":"",
"hint_text":"",
@ -433,7 +433,7 @@
"max":150,
"max":150,
"step":1
"step":1
},
},
"person_3_gender":{
"sex3":{
"check_answer_label":"Person 3's gender",
"check_answer_label":"Person 3's gender",
"header":"Which of these best describes person 3's gender identity?",
"header":"Which of these best describes person 3's gender identity?",
"hint_text":"",
"hint_text":"",
@ -445,7 +445,7 @@
"3":"Prefer not to say"
"3":"Prefer not to say"
}
}
},
},
"person_3_economic_status":{
"ecstat3":{
"check_answer_label":"Person 3's Work",
"check_answer_label":"Person 3's Work",
"header":"Which of these best describes person 3's working situation?",
"header":"Which of these best describes person 3's working situation?",
"hint_text":"",
"hint_text":"",
@ -464,7 +464,7 @@
"10":"Prefer not to say"
"10":"Prefer not to say"
}
}
},
},
"person_4_relationship":{
"relat4":{
"check_answer_label":"Person 4's relationship to lead tenant",
"check_answer_label":"Person 4's relationship to lead tenant",
"header":"What's person 4's relationship to lead tenant",
"header":"What's person 4's relationship to lead tenant",
"hint_text":"",
"hint_text":"",
@ -476,7 +476,7 @@
"3":"Prefer not to say"
"3":"Prefer not to say"
}
}
},
},
"person_4_age":{
"age4":{
"check_answer_label":"Person 4's age",
"check_answer_label":"Person 4's age",
"header":"What's person 4's age",
"header":"What's person 4's age",
"hint_text":"",
"hint_text":"",
@ -485,7 +485,7 @@
"max":150,
"max":150,
"step":1
"step":1
},
},
"person_4_gender":{
"sex4":{
"check_answer_label":"Person 4's gender",
"check_answer_label":"Person 4's gender",
"header":"Which of these best describes person 4's gender identity?",
"header":"Which of these best describes person 4's gender identity?",
"hint_text":"",
"hint_text":"",
@ -497,7 +497,7 @@
"3":"Prefer not to say"
"3":"Prefer not to say"
}
}
},
},
"person_4_economic_status":{
"ecstat4":{
"check_answer_label":"Person 4's Work",
"check_answer_label":"Person 4's Work",
"header":"Which of these best describes person 4's working situation?",
"header":"Which of these best describes person 4's working situation?",
"hint_text":"",
"hint_text":"",
@ -516,7 +516,7 @@
"10":"Prefer not to say"
"10":"Prefer not to say"
}
}
},
},
"person_5_relationship":{
"relat5":{
"check_answer_label":"Person 5's relationship to lead tenant",
"check_answer_label":"Person 5's relationship to lead tenant",
"header":"What's person 5's relationship to lead tenant",
"header":"What's person 5's relationship to lead tenant",
"hint_text":"",
"hint_text":"",
@ -528,7 +528,7 @@
"3":"Prefer not to say"
"3":"Prefer not to say"
}
}
},
},
"person_5_age":{
"age5":{
"check_answer_label":"Person 5's age",
"check_answer_label":"Person 5's age",
"header":"What's person 5's age",
"header":"What's person 5's age",
"hint_text":"",
"hint_text":"",
@ -537,7 +537,7 @@
"max":150,
"max":150,
"step":1
"step":1
},
},
"person_5_gender":{
"sex5":{
"check_answer_label":"Person 5's gender",
"check_answer_label":"Person 5's gender",
"header":"Which of these best describes person 5's gender identity?",
"header":"Which of these best describes person 5's gender identity?",
"hint_text":"",
"hint_text":"",
@ -549,7 +549,7 @@
"3":"Prefer not to say"
"3":"Prefer not to say"
}
}
},
},
"person_5_economic_status":{
"ecstat5":{
"check_answer_label":"Person 5's Work",
"check_answer_label":"Person 5's Work",
"header":"Which of these best describes person 5's working situation?",
"header":"Which of these best describes person 5's working situation?",
"hint_text":"",
"hint_text":"",
@ -568,7 +568,7 @@
"10":"Prefer not to say"
"10":"Prefer not to say"
}
}
},
},
"person_6_relationship":{
"relat6":{
"check_answer_label":"Person 6's relationship to lead tenant",
"check_answer_label":"Person 6's relationship to lead tenant",
"header":"What's person 6's relationship to lead tenant",
"header":"What's person 6's relationship to lead tenant",
"hint_text":"",
"hint_text":"",
@ -580,7 +580,7 @@
"3":"Prefer not to say"
"3":"Prefer not to say"
}
}
},
},
"person_6_age":{
"age6":{
"check_answer_label":"Person 6's age",
"check_answer_label":"Person 6's age",
"header":"What's person 6's age",
"header":"What's person 6's age",
"hint_text":"",
"hint_text":"",
@ -589,7 +589,7 @@
"max":150,
"max":150,
"step":1
"step":1
},
},
"person_6_gender":{
"sex6":{
"check_answer_label":"Person 6's gender",
"check_answer_label":"Person 6's gender",
"header":"Which of these best describes person 6's gender identity?",
"header":"Which of these best describes person 6's gender identity?",
"hint_text":"",
"hint_text":"",
@ -601,7 +601,7 @@
"3":"Prefer not to say"
"3":"Prefer not to say"
}
}
},
},
"person_6_economic_status":{
"ecstat6":{
"check_answer_label":"Person 6's Work",
"check_answer_label":"Person 6's Work",
"header":"Which of these best describes person 6's working situation?",
"header":"Which of these best describes person 6's working situation?",
"hint_text":"",
"hint_text":"",
@ -620,7 +620,7 @@
"10":"Prefer not to say"
"10":"Prefer not to say"
}
}
},
},
"person_7_relationship":{
"relat7":{
"check_answer_label":"Person 7's relationship to lead tenant",
"check_answer_label":"Person 7's relationship to lead tenant",
"header":"What's person 7's relationship to lead tenant",
"header":"What's person 7's relationship to lead tenant",
"hint_text":"",
"hint_text":"",
@ -632,7 +632,7 @@
"3":"Prefer not to say"
"3":"Prefer not to say"
}
}
},
},
"person_7_age":{
"age7":{
"check_answer_label":"Person 7's age",
"check_answer_label":"Person 7's age",
"header":"What's person 7's age",
"header":"What's person 7's age",
"hint_text":"",
"hint_text":"",
@ -641,7 +641,7 @@
"max":150,
"max":150,
"step":1
"step":1
},
},
"person_7_gender":{
"sex7":{
"check_answer_label":"Person 7's gender",
"check_answer_label":"Person 7's gender",
"header":"Which of these best describes person 7's gender identity?",
"header":"Which of these best describes person 7's gender identity?",
"hint_text":"",
"hint_text":"",
@ -653,7 +653,7 @@
"3":"Prefer not to say"
"3":"Prefer not to say"
}
}
},
},
"person_7_economic_status":{
"ecstat7":{
"check_answer_label":"Person 7's Work",
"check_answer_label":"Person 7's Work",
"header":"Which of these best describes person 7's working situation?",
"header":"Which of these best describes person 7's working situation?",
"hint_text":"",
"hint_text":"",
@ -672,7 +672,7 @@
"10":"Prefer not to say"
"10":"Prefer not to say"
}
}
},
},
"person_8_relationship":{
"relat8":{
"check_answer_label":"Person 8's relationship to lead tenant",
"check_answer_label":"Person 8's relationship to lead tenant",
"header":"What's person 8's relationship to lead tenant",
"header":"What's person 8's relationship to lead tenant",
"hint_text":"",
"hint_text":"",
@ -684,7 +684,7 @@
"3":"Prefer not to say"
"3":"Prefer not to say"
}
}
},
},
"person_8_age":{
"age8":{
"check_answer_label":"Person 8's age",
"check_answer_label":"Person 8's age",
"header":"What's person 8's age",
"header":"What's person 8's age",
"hint_text":"",
"hint_text":"",
@ -693,7 +693,7 @@
"max":150,
"max":150,
"step":1
"step":1
},
},
"person_8_gender":{
"sex8":{
"check_answer_label":"Person 8's gender",
"check_answer_label":"Person 8's gender",
"header":"Which of these best describes person 8's gender identity?",
"header":"Which of these best describes person 8's gender identity?",
"hint_text":"",
"hint_text":"",
@ -705,7 +705,7 @@
"3":"Prefer not to say"
"3":"Prefer not to say"
}
}
},
},
"person_8_economic_status":{
"ecstat8":{
"check_answer_label":"Person 8's Work",
"check_answer_label":"Person 8's Work",
"header":"Which of these best describes person 8's working situation?",
"header":"Which of these best describes person 8's working situation?",
"hint_text":"",
"hint_text":"",
@ -735,7 +735,7 @@
"header":"",
"header":"",
"description":"",
"description":"",
"questions":{
"questions":{
"previous_housing_situation":{
"prevten":{
"header":"What was the tenant’s housing situation immediately before this letting?",
"header":"What was the tenant’s housing situation immediately before this letting?",
"hint_text":"",
"hint_text":"",
"type":"radio",
"type":"radio",
@ -771,7 +771,7 @@
"header":"",
"header":"",
"description":"",
"description":"",
"questions":{
"questions":{
"homelessness":{
"homeless":{
"header":"Did the tenant experience homelessness immediately before this letting?",
"header":"Did the tenant experience homelessness immediately before this letting?",
"hint_text":"",
"hint_text":"",
"type":"radio",
"type":"radio",
@ -836,7 +836,7 @@
"hint_text":"",
"hint_text":"",
"type":"text"
"type":"text"
},
},
"benefit_cap_spare_room_subsidy":{
"underoccupation_benefitcap":{
"header":"Was the reason for leaving because of the benefit cap or removal of the spare room subsidy?",
"header":"Was the reason for leaving because of the benefit cap or removal of the spare room subsidy?",
"hint_text":"",
"hint_text":"",
"type":"radio",
"type":"radio",
@ -872,11 +872,11 @@
"3":"Prefer not to say"
"3":"Prefer not to say"
},
},
"conditional_for":{
"conditional_for":{
"armed_forces_active":["Yes - a regular","Yes - a reserve"],
"leftreg":["Yes - a regular","Yes - a reserve"],
"armed_forces_injured":["Yes - a regular","Yes - a reserve"]
"reservist":["Yes - a regular","Yes - a reserve"]
}
}
},
},
"armed_forces_active":{
"leftreg":{
"header":"Are they still serving?",
"header":"Are they still serving?",
"hint_text":"",
"hint_text":"",
"type":"radio",
"type":"radio",
@ -888,7 +888,7 @@
"3":"Prefer not to say"
"3":"Prefer not to say"
}
}
},
},
"armed_forces_injured":{
"reservist":{
"header":"Were they seriously injured or ill as a result of their service?",
"header":"Were they seriously injured or ill as a result of their service?",
"hint_text":"",
"hint_text":"",
"type":"radio",
"type":"radio",
@ -917,7 +917,7 @@
"header":"",
"header":"",
"description":"",
"description":"",
"questions":{
"questions":{
"medical_conditions":{
"illness":{
"header":"Does anyone in the household have any of the following that they expect to last for 12 months or more:<ul><li>Physical Condition</li><li>Mental Health Condition</li><li>Other Illness</li></ul>",
"header":"Does anyone in the household have any of the following that they expect to last for 12 months or more:<ul><li>Physical Condition</li><li>Mental Health Condition</li><li>Other Illness</li></ul>",
"accessibility_requirements_do_not_know":"Do not know",
"housingneeds_h":"Do not know",
"divider_b":true,
"divider_b":true,
"accessibility_requirements_prefer_not_to_say":"Prefer not to say"
"accessibility_requirements_prefer_not_to_say":"Prefer not to say"
}
}
@ -981,16 +981,16 @@
"type":"checkbox",
"type":"checkbox",
"check_answer_label":"Conditions or illnesses",
"check_answer_label":"Conditions or illnesses",
"answer_options":{
"answer_options":{
"condition_effects_vision":"Vision - such as blindness or partial sight",
"illness_type_1":"Vision - such as blindness or partial sight",
"condition_effects_hearing":"Hearing - such as deafness or partial hearing",
"illness_type_2":"Hearing - such as deafness or partial hearing",
"condition_effects_mobility":"Mobility - such as walking short distances or climbing stairs",
"illness_type_3":"Mobility - such as walking short distances or climbing stairs",
"condition_effects_dexterity":"Dexterity - such as lifting and carrying objects or using a keyboard",
"illness_type_4":"Dexterity - such as lifting and carrying objects or using a keyboard",
"condition_effects_stamina":"Stamina or breathing or fatigue",
"illness_type_8":"Stamina or breathing or fatigue",
"condition_effects_learning":"Learning or understanding or concentrating",
"illness_type_5":"Learning or understanding or concentrating",
"condition_effects_memory":"Memory",
"illness_type_6":"Memory",
"condition_effects_mental_health":"Mental health - such as depression, anxiety, schizophrenia or bipolar",
"illness_type_7":"Mental health - such as depression, anxiety, schizophrenia or bipolar",
"condition_effects_social_or_behavioral":"Socially or behaviourally - such as those associated with autism spectral disorder (ASD) including Aspergers’ or attention deficit hyperactivity disorder (ADHD))",
"illness_type_9":"Socially or behaviourally - such as those associated with autism spectral disorder (ASD) including Aspergers’ or attention deficit hyperactivity disorder (ADHD))",
"condition_effects_other":"Other",
"illness_type_10":"Other",
"divider":true,
"divider":true,
"condition_effects_prefer_not_to_say":"Prefer not to say"
"condition_effects_prefer_not_to_say":"Prefer not to say"
}
}
@ -1023,7 +1023,7 @@
"header":"",
"header":"",
"description":"",
"description":"",
"questions":{
"questions":{
"tenancy_start_date":{
"startdate":{
"check_answer_label":"When is the tenancy start date?",
"check_answer_label":"When is the tenancy start date?",
"header":"What is the tenancy start date?",
"header":"What is the tenancy start date?",
"hint_text":"For example, 27 3 2007",
"hint_text":"For example, 27 3 2007",
@ -1035,7 +1035,7 @@
"header":"",
"header":"",
"description":"",
"description":"",
"questions":{
"questions":{
"starter_tenancy":{
"startertenancy":{
"check_answer_label":"Is this a starter or introductory tenancy?",
"check_answer_label":"Is this a starter or introductory tenancy?",
"header":"Is this a starter tenancy?",
"header":"Is this a starter tenancy?",
"hint_text":"",
"hint_text":"",
@ -1051,7 +1051,7 @@
"header":"",
"header":"",
"description":"",
"description":"",
"questions":{
"questions":{
"fixed_term_tenancy":{
"tenancylength":{
"check_answer_label":"If the main tenancy is a fixed term tenancy, please provide the length of the fixed term (to the nearest year) excluding any starter/introductory period",
"check_answer_label":"If the main tenancy is a fixed term tenancy, please provide the length of the fixed term (to the nearest year) excluding any starter/introductory period",
"header":"If fixed-term, what is the length of the fixed-term tenancy after any starter period?",
"header":"If fixed-term, what is the length of the fixed-term tenancy after any starter period?",
"hint_text":"To the nearest year",
"hint_text":"To the nearest year",
@ -1066,7 +1066,7 @@
"header":"",
"header":"",
"description":"",
"description":"",
"questions":{
"questions":{
"tenancy_type":{
"tenancy":{
"check_answer_label":"Type of main tenancy (after any starter/introductory period)",
"check_answer_label":"Type of main tenancy (after any starter/introductory period)",
"header":"What is the type of tenancy after the starter period has ended?",
"header":"What is the type of tenancy after the starter period has ended?",
"hint_text":"",
"hint_text":"",
@ -1083,7 +1083,7 @@
"other_tenancy_type":["Other"]
"other_tenancy_type":["Other"]
}
}
},
},
"other_tenancy_type":{
"tenancyother":{
"header":"Please state the tenancy type",
"header":"Please state the tenancy type",
"hint_text":"",
"hint_text":"",
"type":"text"
"type":"text"
@ -1094,7 +1094,7 @@
"header":"",
"header":"",
"description":"",
"description":"",
"questions":{
"questions":{
"letting_type":{
"lettype":{
"check_answer_label":"Type of letting",
"check_answer_label":"Type of letting",
"header":"Which type of letting is this?",
"header":"Which type of letting is this?",
"hint_text":"",
"hint_text":"",
@ -1114,7 +1114,7 @@
"header":"",
"header":"",
"description":"",
"description":"",
"questions":{
"questions":{
"letting_provider":{
"landlord":{
"check_answer_label":"Provider",
"check_answer_label":"Provider",
"header":"Who is the letting provider?",
"header":"Who is the letting provider?",
"hint_text":"",
"hint_text":"",
@ -1490,7 +1490,7 @@
"header":"",
"header":"",
"description":"",
"description":"",
"questions":{
"questions":{
"property_vacancy_reason":{
"rsnvac":{
"check_answer_label":"What is the reason for the property vacancy?",
"check_answer_label":"What is the reason for the property vacancy?",
"header":"What is the reason for the property vacancy?",
"header":"What is the reason for the property vacancy?",
"hint_text":"",
"hint_text":"",
@ -1530,7 +1530,7 @@
"header":"",
"header":"",
"description":"",
"description":"",
"questions":{
"questions":{
"property_unit_type":{
"unittype_gn":{
"check_answer_label":"Which type of unit is the property?",
"check_answer_label":"Which type of unit is the property?",
"header":"Which type of unit is the property?",
"header":"Which type of unit is the property?",
"hint_text":"",
"hint_text":"",
@ -1552,7 +1552,7 @@
"header":"",
"header":"",
"description":"",
"description":"",
"questions":{
"questions":{
"property_number_of_bedrooms":{
"beds":{
"check_answer_label":"How many bedrooms are there in the property?",
"check_answer_label":"How many bedrooms are there in the property?",
"header":"How many bedrooms are there in the property?",
"header":"How many bedrooms are there in the property?",
"hint_text":"If shared accommodation, enter number of bedrooms occupied by this household; a bed-sit has 1 bedroom",
"hint_text":"If shared accommodation, enter number of bedrooms occupied by this household; a bed-sit has 1 bedroom",
@ -1592,7 +1592,7 @@
"header":"",
"header":"",
"description":"",
"description":"",
"questions":{
"questions":{
"property_number_of_times_relet":{
"offered":{
"check_answer_label":"How many times has this unit been previously offered since becoming available for relet since the last tenancy ended or as a first let?",
"check_answer_label":"How many times has this unit been previously offered since becoming available for relet since the last tenancy ended or as a first let?",
"header":"How many times has this unit been previously offered since becoming available for relet since the last tenancy ended or as a first let? ",
"header":"How many times has this unit been previously offered since becoming available for relet since the last tenancy ended or as a first let? ",
"hint_text":"For an Affordable Rent or Intermediate Rent Letting, only include number of offers as that type. For a property let at the first attempt enter '0' ",
"hint_text":"For an Affordable Rent or Intermediate Rent Letting, only include number of offers as that type. For a property let at the first attempt enter '0' ",
@ -1607,7 +1607,7 @@
"header":"",
"header":"",
"description":"",
"description":"",
"questions":{
"questions":{
"property_wheelchair_accessible":{
"wchair":{
"check_answer_label":"Is property built or adapted to wheelchair user standards?",
"check_answer_label":"Is property built or adapted to wheelchair user standards?",
"header":"Is property built or adapted to wheelchair user standards?",
"header":"Is property built or adapted to wheelchair user standards?",
"hint_text":"",
"hint_text":"",
@ -1644,11 +1644,11 @@
"2":"Tenant prefers not to say"
"2":"Tenant prefers not to say"
},
},
"conditional_for":{
"conditional_for":{
"net_income":["Yes"],
"earnings":["Yes"],
"net_income_frequency":["Yes"]
"incfreq":["Yes"]
}
}
},
},
"net_income":{
"earnings":{
"check_answer_label":"Income",
"check_answer_label":"Income",
"header":"What is the tenant’s /and partner’s combined income after tax?",
"header":"What is the tenant’s /and partner’s combined income after tax?",
"hint_text":"",
"hint_text":"",
@ -1656,7 +1656,7 @@
"min":0,
"min":0,
"step":"1"
"step":"1"
},
},
"net_income_frequency":{
"incfreq":{
"check_answer_label":"Income Frequency",
"check_answer_label":"Income Frequency",
"header":"How often do they receive this income?",
"header":"How often do they receive this income?",
"hint_text":"",
"hint_text":"",
@ -1682,7 +1682,7 @@
"header":"",
"header":"",
"description":"",
"description":"",
"questions":{
"questions":{
"net_income_uc_proportion":{
"benefits":{
"check_answer_label":"Benefits as a proportion of income",
"check_answer_label":"Benefits as a proportion of income",
"header":"How much of the tenant’s income is from Universal Credit, state pensions or benefits?",
"header":"How much of the tenant’s income is from Universal Credit, state pensions or benefits?",
"header":"Which of these best describes the tenant's gender identity?",
"header":"Which of these best describes the tenant's gender identity?",
"type":"radio",
"type":"radio",
@ -45,7 +45,7 @@
},
},
"household_number_of_other_members":{
"household_number_of_other_members":{
"questions":{
"questions":{
"household_number_of_other_members":{
"hhmemb":{
"check_answer_label":"Number of Other Household Members",
"check_answer_label":"Number of Other Household Members",
"header":"How many other people are there in the household?",
"header":"How many other people are there in the household?",
"hint_text":"The maximum number of others is 1",
"hint_text":"The maximum number of others is 1",
@ -54,13 +54,13 @@
"max":1,
"max":1,
"step":1,
"step":1,
"conditional_for":{
"conditional_for":{
"person_2_relationship":">0",
"relat2":">0",
"person_2_age":">0",
"age2":">0",
"person_2_gender":">0",
"sex2":">0",
"person_2_economic_status":">0"
"ecstat2":">0"
}
}
},
},
"person_2_relationship":{
"relat2":{
"check_answer_label":"Person 2's relationship to lead tenant",
"check_answer_label":"Person 2's relationship to lead tenant",
"header":"What's person 2's relationship to lead tenant",
"header":"What's person 2's relationship to lead tenant",
"type":"radio",
"type":"radio",
@ -69,7 +69,7 @@
"1":"Prefer not to say"
"1":"Prefer not to say"
}
}
},
},
"person_2_age":{
"age2":{
"check_answer_label":"Person 2's age",
"check_answer_label":"Person 2's age",
"header":"What's person 2's age",
"header":"What's person 2's age",
"type":"numeric",
"type":"numeric",
@ -77,7 +77,7 @@
"max":150,
"max":150,
"step":1
"step":1
},
},
"person_2_gender":{
"sex2":{
"check_answer_label":"Person 2's gender",
"check_answer_label":"Person 2's gender",
"header":"Which of these best describes person 2's gender identity?",
"header":"Which of these best describes person 2's gender identity?",
"type":"radio",
"type":"radio",
@ -88,7 +88,7 @@
"3":"Prefer not to say"
"3":"Prefer not to say"
}
}
},
},
"person_2_economic_status":{
"ecstat2":{
"check_answer_label":"Person 2's Work",
"check_answer_label":"Person 2's Work",
"header":"Which of these best describes person 2's working situation?",
"header":"Which of these best describes person 2's working situation?",
"type":"radio",
"type":"radio",
@ -118,17 +118,11 @@
"3":"Prefer not to say"
"3":"Prefer not to say"
},
},
"conditional_for":{
"conditional_for":{
"armed_forces_active":[
"leftreg":["Yes - a regular","Yes - a reserve"],
"Yes - a regular",
"reservist":["Yes - a regular","Yes - a reserve"]
"Yes - a reserve"
],
"armed_forces_injured":[
"Yes - a regular",
"Yes - a reserve"
]
}
}
},
},
"armed_forces_active":{
"leftreg":{
"header":"Are they still serving?",
"header":"Are they still serving?",
"type":"radio",
"type":"radio",
"check_answer_label":"When did they leave the Armed Forces?",
"check_answer_label":"When did they leave the Armed Forces?",
@ -139,7 +133,7 @@
"3":"Prefer not to say"
"3":"Prefer not to say"
}
}
},
},
"armed_forces_injured":{
"reservist":{
"header":"Were they seriously injured or ill as a result of their service?",
"header":"Were they seriously injured or ill as a result of their service?",
"type":"radio",
"type":"radio",
"check_answer_label":"Has anyone in the household been seriously injured or ill as a result of their service in the armed forces?",
"check_answer_label":"Has anyone in the household been seriously injured or ill as a result of their service in the armed forces?",
@ -153,7 +147,7 @@
},
},
"medical_conditions":{
"medical_conditions":{
"questions":{
"questions":{
"medical_conditions":{
"illness":{
"header":"Does anyone in the household have any of the following that they expect to last for 12 months or more:<ul><li>Physical Condition</li><li>Mental Health Condition</li><li>Other Illness</li></ul>",
"header":"Does anyone in the household have any of the following that they expect to last for 12 months or more:<ul><li>Physical Condition</li><li>Mental Health Condition</li><li>Other Illness</li></ul>",
"type":"radio",
"type":"radio",
"check_answer_label":"Physical, mental health or illness in the household",
"check_answer_label":"Physical, mental health or illness in the household",
it"validate that persons aged under 16 must be a child (economically speaking)"do
it"validate that persons aged under 16 must be a child (economically speaking)"do
expect{CaseLog.create!(person_2_age:15,person_2_economic_status:"Full-time - 30 hours or more")}.toraise_error(ActiveRecord::RecordInvalid)
expect{CaseLog.create!(age2:15,ecstat2:"Full-time - 30 hours or more")}.toraise_error(ActiveRecord::RecordInvalid)
end
end
it"validate that persons aged between 16 and 19 that are a child must be a full time student or economic status refused"do
it"validate that persons aged between 16 and 19 that are a child must be a full time student or economic status refused"do
expect{CaseLog.create!(person_2_age:17,person_2_relationship:"Child - includes young adult and grown-up",person_2_economic_status:"Full-time - 30 hours or more")}.toraise_error(ActiveRecord::RecordInvalid)
expect{CaseLog.create!(age2:17,relat2:"Child - includes young adult and grown-up",ecstat2:"Full-time - 30 hours or more")}.toraise_error(ActiveRecord::RecordInvalid)
end
end
it"validate that persons aged under 16 must be a child relationship"do
it"validate that persons aged under 16 must be a child relationship"do
expect(json_response["errors"]).tomatch_array([["property_number_of_times_relet",["Property number of times relet must be between 0 and 20"]],["person_1_age",["Tenant age must be an integer between 16 and 120"]]])
expect(json_response["errors"]).tomatch_array([["offered",["Property number of times relet must be between 0 and 20"]],["age1",["Tenant age must be an integer between 16 and 120"]]])
end
end
end
end
@ -157,7 +157,7 @@ RSpec.describe CaseLogsController, type: :request do