Browse Source

Merge branch 'main' into CLDC-1433-csv-output-symbols-correctly

pull/843/head
natdeanlewissoftwire 3 years ago
parent
commit
6780b93bc4
  1. 37
      app/components/check_answers_summary_list_card_component.html.erb
  2. 18
      app/components/check_answers_summary_list_card_component.rb
  3. 4
      app/helpers/check_answers_helper.rb
  4. 3
      app/models/form/question.rb
  5. 4
      app/models/validations/date_validations.rb
  6. 11
      app/models/validations/soft_validations.rb
  7. 4
      app/services/imports/case_logs_import_service.rb
  8. 14
      app/views/form/check_answers.html.erb
  9. 378
      config/forms/2021_2022.json
  10. 400
      config/forms/2022_2023.json
  11. 6
      config/locales/en.yml
  12. 5
      db/migrate/20220808090330_add_major_repairs_date_value_check.rb
  13. 5
      db/migrate/20220808093035_add_void_date_value_check.rb
  14. 2
      db/schema.rb
  15. 27
      spec/components/check_answers_summary_list_card_component_spec.rb
  16. 2
      spec/factories/case_log.rb
  17. 13
      spec/features/form/check_answers_page_spec.rb
  18. 4
      spec/fixtures/files/case_logs_download.csv
  19. 4
      spec/fixtures/files/case_logs_download_non_support.csv
  20. 33
      spec/fixtures/forms/2021_2022.json
  21. 4
      spec/models/form/subsection_spec.rb
  22. 2
      spec/models/form_handler_spec.rb
  23. 2
      spec/models/form_spec.rb
  24. 10
      spec/models/validations/date_validations_spec.rb
  25. 32
      spec/models/validations/soft_validations_spec.rb

37
app/components/check_answers_summary_list_card_component.html.erb

@ -0,0 +1,37 @@
<div class="x-govuk-summary-card govuk-!-margin-bottom-6">
<% if applicable_questions.first.check_answers_card_number != 0 %>
<div class="x-govuk-summary-card__header">
<% if applicable_questions.first.check_answers_card_number == 1 %>
<h3 class="x-govuk-summary-card__title">Lead tenant</h3>
<% end %>
<% if applicable_questions.first.check_answers_card_number > 1 %>
<h3 class="x-govuk-summary-card__title">Person <%= applicable_questions.first.check_answers_card_number %></h3>
<% end %>
</div>
<% end %>
<div class="x-govuk-summary-card__body">
<%= govuk_summary_list do |summary_list| %>
<% applicable_questions.each do |question| %>
<% summary_list.row do |row| %>
<% row.key { question.check_answer_label.to_s.presence || question.header.to_s } %>
<% row.value do %>
<span class="govuk-!-margin-right-4"><%= get_answer_label(question) %></span>
<% extra_value = question.get_extra_check_answer_value(case_log) %>
<% if extra_value %>
<span class="govuk-!-font-weight-regular app-!-colour-muted"><%= extra_value %></span>
<% end %>
<br>
<% question.get_inferred_answers(case_log).each do |inferred_answer| %>
<span class="govuk-!-font-weight-regular app-!-colour-muted"><%= inferred_answer %></span>
<% end %>
<% end %>
<% row.action(
text: question.action_text(case_log),
href: question.action_href(case_log, question.page.id),
visually_hidden_text: question.check_answer_label.to_s.downcase,
) %>
<% end %>
<% end %>
<% end %>
</div>
</div>

18
app/components/check_answers_summary_list_card_component.rb

@ -0,0 +1,18 @@
class CheckAnswersSummaryListCardComponent < ViewComponent::Base
attr_reader :questions, :case_log, :user
def initialize(questions:, case_log:, user:)
@questions = questions
@case_log = case_log
@user = user
super
end
def applicable_questions
questions.reject { |q| q.hidden_in_check_answers?(case_log, user) }
end
def get_answer_label(question)
question.answer_label(case_log).presence || "<span class=\"app-!-colour-muted\">You didn’t answer this question</span>".html_safe
end
end

4
app/helpers/check_answers_helper.rb

@ -24,6 +24,10 @@ module CheckAnswersHelper
end
end
def any_questions_have_summary_card_number?(subsection, case_log)
subsection.applicable_questions(case_log).map(&:check_answers_card_number).compact.length.positive?
end
private
def answered_questions_count(subsection, case_log, current_user)

3
app/models/form/question.rb

@ -3,7 +3,7 @@ class Form::Question
:type, :min, :max, :step, :width, :fields_to_add, :result_field,
:conditional_for, :readonly, :answer_options, :page, :check_answer_label,
:inferred_answers, :hidden_in_check_answers, :inferred_check_answers_value,
:guidance_partial, :prefix, :suffix, :requires_js, :fields_added, :derived
:guidance_partial, :prefix, :suffix, :requires_js, :fields_added, :derived, :check_answers_card_number
module GuidancePosition
TOP = 1
@ -37,6 +37,7 @@ class Form::Question
@suffix = hsh["suffix"]
@requires_js = hsh["requires_js"]
@fields_added = hsh["fields_added"]
@check_answers_card_number = hsh["check_answers_card_number"]
end
end

4
app/models/validations/date_validations.rb

@ -9,8 +9,8 @@ module Validations::DateValidations
record.errors.add :mrcdate, I18n.t("validations.property.mrcdate.not_first_let")
end
if record["mrcdate"].present? && record["startdate"].present? && record["startdate"].to_date - record["mrcdate"].to_date > 730
record.errors.add :mrcdate, I18n.t("validations.property.mrcdate.730_days_before_tenancy_start")
if record["mrcdate"].present? && record["startdate"].present? && record["startdate"].to_date - record["mrcdate"].to_date > 3650
record.errors.add :mrcdate, I18n.t("validations.property.mrcdate.ten_years_before_tenancy_start")
end
end

11
app/models/validations/soft_validations.rb

@ -62,6 +62,17 @@ module Validations::SoftValidations
end
end
TWO_YEARS_IN_DAYS = 730
TEN_YEARS_IN_DAYS = 3650
def major_repairs_date_in_soft_range?
mrcdate.present? && startdate.present? && mrcdate.between?(startdate.to_date - TEN_YEARS_IN_DAYS, startdate.to_date - TWO_YEARS_IN_DAYS)
end
def voiddate_in_soft_range?
voiddate.present? && startdate.present? && voiddate.between?(startdate.to_date - TEN_YEARS_IN_DAYS, startdate.to_date - TWO_YEARS_IN_DAYS)
end
private
def details_known_or_lead_tenant?(tenant_number)

4
app/services/imports/case_logs_import_service.rb

@ -209,6 +209,8 @@ module Imports
# Soft validations can become required answers, set them to yes by default
attributes["pregnancy_value_check"] = 0
attributes["major_repairs_date_value_check"] = 0
attributes["void_date_value_check"] = 0
attributes["retirement_value_check"] = 0
attributes["rent_value_check"] = 0
attributes["net_income_value_check"] = 0
@ -273,7 +275,7 @@ module Imports
end
def fields_not_present_in_softwire_data
%w[majorrepairs illness_type_0 tshortfall_known pregnancy_value_check retirement_value_check rent_value_check net_income_value_check]
%w[majorrepairs illness_type_0 tshortfall_known pregnancy_value_check retirement_value_check rent_value_check net_income_value_check major_repairs_date_value_check void_date_value_check]
end
def check_status_completed(case_log, previous_status)

14
app/views/form/check_answers.html.erb

@ -17,10 +17,16 @@
<% end %>
<%= display_answered_questions_summary(subsection, @case_log, current_user) %>
<%= render partial: "form/check_answers_summary_list", locals: {
subsection:,
case_log: @case_log,
} %>
<% if any_questions_have_summary_card_number?(subsection, @case_log) %>
<% subsection.applicable_questions(@case_log).group_by(&:check_answers_card_number).values.each do |question_group| %>
<%= render CheckAnswersSummaryListCardComponent.new(questions: question_group, case_log: @case_log, user: current_user) %>
<% end %>
<% else %>
<%= render partial: "form/check_answers_summary_list", locals: {
subsection:,
case_log: @case_log,
} %>
<% end %>
<%= form_with model: @case_log, method: "get" do |f| %>
<%= f.govuk_submit "Save and return to log" do %>

378
config/forms/2021_2022.json

@ -771,6 +771,38 @@
}
]
},
"void_date_value_check": {
"depends_on": [{ "voiddate_in_soft_range?": true }],
"title_text": {
"translation": "soft_validations.void_date.title_text"
},
"informative_text": {},
"questions": {
"void_date_value_check": {
"check_answer_label": "Void date confirmation",
"hidden_in_check_answers": {
"depends_on": [
{
"void_date_value_check": 0
},
{
"void_date_value_check": 1
}
]
},
"header": "Are you sure the time between these dates is correct?",
"type": "interruption_screen",
"answer_options": {
"0": {
"value": "Yes"
},
"1": {
"value": "No"
}
}
}
}
},
"new_build_handover_date": {
"header": "",
"description": "",
@ -867,6 +899,38 @@
"rsnvac": 19
}
]
},
"property_major_repairs_value_check": {
"depends_on": [{ "major_repairs_date_in_soft_range?": true }],
"title_text": {
"translation": "soft_validations.major_repairs_date.title_text"
},
"informative_text": {},
"questions": {
"major_repairs_date_value_check": {
"check_answer_label": "Major repairs date confirmation",
"hidden_in_check_answers": {
"depends_on": [
{
"major_repairs_date_value_check": 0
},
{
"major_repairs_date_value_check": 1
}
]
},
"header": "Are you sure the time between these dates is correct?",
"type": "interruption_screen",
"answer_options": {
"0": {
"value": "Yes"
},
"1": {
"value": "No"
}
}
}
}
}
}
},
@ -1063,6 +1127,7 @@
"header": "",
"guidance_partial": "privacy_notice",
"check_answer_label": "Tenant has seen the privacy notice",
"check_answers_card_number": 0,
"type": "checkbox",
"answer_options": {
"declaration": {
@ -1077,6 +1142,7 @@
"description": "",
"questions": {
"hhmemb": {
"check_answers_card_number": 0,
"check_answer_label": "Number of household members",
"header": "How many people live in the household for this letting?",
"hint_text": "You can provide details for a maximum of 8 people.",
@ -1176,6 +1242,7 @@
"description": "",
"questions": {
"age1_known": {
"check_answers_card_number": 1,
"header": "Do you know the lead tenant’s age?",
"hint_text": "The ’lead’ or ’main’ tenant is the person in the household who does the most paid work. If several people do the same paid work, the lead tenant is whoever is the oldest.",
"type": "radio",
@ -1202,6 +1269,7 @@
}
},
"age1": {
"check_answers_card_number": 1,
"header": "Age",
"check_answer_label": "Lead tenant’s age",
"type": "numeric",
@ -1307,6 +1375,7 @@
"questions": {
"sex1": {
"check_answer_label": "Lead tenant’s gender identity",
"check_answers_card_number": 1,
"header": "Which of these best describes the lead tenant’s gender identity?",
"hint_text": "The lead tenant is the person in the household who does the most paid work. If several people do the same paid work, the lead tenant is whoever is the oldest.",
"type": "radio",
@ -1419,6 +1488,7 @@
"questions": {
"ethnic_group": {
"check_answer_label": "Lead tenant’s ethnic group",
"check_answers_card_number": 1,
"header": "What is the lead tenant’s ethnic group?",
"hint_text": "The lead tenant is the person in the household who does the most paid work. If several people do the same paid work, the lead tenant is whoever is the oldest.",
"type": "radio",
@ -1454,6 +1524,7 @@
"description": "",
"questions": {
"ethnic": {
"check_answers_card_number": 1,
"check_answer_label": "Lead tenant’s ethnic background",
"header": "Which of the following best describes the lead tenant’s Arab background?",
"hint_text": "The lead tenant is the person in the household who does the most paid work. If several people do the same paid work, the lead tenant is whoever is the oldest.",
@ -1475,6 +1546,7 @@
"description": "",
"questions": {
"ethnic": {
"check_answers_card_number": 1,
"check_answer_label": "Lead tenant’s ethnic background",
"header": "Which of the following best describes the lead tenant’s Asian or Asian British background?",
"hint_text": "The lead tenant is the person in the household who does the most paid work. If several people do the same paid work, the lead tenant is whoever is the oldest.",
@ -1505,6 +1577,7 @@
"description": "",
"questions": {
"ethnic": {
"check_answers_card_number": 1,
"check_answer_label": "Lead tenant’s ethnic background",
"header": "Which of the following best describes the lead tenant’s Black, African, Caribbean or Black British background?",
"hint_text": "The lead tenant is the person in the household who does the most paid work. If several people do the same paid work, the lead tenant is whoever is the oldest.",
@ -1529,6 +1602,7 @@
"description": "",
"questions": {
"ethnic": {
"check_answers_card_number": 1,
"check_answer_label": "Lead tenant’s ethnic background",
"header": "Which of the following best describes the lead tenant’s Mixed or Multiple ethnic groups background?",
"hint_text": "The lead tenant is the person in the household who does the most paid work. If several people do the same paid work, the lead tenant is whoever is the oldest.",
@ -1556,6 +1630,7 @@
"description": "",
"questions": {
"ethnic": {
"check_answers_card_number": 1,
"check_answer_label": "Lead tenant’s ethnic background",
"header": "Which of the following best describes the lead tenant’s White background?",
"hint_text": "The lead tenant is the person in the household who does the most paid work. If several people do the same paid work, the lead tenant is whoever is the oldest.",
@ -1583,6 +1658,7 @@
"description": "",
"questions": {
"national": {
"check_answers_card_number": 1,
"check_answer_label": "Lead tenant’s nationality",
"header": "What is the lead tenant’s nationality?",
"hint_text": "The lead tenant is the person in the household who does the most paid work. If several people do the same paid work, the lead tenant is whoever is the oldest.",
@ -1652,6 +1728,7 @@
"ecstat1": {
"check_answer_label": "Lead tenant’s working situation",
"header": "Which of these best describes the lead tenant’s working situation?",
"check_answers_card_number": 1,
"hint_text": "The lead tenant is the person in the household who does the most paid work. If several people do the same paid work, the lead tenant is whoever is the oldest.",
"type": "radio",
"answer_options": {
@ -1722,8 +1799,17 @@
},
"questions": {
"retirement_value_check": {
"check_answer_label": "Retirement age soft validation",
"hidden_in_check_answers": true,
"check_answer_label": "Retirement confirmation",
"hidden_in_check_answers": {
"depends_on": [
{
"retirement_value_check": 0
},
{
"retirement_value_check": 1
}
]
},
"header": "Are you sure this person is retired?",
"type": "interruption_screen",
"answer_options": {
@ -1768,8 +1854,17 @@
},
"questions": {
"retirement_value_check": {
"check_answer_label": "Retirement age soft validation",
"hidden_in_check_answers": true,
"check_answer_label": "Retirement confirmation",
"hidden_in_check_answers": {
"depends_on": [
{
"retirement_value_check": 0
},
{
"retirement_value_check": 1
}
]
},
"header": "Are you sure this person isn’t retired?",
"type": "interruption_screen",
"answer_options": {
@ -1789,6 +1884,7 @@
"questions": {
"details_known_2": {
"check_answer_label": "Details known for person 2",
"check_answers_card_number": 2,
"header": "Do you know details for person 2?",
"hint_text": "You must provide details for everyone in the household if you know them.",
"type": "radio",
@ -1832,6 +1928,7 @@
"questions": {
"relat2": {
"check_answer_label": "Person 2’s relationship to the lead tenant",
"check_answers_card_number": 2,
"header": "What is person 2’s relationship to the lead tenant?",
"hint_text": "",
"type": "radio",
@ -1867,6 +1964,7 @@
"questions": {
"age2_known": {
"header": "Do you know person 2’s age?",
"check_answers_card_number": 2,
"hint_text": "",
"type": "radio",
"answer_options": {
@ -1894,6 +1992,7 @@
"age2": {
"header": "Age",
"check_answer_label": "Person 2’s age",
"check_answers_card_number": 2,
"type": "numeric",
"min": 0,
"max": 120,
@ -2005,6 +2104,7 @@
"sex2": {
"check_answer_label": "Person 2’s gender identity",
"header": "Which of these best describes person 2’s gender identity?",
"check_answers_card_number": 2,
"hint_text": "",
"type": "radio",
"answer_options": {
@ -2126,6 +2226,7 @@
"questions": {
"ecstat2": {
"check_answer_label": "Person 2’s working situation",
"check_answers_card_number": 2,
"header": "Which of these best describes person 2’s working situation?",
"hint_text": "",
"type": "radio",
@ -2216,8 +2317,17 @@
},
"questions": {
"retirement_value_check": {
"check_answer_label": "Retirement age soft validation",
"hidden_in_check_answers": true,
"check_answer_label": "Retirement confirmation",
"hidden_in_check_answers": {
"depends_on": [
{
"retirement_value_check": 0
},
{
"retirement_value_check": 1
}
]
},
"header": "Are you sure this person is retired?",
"type": "interruption_screen",
"answer_options": {
@ -2262,8 +2372,17 @@
},
"questions": {
"retirement_value_check": {
"check_answer_label": "Retirement age soft validation",
"hidden_in_check_answers": true,
"check_answer_label": "Retirement confirmation",
"hidden_in_check_answers": {
"depends_on": [
{
"retirement_value_check": 0
},
{
"retirement_value_check": 1
}
]
},
"header": "Are you sure this person isn’t retired?",
"type": "interruption_screen",
"answer_options": {
@ -2283,6 +2402,7 @@
"questions": {
"details_known_3": {
"check_answer_label": "Details known for person 3",
"check_answers_card_number": 3,
"header": "Do you know details for person 3?",
"hint_text": "You must provide details for everyone in the household if you know them.",
"type": "radio",
@ -2323,6 +2443,7 @@
"questions": {
"relat3": {
"check_answer_label": "Person 3’s relationship to the lead tenant",
"check_answers_card_number": 3,
"header": "What is person 3’s relationship to the lead tenant?",
"hint_text": "",
"type": "radio",
@ -2358,6 +2479,7 @@
"questions": {
"age3_known": {
"header": "Do you know person 3’s age?",
"check_answers_card_number": 3,
"hint_text": "",
"type": "radio",
"answer_options": {
@ -2385,6 +2507,7 @@
"age3": {
"header": "Age",
"check_answer_label": "Person 3’s age",
"check_answers_card_number": 3,
"type": "numeric",
"min": 0,
"max": 120,
@ -2495,6 +2618,7 @@
"questions": {
"sex3": {
"check_answer_label": "Person 3’s gender identity",
"check_answers_card_number": 3,
"header": "Which of these best describes person 3’s gender identity?",
"hint_text": "",
"type": "radio",
@ -2617,6 +2741,7 @@
"questions": {
"ecstat3": {
"check_answer_label": "Person 3’s working situation",
"check_answers_card_number": 3,
"header": "Which of these best describes person 3’s working situation?",
"hint_text": "",
"type": "radio",
@ -2707,8 +2832,17 @@
},
"questions": {
"retirement_value_check": {
"check_answer_label": "Retirement age soft validation",
"hidden_in_check_answers": true,
"check_answer_label": "Retirement confirmation",
"hidden_in_check_answers": {
"depends_on": [
{
"retirement_value_check": 0
},
{
"retirement_value_check": 1
}
]
},
"header": "Are you sure this person is retired?",
"type": "interruption_screen",
"answer_options": {
@ -2753,8 +2887,17 @@
},
"questions": {
"retirement_value_check": {
"check_answer_label": "Retirement age soft validation",
"hidden_in_check_answers": true,
"check_answer_label": "Retirement confirmation",
"hidden_in_check_answers": {
"depends_on": [
{
"retirement_value_check": 0
},
{
"retirement_value_check": 1
}
]
},
"header": "Are you sure this person isn’t retired?",
"type": "interruption_screen",
"answer_options": {
@ -2774,6 +2917,7 @@
"questions": {
"details_known_4": {
"check_answer_label": "Details known for person 4",
"check_answers_card_number": 4,
"header": "Do you know details for person 4?",
"hint_text": "You must provide details for everyone in the household if you know them.",
"type": "radio",
@ -2811,6 +2955,7 @@
"questions": {
"relat4": {
"check_answer_label": "Person 4’s relationship to the lead tenant",
"check_answers_card_number": 4,
"header": "What is person 4’s relationship to the lead tenant?",
"hint_text": "",
"type": "radio",
@ -2846,6 +2991,7 @@
"questions": {
"age4_known": {
"header": "Do you know person 4’s age?",
"check_answers_card_number": 4,
"hint_text": "",
"type": "radio",
"answer_options": {
@ -2873,6 +3019,7 @@
"age4": {
"header": "Age",
"check_answer_label": "Person 4’s age",
"check_answers_card_number": 4,
"type": "numeric",
"min": 0,
"max": 120,
@ -2983,6 +3130,7 @@
"questions": {
"sex4": {
"check_answer_label": "Person 4’s gender identity",
"check_answers_card_number": 4,
"header": "Which of these best describes person 4’s gender identity?",
"hint_text": "",
"type": "radio",
@ -3105,6 +3253,7 @@
"questions": {
"ecstat4": {
"check_answer_label": "Person 4’s working situation",
"check_answers_card_number": 4,
"header": "Which of these best describes person 4’s working situation?",
"hint_text": "",
"type": "radio",
@ -3195,8 +3344,17 @@
},
"questions": {
"retirement_value_check": {
"check_answer_label": "Retirement age soft validation",
"hidden_in_check_answers": true,
"check_answer_label": "Retirement confirmation",
"hidden_in_check_answers": {
"depends_on": [
{
"retirement_value_check": 0
},
{
"retirement_value_check": 1
}
]
},
"header": "Are you sure this person is retired?",
"type": "interruption_screen",
"answer_options": {
@ -3241,8 +3399,17 @@
},
"questions": {
"retirement_value_check": {
"check_answer_label": "Retirement age soft validation",
"hidden_in_check_answers": true,
"check_answer_label": "Retirement confirmation",
"hidden_in_check_answers": {
"depends_on": [
{
"retirement_value_check": 0
},
{
"retirement_value_check": 1
}
]
},
"header": "Are you sure this person isn’t retired?",
"type": "interruption_screen",
"answer_options": {
@ -3262,6 +3429,7 @@
"questions": {
"details_known_5": {
"check_answer_label": "Details known for person 5",
"check_answers_card_number": 5,
"header": "Do you know details for person 5?",
"hint_text": "You must provide details for everyone in the household if you know them.",
"type": "radio",
@ -3296,6 +3464,7 @@
"questions": {
"relat5": {
"check_answer_label": "Person 5’s relationship to the lead tenant",
"check_answers_card_number": 5,
"header": "What is person 5’s relationship to the lead tenant?",
"hint_text": "",
"type": "radio",
@ -3331,6 +3500,7 @@
"questions": {
"age5_known": {
"header": "Do you know person 5’s age?",
"check_answers_card_number": 5,
"hint_text": "",
"type": "radio",
"answer_options": {
@ -3358,6 +3528,7 @@
"age5": {
"header": "Age",
"check_answer_label": "Person 5’s age",
"check_answers_card_number": 5,
"type": "numeric",
"min": 0,
"max": 120,
@ -3468,6 +3639,7 @@
"questions": {
"sex5": {
"check_answer_label": "Person 5’s gender identity",
"check_answers_card_number": 5,
"header": "Which of these best describes person 5’s gender identity?",
"hint_text": "",
"type": "radio",
@ -3590,6 +3762,7 @@
"questions": {
"ecstat5": {
"check_answer_label": "Person 5’s working situation",
"check_answers_card_number": 5,
"header": "Which of these best describes person 5’s working situation?",
"hint_text": "",
"type": "radio",
@ -3680,8 +3853,17 @@
},
"questions": {
"retirement_value_check": {
"check_answer_label": "Retirement age soft validation",
"hidden_in_check_answers": true,
"check_answer_label": "Retirement confirmation",
"hidden_in_check_answers": {
"depends_on": [
{
"retirement_value_check": 0
},
{
"retirement_value_check": 1
}
]
},
"header": "Are you sure this person is retired?",
"type": "interruption_screen",
"answer_options": {
@ -3726,8 +3908,17 @@
},
"questions": {
"retirement_value_check": {
"check_answer_label": "Retirement age soft validation",
"hidden_in_check_answers": true,
"check_answer_label": "Retirement confirmation",
"hidden_in_check_answers": {
"depends_on": [
{
"retirement_value_check": 0
},
{
"retirement_value_check": 1
}
]
},
"header": "Are you sure this person isn’t retired?",
"type": "interruption_screen",
"answer_options": {
@ -3747,6 +3938,7 @@
"questions": {
"details_known_6": {
"check_answer_label": "Details known for person 6",
"check_answers_card_number": 6,
"header": "Do you know details for person 6?",
"hint_text": "You must provide details for everyone in the household if you know them.",
"type": "radio",
@ -3778,6 +3970,7 @@
"questions": {
"relat6": {
"check_answer_label": "Person 6’s relationship to the lead tenant",
"check_answers_card_number": 6,
"header": "What is person 6’s relationship to the lead tenant?",
"hint_text": "",
"type": "radio",
@ -3813,6 +4006,7 @@
"questions": {
"age6_known": {
"header": "Do you know person 6’s age?",
"check_answers_card_number": 6,
"hint_text": "",
"type": "radio",
"answer_options": {
@ -3840,6 +4034,7 @@
"age6": {
"header": "Age",
"check_answer_label": "Person 6’s age",
"check_answers_card_number": 6,
"type": "numeric",
"min": 0,
"max": 120,
@ -3950,6 +4145,7 @@
"questions": {
"sex6": {
"check_answer_label": "Person 6’s gender identity",
"check_answers_card_number": 6,
"header": "Which of these best describes person 6’s gender identity?",
"hint_text": "",
"type": "radio",
@ -4072,6 +4268,7 @@
"questions": {
"ecstat6": {
"check_answer_label": "Person 6’s working situation",
"check_answers_card_number": 6,
"header": "Which of these best describes person 6’s working situation?",
"hint_text": "",
"type": "radio",
@ -4162,8 +4359,17 @@
},
"questions": {
"retirement_value_check": {
"check_answer_label": "Retirement age soft validation",
"hidden_in_check_answers": true,
"check_answer_label": "Retirement confirmation",
"hidden_in_check_answers": {
"depends_on": [
{
"retirement_value_check": 0
},
{
"retirement_value_check": 1
}
]
},
"header": "Are you sure this person is retired?",
"type": "interruption_screen",
"answer_options": {
@ -4208,8 +4414,17 @@
},
"questions": {
"retirement_value_check": {
"check_answer_label": "Retirement age soft validation",
"hidden_in_check_answers": true,
"check_answer_label": "Retirement confirmation",
"hidden_in_check_answers": {
"depends_on": [
{
"retirement_value_check": 0
},
{
"retirement_value_check": 1
}
]
},
"header": "Are you sure this person isn’t retired?",
"type": "interruption_screen",
"answer_options": {
@ -4229,6 +4444,7 @@
"questions": {
"details_known_7": {
"check_answer_label": "Details known for person 7",
"check_answers_card_number": 7,
"header": "Do you know details for person 7?",
"hint_text": "You must provide details for everyone in the household if you know them.",
"type": "radio",
@ -4257,6 +4473,7 @@
"questions": {
"relat7": {
"check_answer_label": "Person 7’s relationship to the lead tenant",
"check_answers_card_number": 7,
"header": "What is person 7’s relationship to the lead tenant?",
"hint_text": "",
"type": "radio",
@ -4292,6 +4509,7 @@
"questions": {
"age7_known": {
"header": "Do you know person 7’s age?",
"check_answers_card_number": 7,
"hint_text": "",
"type": "radio",
"answer_options": {
@ -4319,6 +4537,7 @@
"age7": {
"header": "Age",
"check_answer_label": "Person 7’s age",
"check_answers_card_number": 7,
"type": "numeric",
"min": 0,
"max": 120,
@ -4429,6 +4648,7 @@
"questions": {
"sex7": {
"check_answer_label": "Person 7’s gender identity",
"check_answers_card_number": 7,
"header": "Which of these best describes person 7’s gender identity?",
"hint_text": "",
"type": "radio",
@ -4551,6 +4771,7 @@
"questions": {
"ecstat7": {
"check_answer_label": "Person 7’s working situation",
"check_answers_card_number": 7,
"header": "Which of these best describes person 7’s working situation?",
"hint_text": "",
"type": "radio",
@ -4641,8 +4862,17 @@
},
"questions": {
"retirement_value_check": {
"check_answer_label": "Retirement age soft validation",
"hidden_in_check_answers": true,
"check_answer_label": "Retirement confirmation",
"hidden_in_check_answers": {
"depends_on": [
{
"retirement_value_check": 0
},
{
"retirement_value_check": 1
}
]
},
"header": "Are you sure this person is retired?",
"type": "interruption_screen",
"answer_options": {
@ -4687,8 +4917,17 @@
},
"questions": {
"retirement_value_check": {
"check_answer_label": "Retirement age soft validation",
"hidden_in_check_answers": true,
"check_answer_label": "Retirement confirmation",
"hidden_in_check_answers": {
"depends_on": [
{
"retirement_value_check": 0
},
{
"retirement_value_check": 1
}
]
},
"header": "Are you sure this person isn’t retired?",
"type": "interruption_screen",
"answer_options": {
@ -4708,6 +4947,7 @@
"questions": {
"details_known_8": {
"check_answer_label": "Details known for person 8",
"check_answers_card_number": 8,
"header": "Do you know details for person 8?",
"hint_text": "You must provide details for everyone in the household if you know them.",
"type": "radio",
@ -4733,6 +4973,7 @@
"questions": {
"relat8": {
"check_answer_label": "Person 8’s relationship to the lead tenant",
"check_answers_card_number": 8,
"header": "What is person 8’s relationship to the lead tenant?",
"hint_text": "",
"type": "radio",
@ -4768,6 +5009,7 @@
"questions": {
"age8_known": {
"header": "Do you know person 8’s age?",
"check_answers_card_number": 8,
"hint_text": "",
"type": "radio",
"answer_options": {
@ -4795,6 +5037,7 @@
"age8": {
"header": "Age",
"check_answer_label": "Person 8’s age",
"check_answers_card_number": 8,
"type": "numeric",
"min": 0,
"max": 120,
@ -4905,6 +5148,7 @@
"questions": {
"sex8": {
"check_answer_label": "Person 8’s gender identity",
"check_answers_card_number": 8,
"header": "Which of these best describes person 8’s gender identity?",
"hint_text": "",
"type": "radio",
@ -5027,6 +5271,7 @@
"questions": {
"ecstat8": {
"check_answer_label": "Person 8’s working situation",
"check_answers_card_number": 8,
"header": "Which of these best describes person 8’s working situation?",
"hint_text": "",
"type": "radio",
@ -5117,8 +5362,17 @@
},
"questions": {
"retirement_value_check": {
"check_answer_label": "Retirement age soft validation",
"hidden_in_check_answers": true,
"check_answer_label": "Retirement confirmation",
"hidden_in_check_answers": {
"depends_on": [
{
"retirement_value_check": 0
},
{
"retirement_value_check": 1
}
]
},
"header": "Are you sure this person is retired?",
"type": "interruption_screen",
"answer_options": {
@ -5163,8 +5417,17 @@
},
"questions": {
"retirement_value_check": {
"check_answer_label": "Retirement age soft validation",
"hidden_in_check_answers": true,
"check_answer_label": "Retirement confirmation",
"hidden_in_check_answers": {
"depends_on": [
{
"retirement_value_check": 0
},
{
"retirement_value_check": 1
}
]
},
"header": "Are you sure this person isn’t retired?",
"type": "interruption_screen",
"answer_options": {
@ -5381,8 +5644,16 @@
},
"questions": {
"pregnancy_value_check": {
"check_answer_label": "Pregnancy soft validation",
"hidden_in_check_answers": true,
"check_answer_label": "Pregnancy confirmation",
"hidden_in_check_answers": {
"depends_on": [{
"pregnancy_value_check": 0
},
{
"pregnancy_value_check": 1
}
]
},
"header": "Are you sure this is correct?",
"type": "interruption_screen",
"answer_options": {
@ -6875,8 +7146,17 @@
},
"questions": {
"net_income_value_check": {
"check_answer_label": "Net income soft validation",
"hidden_in_check_answers": true,
"check_answer_label": "Net income confirmation",
"hidden_in_check_answers": {
"depends_on": [
{
"net_income_value_check": 0
},
{
"net_income_value_check": 1
}
]
},
"header": "Are you sure this is correct?",
"type": "interruption_screen",
"answer_options": {
@ -7779,8 +8059,17 @@
},
"questions": {
"rent_value_check": {
"check_answer_label": "Rent soft validation",
"hidden_in_check_answers": true,
"check_answer_label": "Total rent confirmation",
"hidden_in_check_answers": {
"depends_on": [
{
"rent_value_check": 0
},
{
"rent_value_check": 1
}
]
},
"header": "Are you sure this is correct?",
"type": "interruption_screen",
"answer_options": {
@ -7823,8 +8112,17 @@
},
"questions": {
"rent_value_check": {
"check_answer_label": "Rent soft validation",
"hidden_in_check_answers": true,
"check_answer_label": "Total rent confirmation",
"hidden_in_check_answers": {
"depends_on": [
{
"rent_value_check": 0
},
{
"rent_value_check": 1
}
]
},
"header": "Are you sure this is correct?",
"type": "interruption_screen",
"answer_options": {

400
config/forms/2022_2023.json

@ -771,6 +771,38 @@
}
]
},
"void_date_value_check": {
"depends_on": [{ "voiddate_in_soft_range?": true }],
"title_text": {
"translation": "soft_validations.void_date.title_text"
},
"informative_text": {},
"questions": {
"void_date_value_check": {
"check_answer_label": "Void date confirmation",
"hidden_in_check_answers": {
"depends_on": [
{
"void_date_value_check": 0
},
{
"void_date_value_check": 1
}
]
},
"header": "Are you sure the time between these dates is correct?",
"type": "interruption_screen",
"answer_options": {
"0": {
"value": "Yes"
},
"1": {
"value": "No"
}
}
}
}
},
"new_build_handover_date": {
"header": "",
"description": "",
@ -867,6 +899,38 @@
"rsnvac": 19
}
]
},
"property_major_repairs_value_check": {
"depends_on": [{ "major_repairs_date_in_soft_range?": true }],
"title_text": {
"translation": "soft_validations.major_repairs_date.title_text"
},
"informative_text": {},
"questions": {
"major_repairs_date_value_check": {
"check_answer_label": "Major repairs date confirmation",
"hidden_in_check_answers": {
"depends_on": [
{
"major_repairs_date_value_check": 0
},
{
"major_repairs_date_value_check": 1
}
]
},
"header": "Are you sure the time between these dates is correct?",
"type": "interruption_screen",
"answer_options": {
"0": {
"value": "Yes"
},
"1": {
"value": "No"
}
}
}
}
}
}
},
@ -1098,6 +1162,7 @@
"header": "",
"guidance_partial": "privacy_notice",
"check_answer_label": "Tenant has seen the privacy notice",
"check_answers_card_number": 0,
"type": "checkbox",
"answer_options": {
"declaration": {
@ -1112,6 +1177,7 @@
"description": "",
"questions": {
"hhmemb": {
"check_answers_card_number": 0,
"check_answer_label": "Number of household members",
"header": "How many people live in the household for this letting?",
"hint_text": "You can provide details for a maximum of 8 people.",
@ -1164,7 +1230,11 @@
}
},
"females_in_soft_age_range_in_pregnant_household_lead_hhmemb_value_check": {
"depends_on": [{ "female_in_pregnant_household_in_soft_validation_range?": true }],
"depends_on": [
{
"female_in_pregnant_household_in_soft_validation_range?": true
}
],
"title_text": {
"translation": "soft_validations.pregnancy.title",
"arguments": [
@ -1207,6 +1277,7 @@
"description": "",
"questions": {
"age1_known": {
"check_answers_card_number": 1,
"header": "Do you know the lead tenant’s age?",
"hint_text": "The ’lead’ or ’main’ tenant is the person in the household who does the most paid work. If several people do the same paid work, the lead tenant is whoever is the oldest.",
"type": "radio",
@ -1233,6 +1304,7 @@
}
},
"age1": {
"check_answers_card_number": 1,
"header": "Age",
"check_answer_label": "Lead tenant’s age",
"type": "numeric",
@ -1290,7 +1362,11 @@
}
},
"females_in_soft_age_range_in_pregnant_household_lead_age_value_check": {
"depends_on": [{ "female_in_pregnant_household_in_soft_validation_range?": true }],
"depends_on": [
{
"female_in_pregnant_household_in_soft_validation_range?": true
}
],
"title_text": {
"translation": "soft_validations.pregnancy.title",
"arguments": [
@ -1334,6 +1410,7 @@
"questions": {
"sex1": {
"check_answer_label": "Lead tenant’s gender identity",
"check_answers_card_number": 1,
"header": "Which of these best describes the lead tenant’s gender identity?",
"hint_text": "The lead tenant is the person in the household who does the most paid work. If several people do the same paid work, the lead tenant is whoever is the oldest.",
"type": "radio",
@ -1398,7 +1475,11 @@
}
},
"females_in_soft_age_range_in_pregnant_household_lead_value_check": {
"depends_on": [{ "female_in_pregnant_household_in_soft_validation_range?": true }],
"depends_on": [
{
"female_in_pregnant_household_in_soft_validation_range?": true
}
],
"title_text": {
"translation": "soft_validations.pregnancy.title",
"arguments": [
@ -1442,6 +1523,7 @@
"questions": {
"ethnic_group": {
"check_answer_label": "Lead tenant’s ethnic group",
"check_answers_card_number": 1,
"header": "What is the lead tenant’s ethnic group?",
"hint_text": "The lead tenant is the person in the household who does the most paid work. If several people do the same paid work, the lead tenant is whoever is the oldest.",
"type": "radio",
@ -1477,6 +1559,7 @@
"description": "",
"questions": {
"ethnic": {
"check_answers_card_number": 1,
"check_answer_label": "Lead tenant’s ethnic background",
"header": "Which of the following best describes the lead tenant’s Arab background?",
"hint_text": "The lead tenant is the person in the household who does the most paid work. If several people do the same paid work, the lead tenant is whoever is the oldest.",
@ -1498,6 +1581,7 @@
"description": "",
"questions": {
"ethnic": {
"check_answers_card_number": 1,
"check_answer_label": "Lead tenant’s ethnic background",
"header": "Which of the following best describes the lead tenant’s Asian or Asian British background?",
"hint_text": "The lead tenant is the person in the household who does the most paid work. If several people do the same paid work, the lead tenant is whoever is the oldest.",
@ -1528,6 +1612,7 @@
"description": "",
"questions": {
"ethnic": {
"check_answers_card_number": 1,
"check_answer_label": "Lead tenant’s ethnic background",
"header": "Which of the following best describes the lead tenant’s Black, African, Caribbean or Black British background?",
"hint_text": "The lead tenant is the person in the household who does the most paid work. If several people do the same paid work, the lead tenant is whoever is the oldest.",
@ -1552,6 +1637,7 @@
"description": "",
"questions": {
"ethnic": {
"check_answers_card_number": 1,
"check_answer_label": "Lead tenant’s ethnic background",
"header": "Which of the following best describes the lead tenant’s Mixed or Multiple ethnic groups background?",
"hint_text": "The lead tenant is the person in the household who does the most paid work. If several people do the same paid work, the lead tenant is whoever is the oldest.",
@ -1579,6 +1665,7 @@
"description": "",
"questions": {
"ethnic": {
"check_answers_card_number": 1,
"check_answer_label": "Lead tenant’s ethnic background",
"header": "Which of the following best describes the lead tenant’s White background?",
"hint_text": "The lead tenant is the person in the household who does the most paid work. If several people do the same paid work, the lead tenant is whoever is the oldest.",
@ -1606,6 +1693,7 @@
"description": "",
"questions": {
"national": {
"check_answers_card_number": 1,
"check_answer_label": "Lead tenant’s nationality",
"header": "What is the lead tenant’s nationality?",
"hint_text": "The lead tenant is the person in the household who does the most paid work. If several people do the same paid work, the lead tenant is whoever is the oldest.",
@ -1639,6 +1727,7 @@
"ecstat1": {
"check_answer_label": "Lead tenant’s working situation",
"header": "Which of these best describes the lead tenant’s working situation?",
"check_answers_card_number": 1,
"hint_text": "The lead tenant is the person in the household who does the most paid work. If several people do the same paid work, the lead tenant is whoever is the oldest.",
"type": "radio",
"answer_options": {
@ -1709,8 +1798,17 @@
},
"questions": {
"retirement_value_check": {
"check_answer_label": "Retirement age soft validation",
"hidden_in_check_answers": true,
"check_answer_label": "Retirement confirmation",
"hidden_in_check_answers": {
"depends_on": [
{
"retirement_value_check": 0
},
{
"retirement_value_check": 1
}
]
},
"header": "Are you sure this person is retired?",
"type": "interruption_screen",
"answer_options": {
@ -1725,7 +1823,9 @@
}
},
"lead_tenant_over_retirement_value_check": {
"depends_on": [{ "person_1_not_retired_over_soft_max_age?": true }],
"depends_on": [
{ "person_1_not_retired_over_soft_max_age?": true }
],
"title_text": {
"translation": "soft_validations.retirement.max.title",
"arguments": [
@ -1753,8 +1853,17 @@
},
"questions": {
"retirement_value_check": {
"check_answer_label": "Retirement age soft validation",
"hidden_in_check_answers": true,
"check_answer_label": "Retirement confirmation",
"hidden_in_check_answers": {
"depends_on": [
{
"retirement_value_check": 0
},
{
"retirement_value_check": 1
}
]
},
"header": "Are you sure this person isn’t retired?",
"type": "interruption_screen",
"answer_options": {
@ -1774,6 +1883,7 @@
"questions": {
"details_known_2": {
"check_answer_label": "Details known for person 2",
"check_answers_card_number": 2,
"header": "Do you know details for person 2?",
"hint_text": "You must provide details for everyone in the household if you know them.",
"type": "radio",
@ -1817,6 +1927,7 @@
"questions": {
"relat2": {
"check_answer_label": "Person 2’s relationship to the lead tenant",
"check_answers_card_number": 2,
"header": "What is person 2’s relationship to the lead tenant?",
"hint_text": "",
"type": "radio",
@ -1852,6 +1963,7 @@
"questions": {
"age2_known": {
"header": "Do you know person 2’s age?",
"check_answers_card_number": 2,
"hint_text": "",
"type": "radio",
"answer_options": {
@ -1879,6 +1991,7 @@
"age2": {
"header": "Age",
"check_answer_label": "Person 2’s age",
"check_answers_card_number": 2,
"type": "numeric",
"min": 0,
"max": 120,
@ -1990,6 +2103,7 @@
"sex2": {
"check_answer_label": "Person 2’s gender identity",
"header": "Which of these best describes person 2’s gender identity?",
"check_answers_card_number": 2,
"hint_text": "",
"type": "radio",
"answer_options": {
@ -2111,6 +2225,7 @@
"questions": {
"ecstat2": {
"check_answer_label": "Person 2’s working situation",
"check_answers_card_number": 2,
"header": "Which of these best describes person 2’s working situation?",
"hint_text": "",
"type": "radio",
@ -2201,8 +2316,17 @@
},
"questions": {
"retirement_value_check": {
"check_answer_label": "Retirement age soft validation",
"hidden_in_check_answers": true,
"check_answer_label": "Retirement confirmation",
"hidden_in_check_answers": {
"depends_on": [
{
"retirement_value_check": 0
},
{
"retirement_value_check": 1
}
]
},
"header": "Are you sure this person is retired?",
"type": "interruption_screen",
"answer_options": {
@ -2247,8 +2371,17 @@
},
"questions": {
"retirement_value_check": {
"check_answer_label": "Retirement age soft validation",
"hidden_in_check_answers": true,
"check_answer_label": "Retirement confirmation",
"hidden_in_check_answers": {
"depends_on": [
{
"retirement_value_check": 0
},
{
"retirement_value_check": 1
}
]
},
"header": "Are you sure this person isn’t retired?",
"type": "interruption_screen",
"answer_options": {
@ -2268,6 +2401,7 @@
"questions": {
"details_known_3": {
"check_answer_label": "Details known for person 3",
"check_answers_card_number": 3,
"header": "Do you know details for person 3?",
"hint_text": "You must provide details for everyone in the household if you know them.",
"type": "radio",
@ -2308,6 +2442,7 @@
"questions": {
"relat3": {
"check_answer_label": "Person 3’s relationship to the lead tenant",
"check_answers_card_number": 3,
"header": "What is person 3’s relationship to the lead tenant?",
"hint_text": "",
"type": "radio",
@ -2343,6 +2478,7 @@
"questions": {
"age3_known": {
"header": "Do you know person 3’s age?",
"check_answers_card_number": 3,
"hint_text": "",
"type": "radio",
"answer_options": {
@ -2370,6 +2506,7 @@
"age3": {
"header": "Age",
"check_answer_label": "Person 3’s age",
"check_answers_card_number": 3,
"type": "numeric",
"min": 0,
"max": 120,
@ -2480,6 +2617,7 @@
"questions": {
"sex3": {
"check_answer_label": "Person 3’s gender identity",
"check_answers_card_number": 3,
"header": "Which of these best describes person 3’s gender identity?",
"hint_text": "",
"type": "radio",
@ -2602,6 +2740,7 @@
"questions": {
"ecstat3": {
"check_answer_label": "Person 3’s working situation",
"check_answers_card_number": 3,
"header": "Which of these best describes person 3’s working situation?",
"hint_text": "",
"type": "radio",
@ -2692,8 +2831,17 @@
},
"questions": {
"retirement_value_check": {
"check_answer_label": "Retirement age soft validation",
"hidden_in_check_answers": true,
"check_answer_label": "Retirement confirmation",
"hidden_in_check_answers": {
"depends_on": [
{
"retirement_value_check": 0
},
{
"retirement_value_check": 1
}
]
},
"header": "Are you sure this person is retired?",
"type": "interruption_screen",
"answer_options": {
@ -2738,8 +2886,17 @@
},
"questions": {
"retirement_value_check": {
"check_answer_label": "Retirement age soft validation",
"hidden_in_check_answers": true,
"check_answer_label": "Retirement confirmation",
"hidden_in_check_answers": {
"depends_on": [
{
"retirement_value_check": 0
},
{
"retirement_value_check": 1
}
]
},
"header": "Are you sure this person isn’t retired?",
"type": "interruption_screen",
"answer_options": {
@ -2759,6 +2916,7 @@
"questions": {
"details_known_4": {
"check_answer_label": "Details known for person 4",
"check_answers_card_number": 4,
"header": "Do you know details for person 4?",
"hint_text": "You must provide details for everyone in the household if you know them.",
"type": "radio",
@ -2796,6 +2954,7 @@
"questions": {
"relat4": {
"check_answer_label": "Person 4’s relationship to the lead tenant",
"check_answers_card_number": 4,
"header": "What is person 4’s relationship to the lead tenant?",
"hint_text": "",
"type": "radio",
@ -2831,6 +2990,7 @@
"questions": {
"age4_known": {
"header": "Do you know person 4’s age?",
"check_answers_card_number": 4,
"hint_text": "",
"type": "radio",
"answer_options": {
@ -2858,6 +3018,7 @@
"age4": {
"header": "Age",
"check_answer_label": "Person 4’s age",
"check_answers_card_number": 4,
"type": "numeric",
"min": 0,
"max": 120,
@ -2968,6 +3129,7 @@
"questions": {
"sex4": {
"check_answer_label": "Person 4’s gender identity",
"check_answers_card_number": 4,
"header": "Which of these best describes person 4’s gender identity?",
"hint_text": "",
"type": "radio",
@ -3090,6 +3252,7 @@
"questions": {
"ecstat4": {
"check_answer_label": "Person 4’s working situation",
"check_answers_card_number": 4,
"header": "Which of these best describes person 4’s working situation?",
"hint_text": "",
"type": "radio",
@ -3180,8 +3343,17 @@
},
"questions": {
"retirement_value_check": {
"check_answer_label": "Retirement age soft validation",
"hidden_in_check_answers": true,
"check_answer_label": "Retirement confirmation",
"hidden_in_check_answers": {
"depends_on": [
{
"retirement_value_check": 0
},
{
"retirement_value_check": 1
}
]
},
"header": "Are you sure this person is retired?",
"type": "interruption_screen",
"answer_options": {
@ -3226,8 +3398,17 @@
},
"questions": {
"retirement_value_check": {
"check_answer_label": "Retirement age soft validation",
"hidden_in_check_answers": true,
"check_answer_label": "Retirement confirmation",
"hidden_in_check_answers": {
"depends_on": [
{
"retirement_value_check": 0
},
{
"retirement_value_check": 1
}
]
},
"header": "Are you sure this person isn’t retired?",
"type": "interruption_screen",
"answer_options": {
@ -3247,6 +3428,7 @@
"questions": {
"details_known_5": {
"check_answer_label": "Details known for person 5",
"check_answers_card_number": 5,
"header": "Do you know details for person 5?",
"hint_text": "You must provide details for everyone in the household if you know them.",
"type": "radio",
@ -3281,6 +3463,7 @@
"questions": {
"relat5": {
"check_answer_label": "Person 5’s relationship to the lead tenant",
"check_answers_card_number": 5,
"header": "What is person 5’s relationship to the lead tenant?",
"hint_text": "",
"type": "radio",
@ -3316,6 +3499,7 @@
"questions": {
"age5_known": {
"header": "Do you know person 5’s age?",
"check_answers_card_number": 5,
"hint_text": "",
"type": "radio",
"answer_options": {
@ -3343,6 +3527,7 @@
"age5": {
"header": "Age",
"check_answer_label": "Person 5’s age",
"check_answers_card_number": 5,
"type": "numeric",
"min": 0,
"max": 120,
@ -3453,6 +3638,7 @@
"questions": {
"sex5": {
"check_answer_label": "Person 5’s gender identity",
"check_answers_card_number": 5,
"header": "Which of these best describes person 5’s gender identity?",
"hint_text": "",
"type": "radio",
@ -3575,6 +3761,7 @@
"questions": {
"ecstat5": {
"check_answer_label": "Person 5’s working situation",
"check_answers_card_number": 5,
"header": "Which of these best describes person 5’s working situation?",
"hint_text": "",
"type": "radio",
@ -3665,8 +3852,17 @@
},
"questions": {
"retirement_value_check": {
"check_answer_label": "Retirement age soft validation",
"hidden_in_check_answers": true,
"check_answer_label": "Retirement confirmation",
"hidden_in_check_answers": {
"depends_on": [
{
"retirement_value_check": 0
},
{
"retirement_value_check": 1
}
]
},
"header": "Are you sure this person is retired?",
"type": "interruption_screen",
"answer_options": {
@ -3711,8 +3907,17 @@
},
"questions": {
"retirement_value_check": {
"check_answer_label": "Retirement age soft validation",
"hidden_in_check_answers": true,
"check_answer_label": "Retirement confirmation",
"hidden_in_check_answers": {
"depends_on": [
{
"retirement_value_check": 0
},
{
"retirement_value_check": 1
}
]
},
"header": "Are you sure this person isn’t retired?",
"type": "interruption_screen",
"answer_options": {
@ -3732,6 +3937,7 @@
"questions": {
"details_known_6": {
"check_answer_label": "Details known for person 6",
"check_answers_card_number": 6,
"header": "Do you know details for person 6?",
"hint_text": "You must provide details for everyone in the household if you know them.",
"type": "radio",
@ -3763,6 +3969,7 @@
"questions": {
"relat6": {
"check_answer_label": "Person 6’s relationship to the lead tenant",
"check_answers_card_number": 6,
"header": "What is person 6’s relationship to the lead tenant?",
"hint_text": "",
"type": "radio",
@ -3798,6 +4005,7 @@
"questions": {
"age6_known": {
"header": "Do you know person 6’s age?",
"check_answers_card_number": 6,
"hint_text": "",
"type": "radio",
"answer_options": {
@ -3825,6 +4033,7 @@
"age6": {
"header": "Age",
"check_answer_label": "Person 6’s age",
"check_answers_card_number": 6,
"type": "numeric",
"min": 0,
"max": 120,
@ -3935,6 +4144,7 @@
"questions": {
"sex6": {
"check_answer_label": "Person 6’s gender identity",
"check_answers_card_number": 6,
"header": "Which of these best describes person 6’s gender identity?",
"hint_text": "",
"type": "radio",
@ -4057,6 +4267,7 @@
"questions": {
"ecstat6": {
"check_answer_label": "Person 6’s working situation",
"check_answers_card_number": 6,
"header": "Which of these best describes person 6’s working situation?",
"hint_text": "",
"type": "radio",
@ -4147,8 +4358,17 @@
},
"questions": {
"retirement_value_check": {
"check_answer_label": "Retirement age soft validation",
"hidden_in_check_answers": true,
"check_answer_label": "Retirement confirmation",
"hidden_in_check_answers": {
"depends_on": [
{
"retirement_value_check": 0
},
{
"retirement_value_check": 1
}
]
},
"header": "Are you sure this person is retired?",
"type": "interruption_screen",
"answer_options": {
@ -4193,8 +4413,17 @@
},
"questions": {
"retirement_value_check": {
"check_answer_label": "Retirement age soft validation",
"hidden_in_check_answers": true,
"check_answer_label": "Retirement confirmation",
"hidden_in_check_answers": {
"depends_on": [
{
"retirement_value_check": 0
},
{
"retirement_value_check": 1
}
]
},
"header": "Are you sure this person isn’t retired?",
"type": "interruption_screen",
"answer_options": {
@ -4214,6 +4443,7 @@
"questions": {
"details_known_7": {
"check_answer_label": "Details known for person 7",
"check_answers_card_number": 7,
"header": "Do you know details for person 7?",
"hint_text": "You must provide details for everyone in the household if you know them.",
"type": "radio",
@ -4242,6 +4472,7 @@
"questions": {
"relat7": {
"check_answer_label": "Person 7’s relationship to the lead tenant",
"check_answers_card_number": 7,
"header": "What is person 7’s relationship to the lead tenant?",
"hint_text": "",
"type": "radio",
@ -4277,6 +4508,7 @@
"questions": {
"age7_known": {
"header": "Do you know person 7’s age?",
"check_answers_card_number": 7,
"hint_text": "",
"type": "radio",
"answer_options": {
@ -4304,6 +4536,7 @@
"age7": {
"header": "Age",
"check_answer_label": "Person 7’s age",
"check_answers_card_number": 7,
"type": "numeric",
"min": 0,
"max": 120,
@ -4414,6 +4647,7 @@
"questions": {
"sex7": {
"check_answer_label": "Person 7’s gender identity",
"check_answers_card_number": 7,
"header": "Which of these best describes person 7’s gender identity?",
"hint_text": "",
"type": "radio",
@ -4536,6 +4770,7 @@
"questions": {
"ecstat7": {
"check_answer_label": "Person 7’s working situation",
"check_answers_card_number": 7,
"header": "Which of these best describes person 7’s working situation?",
"hint_text": "",
"type": "radio",
@ -4626,8 +4861,17 @@
},
"questions": {
"retirement_value_check": {
"check_answer_label": "Retirement age soft validation",
"hidden_in_check_answers": true,
"check_answer_label": "Retirement confirmation",
"hidden_in_check_answers": {
"depends_on": [
{
"retirement_value_check": 0
},
{
"retirement_value_check": 1
}
]
},
"header": "Are you sure this person is retired?",
"type": "interruption_screen",
"answer_options": {
@ -4672,8 +4916,17 @@
},
"questions": {
"retirement_value_check": {
"check_answer_label": "Retirement age soft validation",
"hidden_in_check_answers": true,
"check_answer_label": "Retirement confirmation",
"hidden_in_check_answers": {
"depends_on": [
{
"retirement_value_check": 0
},
{
"retirement_value_check": 1
}
]
},
"header": "Are you sure this person isn’t retired?",
"type": "interruption_screen",
"answer_options": {
@ -4693,6 +4946,7 @@
"questions": {
"details_known_8": {
"check_answer_label": "Details known for person 8",
"check_answers_card_number": 8,
"header": "Do you know details for person 8?",
"hint_text": "You must provide details for everyone in the household if you know them.",
"type": "radio",
@ -4718,6 +4972,7 @@
"questions": {
"relat8": {
"check_answer_label": "Person 8’s relationship to the lead tenant",
"check_answers_card_number": 8,
"header": "What is person 8’s relationship to the lead tenant?",
"hint_text": "",
"type": "radio",
@ -4753,6 +5008,7 @@
"questions": {
"age8_known": {
"header": "Do you know person 8’s age?",
"check_answers_card_number": 8,
"hint_text": "",
"type": "radio",
"answer_options": {
@ -4780,6 +5036,7 @@
"age8": {
"header": "Age",
"check_answer_label": "Person 8’s age",
"check_answers_card_number": 8,
"type": "numeric",
"min": 0,
"max": 120,
@ -4890,6 +5147,7 @@
"questions": {
"sex8": {
"check_answer_label": "Person 8’s gender identity",
"check_answers_card_number": 8,
"header": "Which of these best describes person 8’s gender identity?",
"hint_text": "",
"type": "radio",
@ -5012,6 +5270,7 @@
"questions": {
"ecstat8": {
"check_answer_label": "Person 8’s working situation",
"check_answers_card_number": 8,
"header": "Which of these best describes person 8’s working situation?",
"hint_text": "",
"type": "radio",
@ -5102,8 +5361,17 @@
},
"questions": {
"retirement_value_check": {
"check_answer_label": "Retirement age soft validation",
"hidden_in_check_answers": true,
"check_answer_label": "Retirement confirmation",
"hidden_in_check_answers": {
"depends_on": [
{
"retirement_value_check": 0
},
{
"retirement_value_check": 1
}
]
},
"header": "Are you sure this person is retired?",
"type": "interruption_screen",
"answer_options": {
@ -5148,8 +5416,17 @@
},
"questions": {
"retirement_value_check": {
"check_answer_label": "Retirement age soft validation",
"hidden_in_check_answers": true,
"check_answer_label": "Retirement confirmation",
"hidden_in_check_answers": {
"depends_on": [
{
"retirement_value_check": 0
},
{
"retirement_value_check": 1
}
]
},
"header": "Are you sure this person isn’t retired?",
"type": "interruption_screen",
"answer_options": {
@ -5369,8 +5646,16 @@
},
"questions": {
"pregnancy_value_check": {
"check_answer_label": "Pregnancy soft validation",
"hidden_in_check_answers": true,
"check_answer_label": "Pregnancy confirmation",
"hidden_in_check_answers": {
"depends_on": [{
"pregnancy_value_check": 0
},
{
"pregnancy_value_check": 1
}
]
},
"header": "Are you sure this is correct?",
"type": "interruption_screen",
"answer_options": {
@ -6818,8 +7103,17 @@
},
"questions": {
"net_income_value_check": {
"check_answer_label": "Net income soft validation",
"hidden_in_check_answers": true,
"check_answer_label": "Net income confirmation",
"hidden_in_check_answers": {
"depends_on": [
{
"net_income_value_check": 0
},
{
"net_income_value_check": 1
}
]
},
"header": "Are you sure this is correct?",
"type": "interruption_screen",
"answer_options": {
@ -7719,8 +8013,17 @@
},
"questions": {
"rent_value_check": {
"check_answer_label": "Rent soft validation",
"hidden_in_check_answers": true,
"check_answer_label": "Total rent confirmation",
"hidden_in_check_answers": {
"depends_on": [
{
"rent_value_check": 0
},
{
"rent_value_check": 1
}
]
},
"header": "Are you sure this is correct?",
"type": "interruption_screen",
"answer_options": {
@ -7763,8 +8066,17 @@
},
"questions": {
"rent_value_check": {
"check_answer_label": "Rent soft validation",
"hidden_in_check_answers": true,
"check_answer_label": "Total rent confirmation",
"hidden_in_check_answers": {
"depends_on": [
{
"rent_value_check": 0
},
{
"rent_value_check": 1
}
]
},
"header": "Are you sure this is correct?",
"type": "interruption_screen",
"answer_options": {

6
config/locales/en.yml

@ -122,7 +122,7 @@ en:
mrcdate:
before_tenancy_start: "Enter a major repairs date that is before the tenancy start date"
not_first_let: "Major repairs date must not be completed if the tenancy is a first let"
730_days_before_tenancy_start: "Enter a major repairs completion date that is no more than 730 days before the tenancy start date"
ten_years_before_tenancy_start: "Enter a major repairs completion date that is no more than 10 years before the tenancy start date"
void_date:
ten_years_before_tenancy_start: "Enter a void date must no more than 10 years before the tenancy start date"
before_tenancy_start: "Enter a void date must that is before the tenancy start date"
@ -319,6 +319,10 @@ en:
title: "You told us somebody in the household is pregnant"
no_females: "You also told us there are no female tenants living at the property."
females_not_in_soft_age_range: "You also told us that any female tenants living at the property are in the following age ranges:<ul><li>11 to 16</li><li>50 to 65</li></ul>"
major_repairs_date:
title_text: "You told us the time between the start of the tenancy and the major repairs completion date is more than 2 years"
void_date:
title_text: "You told us the time between the start of the tenancy and the void date is more than 2 years"
devise:
two_factor_authentication:

5
db/migrate/20220808090330_add_major_repairs_date_value_check.rb

@ -0,0 +1,5 @@
class AddMajorRepairsDateValueCheck < ActiveRecord::Migration[7.0]
def change
add_column :case_logs, :major_repairs_date_value_check, :integer
end
end

5
db/migrate/20220808093035_add_void_date_value_check.rb

@ -0,0 +1,5 @@
class AddVoidDateValueCheck < ActiveRecord::Migration[7.0]
def change
add_column :case_logs, :void_date_value_check, :integer
end
end

2
db/schema.rb

@ -200,6 +200,8 @@ ActiveRecord::Schema[7.0].define(version: 2022_08_10_152340) do
t.integer "vacdays"
t.bigint "scheme_id"
t.bigint "location_id"
t.integer "major_repairs_date_value_check"
t.integer "void_date_value_check"
t.index ["created_by_id"], name: "index_case_logs_on_created_by_id"
t.index ["location_id"], name: "index_case_logs_on_location_id"
t.index ["managing_organisation_id"], name: "index_case_logs_on_managing_organisation_id"

27
spec/components/check_answers_summary_list_card_component_spec.rb

@ -0,0 +1,27 @@
require "rails_helper"
RSpec.describe CheckAnswersSummaryListCardComponent, type: :component do
context "when given a set of questions" do
let(:user) { FactoryBot.build(:user) }
let(:case_log) { FactoryBot.build(:case_log, :completed, age2: 99) }
let(:subsection_id) { "household_characteristics" }
let(:subsection) { case_log.form.get_subsection(subsection_id) }
let(:questions) { subsection.applicable_questions(case_log) }
it "renders a summary list card for the answers to those questions" do
result = render_inline(described_class.new(questions:, case_log:, user:))
expect(result).to have_content(questions.first.answer_label(case_log))
end
it "applicable questions doesn't return questions that are hidden in check answers" do
summary_list = described_class.new(questions:, case_log:, user:)
expect(summary_list.applicable_questions.map(&:id).include?("retirement_value_check")).to eq(false)
end
it "has the correct answer label for a question" do
summary_list = described_class.new(questions:, case_log:, user:)
sex1_question = questions[2]
expect(summary_list.get_answer_label(sex1_question)).to eq("Female")
end
end
end

2
spec/factories/case_log.rb

@ -110,6 +110,8 @@ FactoryBot.define do
rp_dontknow { 0 }
tenancyother { nil }
net_income_value_check { nil }
void_date_value_check { 1 }
major_repairs_date_value_check { 1 }
net_income_known { 0 }
previous_la_known { 1 }
property_owner_organisation { "Test" }

13
spec/features/form/check_answers_page_spec.rb

@ -133,6 +133,19 @@ RSpec.describe "Form Check Answers Page" do
end
end
it "does not group questions into summary cards if the questions in the subsection don't have a check_answers_card_number attribute" do
visit("/logs/#{completed_case_log.id}/household-needs/check-answers")
assert_selector ".x-govuk-summary-card__title", count: 0
end
context "when the user is checking their answers for the household characteristics subsection" do
it "they see a seperate summary card for each member of the household" do
visit("/logs/#{completed_case_log.id}/#{subsection}/check-answers")
assert_selector ".x-govuk-summary-card__title", text: "Lead tenant", count: 1
assert_selector ".x-govuk-summary-card__title", text: "Person 2", count: 1
end
end
context "when viewing setup section answers" do
before do
FactoryBot.create(:location, scheme:)

4
spec/fixtures/files/case_logs_download.csv vendored

@ -1,2 +1,2 @@
id,status,created_at,updated_at,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,net_income_value_check,property_owner_organisation,property_manager_organisation,sale_or_letting,irproduct_other,purchaser_code,reason,propcode,majorrepairs,la,prevloc,hb,hbrentshortfall,property_relet,mrcdate,incref,sale_completion_date,startdate,armedforces,first_time_property_let_as_social_housing,unitletas,builtype,voiddate,renttype,needstype,lettype,postcode_known,is_la_inferred,totchild,totelder,totadult,net_income_known,nocharge,is_carehome,household_charge,referral,brent,scharge,pscharge,supcharg,tcharge,tshortfall,chcharge,declaration,ppcodenk,previous_la_known,is_previous_la_inferred,age1_known,age2_known,age3_known,age4_known,age5_known,age6_known,age7_known,age8_known,ethnic_group,ethnic_other,letting_allocation_unknown,details_known_2,details_known_3,details_known_4,details_known_5,details_known_6,details_known_7,details_known_8,rent_type,has_benefits,renewal,wrent,wscharge,wpschrge,wsupchrg,wtcharge,wtshortfall,refused,housingneeds,wchchrg,newprop,relat2,relat3,relat4,relat5,relat6,relat7,relat8,rent_value_check,old_form_id,lar,irproduct,old_id,joint,illness_type_0,retirement_value_check,tshortfall_known,sheltered,pregnancy_value_check,hhtype,new_old,vacdays,scheme_id,location_id,unittype_sh,owning_organisation_name,managing_organisation_name,created_by_name
{id},in_progress,2022-02-08 16:52:15 +0000,2022-02-08 16:52:15 +0000,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,,,,,,,SE1 1TE,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,Westminster,,,,,,,,,,,,,,,Supported housing,,,No,0,0,0,,0,,,,,,,,,,,,,,No,,,,,,,,,,,,,,,,,,,,0,,,,,,,,0,,,,,,,,,,,,,,,,,,,,,,9,,,{scheme_id},SE1 1TE,6,DLUHC,DLUHC,Danny Rojas
id,status,created_at,updated_at,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,net_income_value_check,property_owner_organisation,property_manager_organisation,sale_or_letting,irproduct_other,purchaser_code,reason,propcode,majorrepairs,la,prevloc,hb,hbrentshortfall,property_relet,mrcdate,incref,sale_completion_date,startdate,armedforces,first_time_property_let_as_social_housing,unitletas,builtype,voiddate,renttype,needstype,lettype,postcode_known,is_la_inferred,totchild,totelder,totadult,net_income_known,nocharge,is_carehome,household_charge,referral,brent,scharge,pscharge,supcharg,tcharge,tshortfall,chcharge,declaration,ppcodenk,previous_la_known,is_previous_la_inferred,age1_known,age2_known,age3_known,age4_known,age5_known,age6_known,age7_known,age8_known,ethnic_group,ethnic_other,letting_allocation_unknown,details_known_2,details_known_3,details_known_4,details_known_5,details_known_6,details_known_7,details_known_8,rent_type,has_benefits,renewal,wrent,wscharge,wpschrge,wsupchrg,wtcharge,wtshortfall,refused,housingneeds,wchchrg,newprop,relat2,relat3,relat4,relat5,relat6,relat7,relat8,rent_value_check,old_form_id,lar,irproduct,old_id,joint,illness_type_0,retirement_value_check,tshortfall_known,sheltered,pregnancy_value_check,hhtype,new_old,vacdays,scheme_id,location_id,major_repairs_date_value_check,void_date_value_check,unittype_sh,owning_organisation_name,managing_organisation_name,created_by_name
{id},in_progress,2022-02-08 16:52:15 +0000,2022-02-08 16:52:15 +0000,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,,,,,,,SE1 1TE,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,Westminster,,,,,,,,,,,,,,,Supported housing,,,No,0,0,0,,0,,,,,,,,,,,,,,No,,,,,,,,,,,,,,,,,,,,0,,,,,,,,0,,,,,,,,,,,,,,,,,,,,,,9,,,{scheme_id},SE1 1TE,,,6,DLUHC,DLUHC,Danny Rojas

1 id status created_at updated_at 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 net_income_value_check property_owner_organisation property_manager_organisation sale_or_letting irproduct_other purchaser_code reason propcode majorrepairs la prevloc hb hbrentshortfall property_relet mrcdate incref sale_completion_date startdate armedforces first_time_property_let_as_social_housing unitletas builtype voiddate renttype needstype lettype postcode_known is_la_inferred totchild totelder totadult net_income_known nocharge is_carehome household_charge referral brent scharge pscharge supcharg tcharge tshortfall chcharge declaration ppcodenk previous_la_known is_previous_la_inferred age1_known age2_known age3_known age4_known age5_known age6_known age7_known age8_known ethnic_group ethnic_other letting_allocation_unknown details_known_2 details_known_3 details_known_4 details_known_5 details_known_6 details_known_7 details_known_8 rent_type has_benefits renewal wrent wscharge wpschrge wsupchrg wtcharge wtshortfall refused housingneeds wchchrg newprop relat2 relat3 relat4 relat5 relat6 relat7 relat8 rent_value_check old_form_id lar irproduct old_id joint illness_type_0 retirement_value_check tshortfall_known sheltered pregnancy_value_check hhtype new_old vacdays scheme_id location_id major_repairs_date_value_check void_date_value_check unittype_sh owning_organisation_name managing_organisation_name created_by_name
2 {id} in_progress 2022-02-08 16:52:15 +0000 2022-02-08 16:52:15 +0000 2 SE1 1TE Westminster Supported housing No 0 0 0 0 No 0 0 9 {scheme_id} SE1 1TE 6 DLUHC DLUHC Danny Rojas

4
spec/fixtures/files/case_logs_download_non_support.csv vendored

@ -1,2 +1,2 @@
id,status,created_at,updated_at,tenancycode,age1,sex1,ethnic,national,prevten,ecstat1,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,property_owner_organisation,property_manager_organisation,irproduct_other,purchaser_code,reason,propcode,majorrepairs,la,prevloc,hb,hbrentshortfall,property_relet,mrcdate,incref,sale_completion_date,startdate,armedforces,unitletas,builtype,voiddate,lettype,nocharge,household_charge,referral,brent,scharge,pscharge,supcharg,tcharge,tshortfall,chcharge,declaration,ppcodenk,ethnic_group,ethnic_other,has_benefits,renewal,refused,housingneeds,wchchrg,newprop,relat2,relat3,relat4,relat5,relat6,relat7,relat8,lar,irproduct,joint,illness_type_0,sheltered,scheme_id,location_id,unittype_sh,owning_organisation_name,managing_organisation_name,created_by_name
{id},in_progress,2022-02-08 16:52:15 +0000,2022-02-08 16:52:15 +0000,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,,,,,,,SE1 1TE,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,Westminster,,,,,,,,,,,,,,0,,,,,,,,,,,,,,0,,0,,,,,,,,,,,,,,,,{scheme_id},SE1 1TE,6,DLUHC,DLUHC,Danny Rojas
id,status,created_at,updated_at,tenancycode,age1,sex1,ethnic,national,prevten,ecstat1,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,property_owner_organisation,property_manager_organisation,irproduct_other,purchaser_code,reason,propcode,majorrepairs,la,prevloc,hb,hbrentshortfall,property_relet,mrcdate,incref,sale_completion_date,startdate,armedforces,unitletas,builtype,voiddate,lettype,nocharge,household_charge,referral,brent,scharge,pscharge,supcharg,tcharge,tshortfall,chcharge,declaration,ppcodenk,ethnic_group,ethnic_other,has_benefits,renewal,refused,housingneeds,wchchrg,newprop,relat2,relat3,relat4,relat5,relat6,relat7,relat8,lar,irproduct,joint,illness_type_0,sheltered,scheme_id,location_id,major_repairs_date_value_check,void_date_value_check,unittype_sh,owning_organisation_name,managing_organisation_name,created_by_name
{id},in_progress,2022-02-08 16:52:15 +0000,2022-02-08 16:52:15 +0000,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,,,,,,,SE1 1TE,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,Westminster,,,,,,,,,,,,,,0,,,,,,,,,,,,,,0,,0,,,,,,,,,,,,,,,,{scheme_id},SE1 1TE,,,6,DLUHC,DLUHC,Danny Rojas

1 id status created_at updated_at tenancycode age1 sex1 ethnic national prevten ecstat1 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 property_owner_organisation property_manager_organisation irproduct_other purchaser_code reason propcode majorrepairs la prevloc hb hbrentshortfall property_relet mrcdate incref sale_completion_date startdate armedforces unitletas builtype voiddate lettype nocharge household_charge referral brent scharge pscharge supcharg tcharge tshortfall chcharge declaration ppcodenk ethnic_group ethnic_other has_benefits renewal refused housingneeds wchchrg newprop relat2 relat3 relat4 relat5 relat6 relat7 relat8 lar irproduct joint illness_type_0 sheltered scheme_id location_id major_repairs_date_value_check void_date_value_check unittype_sh owning_organisation_name managing_organisation_name created_by_name
2 {id} in_progress 2022-02-08 16:52:15 +0000 2022-02-08 16:52:15 +0000 2 SE1 1TE Westminster 0 0 0 {scheme_id} SE1 1TE 6 DLUHC DLUHC Danny Rojas

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

@ -13,6 +13,7 @@
"tenant_code_test": {
"questions": {
"tenancycode": {
"check_answers_card_number": 0,
"check_answer_label": "Tenant code",
"header": "What is the tenant code?",
"hint_text": "This is how you usually refer to this tenancy on your own systems.",
@ -31,6 +32,7 @@
"person_1_age": {
"questions": {
"age1": {
"check_answers_card_number": 1,
"check_answer_label": "Lead tenant’s age",
"header": "What is the tenant’s age?",
"type": "numeric",
@ -52,6 +54,7 @@
"person_1_gender": {
"questions": {
"sex1": {
"check_answers_card_number": 1,
"check_answer_label": "Lead tenant’s gender identity",
"header": "Which of these best describes the tenant’s gender identity?",
"type": "radio",
@ -77,6 +80,7 @@
"description": "",
"questions": {
"ecstat1": {
"check_answers_card_number": 1,
"check_answer_label": "Lead tenant’s working situation",
"header": "Which of these best describes the lead tenant’s socks?",
"hint_text": "The lead tenant is the person in the household who does the most paid work. If several people do the same paid work, the lead tenant is whoever is the oldest.",
@ -125,6 +129,7 @@
"household_number_of_members": {
"questions": {
"hhmemb": {
"check_answers_card_number": 0,
"check_answer_label": "Number of Household Members",
"header": "How many people are there in the household?",
"hint_text": "The maximum number of members is 8",
@ -140,6 +145,7 @@
}
},
"relat2": {
"check_answers_card_number": 2,
"check_answer_label": "Person 2’s relationship to lead tenant",
"header": "What is person 2’s relationship to lead tenant",
"type": "radio",
@ -153,6 +159,7 @@
}
},
"age2": {
"check_answers_card_number": 2,
"check_answer_label": "Person 2’s age",
"header": "Do you know person 2’s age?",
"type": "numeric",
@ -162,6 +169,7 @@
"width": 2
},
"sex2": {
"check_answers_card_number": 2,
"check_answer_label": "Person 2’s gender identity",
"header": "Which of these best describes person 2’s gender identity?",
"type": "radio",
@ -182,11 +190,35 @@
}
}
},
"retirement_value_check": {
"questions": {
"retirement_value_check": {
"check_answer_label": "Retirement age soft validation",
"hidden_in_check_answers": true,
"header": "Are you sure this person is retired?",
"type": "radio",
"answer_options": {
"0": {
"value": "Yes"
},
"1": {
"value": "No"
}
}
}
},
"depends_on": [
{
"age2": { "operator": ">", "operand": 50 }
}
]
},
"person_2_working_situation": {
"header": "",
"description": "",
"questions": {
"ecstat2": {
"check_answers_card_number": 2,
"check_answer_label": "Person 2’s Work",
"header": "Which of these best describes person 2’s working situation?",
"type": "radio",
@ -216,6 +248,7 @@
"propcode": {
"questions": {
"propcode": {
"check_answers_card_number": 0,
"check_answer_label": "",
"header": "property reference?",
"type": "text"

4
spec/models/form/subsection_spec.rb

@ -25,12 +25,12 @@ RSpec.describe Form::Subsection, type: :model do
end
it "has pages" do
expected_pages = %w[tenant_code_test person_1_age person_1_gender person_1_working_situation household_number_of_members person_2_working_situation propcode]
expected_pages = %w[tenant_code_test person_1_age person_1_gender person_1_working_situation household_number_of_members retirement_value_check person_2_working_situation propcode]
expect(subsection.pages.map(&:id)).to eq(expected_pages)
end
it "has questions" do
expected_questions = %w[tenancycode age1 sex1 ecstat1 hhmemb relat2 age2 sex2 ecstat2 propcode]
expected_questions = %w[tenancycode age1 sex1 ecstat1 hhmemb relat2 age2 sex2 retirement_value_check ecstat2 propcode]
expect(subsection.questions.map(&:id)).to eq(expected_questions)
end

2
spec/models/form_handler_spec.rb

@ -17,7 +17,7 @@ RSpec.describe FormHandler do
form_handler = described_class.instance
form = form_handler.get_form(test_form_name)
expect(form).to be_a(Form)
expect(form.pages.count).to eq(44)
expect(form.pages.count).to eq(45)
end
end

2
spec/models/form_spec.rb

@ -178,7 +178,7 @@ RSpec.describe Form, type: :model do
describe "invalidated_page_questions" do
let(:case_log) { FactoryBot.create(:case_log, :in_progress, needstype: 1) }
let(:expected_invalid) { %w[scheme_id condition_effects cbl conditional_question_no_second_question net_income_value_check dependent_question offered layear declaration] }
let(:expected_invalid) { %w[scheme_id retirement_value_check condition_effects cbl conditional_question_no_second_question net_income_value_check dependent_question offered layear declaration] }
context "when dependencies are not met" do
it "returns an array of question keys whose pages conditions are not met" do

10
spec/models/validations/date_validations_spec.rb

@ -85,17 +85,17 @@ RSpec.describe Validations::DateValidations do
expect(record.errors["mrcdate"]).to be_empty
end
it "cannot be more than 2 years before the tenancy start date" do
it "cannot be more than 10 years before the tenancy start date" do
record.startdate = Time.zone.local(2022, 2, 1)
record.mrcdate = Time.zone.local(2020, 1, 1)
record.mrcdate = Time.zone.local(2012, 1, 1)
date_validator.validate_property_major_repairs(record)
expect(record.errors["mrcdate"])
.to include(match I18n.t("validations.property.mrcdate.730_days_before_tenancy_start"))
.to include(match I18n.t("validations.property.mrcdate.ten_years_before_tenancy_start"))
end
it "must be within 2 years of the tenancy start date" do
it "must be within 10 years of the tenancy start date" do
record.startdate = Time.zone.local(2022, 2, 1)
record.mrcdate = Time.zone.local(2020, 3, 1)
record.mrcdate = Time.zone.local(2012, 3, 1)
date_validator.validate_property_major_repairs(record)
expect(record.errors["mrcdate"]).to be_empty
end

32
spec/models/validations/soft_validations_spec.rb

@ -205,4 +205,36 @@ RSpec.describe Validations::SoftValidations do
end
end
end
describe "major repairs date soft validations" do
context "when the major repairs date is within 10 years of the tenancy start date" do
it "shows the interruption screen" do
record.update!(startdate: Time.zone.local(2022, 2, 1), mrcdate: Time.zone.local(2013, 2, 1))
expect(record.major_repairs_date_in_soft_range?).to be true
end
end
context "when the major repairs date is less than 2 years before the tenancy start date" do
it "does not show the interruption screen" do
record.update!(startdate: Time.zone.local(2022, 2, 1), mrcdate: Time.zone.local(2021, 2, 1))
expect(record.major_repairs_date_in_soft_range?).to be false
end
end
end
describe "void date soft validations" do
context "when the void date is within 10 years of the tenancy start date" do
it "shows the interruption screen" do
record.update!(startdate: Time.zone.local(2022, 2, 1), voiddate: Time.zone.local(2013, 2, 1))
expect(record.voiddate_in_soft_range?).to be true
end
end
context "when the void date is less than 2 years before the tenancy start date" do
it "does not show the interruption screen" do
record.update!(startdate: Time.zone.local(2022, 2, 1), voiddate: Time.zone.local(2021, 2, 1))
expect(record.voiddate_in_soft_range?).to be false
end
end
end
end

Loading…
Cancel
Save