Browse Source

Merge branch 'main' into CLDC-3669-extract-bu-validations

pull/2719/head
Manny Dinssa 8 months ago committed by GitHub
parent
commit
33a5c92b58
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      app/constants/global_constants.rb
  2. 3
      app/helpers/formatting_helper.rb
  3. 1
      app/helpers/interruption_screen_helper.rb
  4. 2
      app/helpers/merge_requests_helper.rb
  5. 2
      app/models/bulk_upload.rb
  6. 2
      app/models/form/lettings/pages/address.rb
  7. 2
      app/models/form/lettings/pages/address_fallback.rb
  8. 2
      app/models/form/lettings/pages/address_matcher.rb
  9. 1
      app/models/form/lettings/pages/care_home_weekly.rb
  10. 2
      app/models/form/lettings/pages/income_amount.rb
  11. 1
      app/models/form/lettings/pages/income_known.rb
  12. 1
      app/models/form/lettings/pages/lead_tenant_age.rb
  13. 1
      app/models/form/lettings/pages/lead_tenant_ethnic_background_arab.rb
  14. 1
      app/models/form/lettings/pages/lead_tenant_ethnic_background_asian.rb
  15. 1
      app/models/form/lettings/pages/lead_tenant_ethnic_background_black.rb
  16. 1
      app/models/form/lettings/pages/lead_tenant_ethnic_background_mixed.rb
  17. 1
      app/models/form/lettings/pages/lead_tenant_ethnic_background_white.rb
  18. 1
      app/models/form/lettings/pages/lead_tenant_nationality.rb
  19. 24
      app/models/form/lettings/pages/max_rent_value_check.rb
  20. 24
      app/models/form/lettings/pages/min_rent_value_check.rb
  21. 9
      app/models/form/lettings/pages/person_age.rb
  22. 1
      app/models/form/lettings/pages/person_known.rb
  23. 1
      app/models/form/lettings/pages/previous_housing_situation.rb
  24. 1
      app/models/form/lettings/pages/previous_housing_situation_renewal.rb
  25. 1
      app/models/form/lettings/pages/previous_local_authority.rb
  26. 1
      app/models/form/lettings/pages/previous_postcode.rb
  27. 1
      app/models/form/lettings/pages/property_major_repairs.rb
  28. 14
      app/models/form/lettings/pages/property_postcode.rb
  29. 1
      app/models/form/lettings/pages/reason_for_leaving_last_settled_home.rb
  30. 1
      app/models/form/lettings/pages/reason_for_leaving_last_settled_home_renewal.rb
  31. 1
      app/models/form/lettings/pages/referral.rb
  32. 1
      app/models/form/lettings/pages/referral_prp.rb
  33. 1
      app/models/form/lettings/pages/referral_supported_housing.rb
  34. 1
      app/models/form/lettings/pages/referral_supported_housing_prp.rb
  35. 2
      app/models/form/lettings/pages/rent_4_weekly.rb
  36. 2
      app/models/form/lettings/pages/rent_bi_weekly.rb
  37. 2
      app/models/form/lettings/pages/rent_monthly.rb
  38. 35
      app/models/form/lettings/pages/rent_value_check.rb
  39. 2
      app/models/form/lettings/pages/rent_weekly.rb
  40. 1
      app/models/form/lettings/pages/starter_tenancy_type.rb
  41. 1
      app/models/form/lettings/pages/tenancy_length.rb
  42. 1
      app/models/form/lettings/pages/tenancy_length_affordable_rent.rb
  43. 1
      app/models/form/lettings/pages/tenancy_length_intermediate_rent.rb
  44. 1
      app/models/form/lettings/pages/tenancy_length_periodic.rb
  45. 1
      app/models/form/lettings/pages/tenancy_type.rb
  46. 1
      app/models/form/lettings/pages/uprn.rb
  47. 1
      app/models/form/lettings/pages/uprn_selection.rb
  48. 1
      app/models/form/lettings/pages/void_date.rb
  49. 3
      app/models/form/lettings/questions/address_line1.rb
  50. 3
      app/models/form/lettings/questions/address_line1_for_address_matcher.rb
  51. 2
      app/models/form/lettings/questions/address_line2.rb
  52. 8
      app/models/form/lettings/questions/age.rb
  53. 3
      app/models/form/lettings/questions/age1.rb
  54. 11
      app/models/form/lettings/questions/age1_known.rb
  55. 4
      app/models/form/lettings/questions/age_known.rb
  56. 6
      app/models/form/lettings/questions/beds.rb
  57. 3
      app/models/form/lettings/questions/benefits.rb
  58. 4
      app/models/form/lettings/questions/brent_4_weekly.rb
  59. 4
      app/models/form/lettings/questions/brent_bi_weekly.rb
  60. 4
      app/models/form/lettings/questions/brent_monthly.rb
  61. 4
      app/models/form/lettings/questions/brent_weekly.rb
  62. 3
      app/models/form/lettings/questions/builtype.rb
  63. 4
      app/models/form/lettings/questions/chcharge_4_weekly.rb
  64. 4
      app/models/form/lettings/questions/chcharge_bi_weekly.rb
  65. 4
      app/models/form/lettings/questions/chcharge_monthly.rb
  66. 4
      app/models/form/lettings/questions/chcharge_weekly.rb
  67. 3
      app/models/form/lettings/questions/county.rb
  68. 4
      app/models/form/lettings/questions/declaration.rb
  69. 3
      app/models/form/lettings/questions/details_known.rb
  70. 4
      app/models/form/lettings/questions/earnings.rb
  71. 4
      app/models/form/lettings/questions/ethnic_arab.rb
  72. 4
      app/models/form/lettings/questions/ethnic_asian.rb
  73. 4
      app/models/form/lettings/questions/ethnic_black.rb
  74. 3
      app/models/form/lettings/questions/ethnic_group.rb
  75. 4
      app/models/form/lettings/questions/ethnic_mixed.rb
  76. 4
      app/models/form/lettings/questions/ethnic_white.rb
  77. 3
      app/models/form/lettings/questions/first_time_property_let_as_social_housing.rb
  78. 10
      app/models/form/lettings/questions/gender_identity1.rb
  79. 3
      app/models/form/lettings/questions/hb.rb
  80. 3
      app/models/form/lettings/questions/hbrentshortfall.rb
  81. 3
      app/models/form/lettings/questions/hhmemb.rb
  82. 3
      app/models/form/lettings/questions/homeless.rb
  83. 3
      app/models/form/lettings/questions/household_charge.rb
  84. 4
      app/models/form/lettings/questions/incfreq.rb
  85. 4
      app/models/form/lettings/questions/is_carehome.rb
  86. 3
      app/models/form/lettings/questions/joint.rb
  87. 2
      app/models/form/lettings/questions/la.rb
  88. 3
      app/models/form/lettings/questions/layear.rb
  89. 3
      app/models/form/lettings/questions/letting_allocation.rb
  90. 4
      app/models/form/lettings/questions/majorrepairs.rb
  91. 15
      app/models/form/lettings/questions/max_rent_value_check.rb
  92. 3
      app/models/form/lettings/questions/mrcdate.rb
  93. 3
      app/models/form/lettings/questions/nationality.rb
  94. 3
      app/models/form/lettings/questions/nationality_all.rb
  95. 4
      app/models/form/lettings/questions/nationality_all_group.rb
  96. 3
      app/models/form/lettings/questions/net_income_known.rb
  97. 2
      app/models/form/lettings/questions/offered.rb
  98. 3
      app/models/form/lettings/questions/period.rb
  99. 10
      app/models/form/lettings/questions/person_gender_identity.rb
  100. 3
      app/models/form/lettings/questions/person_relationship.rb
  101. Some files were not shown because too many files have changed in this diff Show More

2
app/constants/global_constants.rb

@ -1,5 +1,5 @@
module GlobalConstants
HELPDESK_URL = "https://dluhcdigital.atlassian.net/servicedesk/customer/portal/6/group/11".freeze
HELPDESK_URL = "https://mhclgdigital.atlassian.net/servicedesk/customer/portal/6/group/11".freeze
COUNTRIES_ANSWER_OPTIONS = {
"" => "Select an option",

3
app/helpers/formatting_helper.rb

@ -2,7 +2,8 @@ module FormattingHelper
def format_ending(text)
return text if text.blank?
modified_text = lowercase_first_letter(text)
first_word = text.split.first
modified_text = first_word == first_word.upcase ? text : lowercase_first_letter(text)
ensure_sentence_ending(modified_text)
end

1
app/helpers/interruption_screen_helper.rb

@ -1,6 +1,7 @@
module InterruptionScreenHelper
def display_informative_text(informative_text, log)
return informative_text if informative_text.is_a? String
return "" if informative_text.nil?
return "" unless informative_text["arguments"]
translation_params = {}

2
app/helpers/merge_requests_helper.rb

@ -9,7 +9,7 @@ module MergeRequestsHelper
def request_details(merge_request)
[
{ label: "Requester", value: display_value_or_placeholder(merge_request.requester&.name) },
{ label: "Helpdesk ticket", value: merge_request.helpdesk_ticket.present? ? link_to("#{merge_request.helpdesk_ticket} (opens in a new tab)", "https://dluhcdigital.atlassian.net/browse/#{merge_request.helpdesk_ticket}", target: "_blank", rel: "noopener noreferrer") : display_value_or_placeholder(nil), action: merge_request_action(merge_request, "helpdesk_ticket") },
{ label: "Helpdesk ticket", value: merge_request.helpdesk_ticket.present? ? link_to("#{merge_request.helpdesk_ticket} (opens in a new tab)", "https://mhclgdigital.atlassian.net/browse/#{merge_request.helpdesk_ticket}", target: "_blank", rel: "noopener noreferrer") : display_value_or_placeholder(nil), action: merge_request_action(merge_request, "helpdesk_ticket") },
{ label: "Status", value: status_tag(merge_request.status) },
]
end

2
app/models/bulk_upload.rb

@ -32,6 +32,8 @@ class BulkUpload < ApplicationRecord
scope :filter_by_user, ->(user_id, _user = nil) { user_id.present? ? where(user_id:) : all }
scope :filter_by_uploading_organisation, ->(organisation_id, _user = nil) { where(organisation_id:) }
has_paper_trail
def completed?
incomplete_logs = logs.where.not(status: "completed")
!incomplete_logs.exists?

2
app/models/form/lettings/pages/address.rb

@ -2,7 +2,7 @@ class Form::Lettings::Pages::Address < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "address"
@header = "Q#{QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]} - What is the property's address?"
@copy_key = "lettings.property_information.address"
@depends_on = [
{ "is_supported_housing?" => false, "uprn_known" => nil },
{ "is_supported_housing?" => false, "uprn_known" => 0 },

2
app/models/form/lettings/pages/address_fallback.rb

@ -2,7 +2,7 @@ class Form::Lettings::Pages::AddressFallback < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "address"
@header = "Q12 - What is the property's address?"
@copy_key = "lettings.property_information.address"
@depends_on = [
{ "is_supported_housing?" => false, "uprn_known" => nil, "uprn_selection" => "uprn_not_listed" },
{ "is_supported_housing?" => false, "uprn_known" => 0, "uprn_selection" => "uprn_not_listed" },

2
app/models/form/lettings/pages/address_matcher.rb

@ -2,7 +2,7 @@ class Form::Lettings::Pages::AddressMatcher < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "address_matcher"
@header = "Find an address"
@copy_key = "lettings.property_information.address_matcher"
@depends_on = [
{ "is_supported_housing?" => false, "uprn_known" => nil },
{ "is_supported_housing?" => false, "uprn_known" => 0 },

1
app/models/form/lettings/pages/care_home_weekly.rb

@ -2,6 +2,7 @@ class Form::Lettings::Pages::CareHomeWeekly < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "care_home_weekly"
@copy_key = "lettings.income_and_benefits.care_home"
@depends_on = [
{ "rent_and_charges_paid_weekly?" => true, "is_supported_housing?" => true, "household_charge" => 0 },
{ "rent_and_charges_paid_weekly?" => true, "is_supported_housing?" => true, "household_charge" => nil },

2
app/models/form/lettings/pages/income_amount.rb

@ -2,7 +2,7 @@ class Form::Lettings::Pages::IncomeAmount < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "income_amount"
@header = "Total household income"
@copy_key = "lettings.income_and_benefits.income_amount"
@depends_on = [{ "net_income_known" => 0 }]
end

1
app/models/form/lettings/pages/income_known.rb

@ -2,7 +2,6 @@ class Form::Lettings::Pages::IncomeKnown < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "income_known"
@header = "Household’s combined income after tax"
end
def questions

1
app/models/form/lettings/pages/lead_tenant_age.rb

@ -2,6 +2,7 @@ class Form::Lettings::Pages::LeadTenantAge < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "lead_tenant_age"
@copy_key = "lettings.household_characteristics.age1"
@depends_on = [{ "declaration" => 1 }]
end

1
app/models/form/lettings/pages/lead_tenant_ethnic_background_arab.rb

@ -2,6 +2,7 @@ class Form::Lettings::Pages::LeadTenantEthnicBackgroundArab < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "lead_tenant_ethnic_background_arab"
@copy_key = "lettings.household_characteristics.ethnic.ethnic_background_arab"
@depends_on = [{ "ethnic_group" => 4 }]
end

1
app/models/form/lettings/pages/lead_tenant_ethnic_background_asian.rb

@ -2,6 +2,7 @@ class Form::Lettings::Pages::LeadTenantEthnicBackgroundAsian < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "lead_tenant_ethnic_background_asian"
@copy_key = "lettings.household_characteristics.ethnic.ethnic_background_asian"
@depends_on = [{ "ethnic_group" => 2 }]
end

1
app/models/form/lettings/pages/lead_tenant_ethnic_background_black.rb

@ -2,6 +2,7 @@ class Form::Lettings::Pages::LeadTenantEthnicBackgroundBlack < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "lead_tenant_ethnic_background_black"
@copy_key = "lettings.household_characteristics.ethnic.ethnic_background_black"
@depends_on = [{ "ethnic_group" => 3 }]
end

1
app/models/form/lettings/pages/lead_tenant_ethnic_background_mixed.rb

@ -2,6 +2,7 @@ class Form::Lettings::Pages::LeadTenantEthnicBackgroundMixed < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "lead_tenant_ethnic_background_mixed"
@copy_key = "lettings.household_characteristics.ethnic.ethnic_background_mixed"
@depends_on = [{ "ethnic_group" => 1 }]
end

1
app/models/form/lettings/pages/lead_tenant_ethnic_background_white.rb

@ -2,6 +2,7 @@ class Form::Lettings::Pages::LeadTenantEthnicBackgroundWhite < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "lead_tenant_ethnic_background_white"
@copy_key = "lettings.household_characteristics.ethnic.ethnic_background_white"
@depends_on = [{ "ethnic_group" => 0 }]
end

1
app/models/form/lettings/pages/lead_tenant_nationality.rb

@ -2,6 +2,7 @@ class Form::Lettings::Pages::LeadTenantNationality < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "lead_tenant_nationality"
@copy_key = "lettings.household_characteristics.#{form.start_year_after_2024? ? 'nationality_all' : 'national'}"
@depends_on = [{ "declaration" => 1 }]
end

24
app/models/form/lettings/pages/max_rent_value_check.rb

@ -1,24 +0,0 @@
class Form::Lettings::Pages::MaxRentValueCheck < ::Form::Page
def initialize(id, hsh, subsection, check_answers_card_number: nil)
super(id, hsh, subsection)
@depends_on = [{ "rent_in_soft_max_range?" => true }]
@title_text = {
"translation" => "soft_validations.rent.outside_range_title",
"arguments" => [{
"key" => "brent",
"label" => true,
"i18n_template" => "brent",
}],
}
@informative_text = I18n.t("soft_validations.rent.informative_text", higher_or_lower: "higher")
@check_answers_card_number = check_answers_card_number
end
def questions
@questions ||= [Form::Lettings::Questions::MaxRentValueCheck.new(nil, nil, self, check_answers_card_number: @check_answers_card_number)]
end
def interruption_screen_question_ids
%w[brent period startdate uprn postcode_full la beds rent_type needstype]
end
end

24
app/models/form/lettings/pages/min_rent_value_check.rb

@ -1,24 +0,0 @@
class Form::Lettings::Pages::MinRentValueCheck < ::Form::Page
def initialize(id, hsh, subsection, check_answers_card_number: nil)
super(id, hsh, subsection)
@depends_on = [{ "rent_in_soft_min_range?" => true }]
@title_text = {
"translation" => "soft_validations.rent.outside_range_title",
"arguments" => [{
"key" => "brent",
"label" => true,
"i18n_template" => "brent",
}],
}
@informative_text = I18n.t("soft_validations.rent.informative_text", higher_or_lower: "lower")
@check_answers_card_number = check_answers_card_number
end
def questions
@questions ||= [Form::Lettings::Questions::MinRentValueCheck.new(nil, nil, self, check_answers_card_number: @check_answers_card_number)]
end
def interruption_screen_question_ids
%w[brent period startdate uprn postcode_full la beds rent_type needstype]
end
end

9
app/models/form/lettings/pages/person_age.rb

@ -1,13 +1,12 @@
class Form::Lettings::Pages::PersonAge < ::Form::Page
def initialize(id, hsh, subsection, person_index:, person_type: "non_child")
def initialize(id, hsh, subsection, person_index:)
super(id, hsh, subsection)
@id = "person_#{person_index}_age_#{person_type}"
@id = "person_#{person_index}_age"
@copy_key = "lettings.household_characteristics.age#{person_index}"
@person_index = person_index
@person_type = person_type
@depends_on = [
{
"details_known_#{person_index}" => 0,
"person_#{person_index}_child_relation?" => (person_type == "child"),
},
]
end
@ -15,7 +14,7 @@ class Form::Lettings::Pages::PersonAge < ::Form::Page
def questions
@questions ||= [
Form::Lettings::Questions::AgeKnown.new(nil, nil, self, person_index: @person_index),
Form::Lettings::Questions::Age.new(nil, nil, self, person_index: @person_index, person_type: @person_type),
Form::Lettings::Questions::Age.new(nil, nil, self, person_index: @person_index),
]
end
end

1
app/models/form/lettings/pages/person_known.rb

@ -2,7 +2,6 @@ class Form::Lettings::Pages::PersonKnown < ::Form::Page
def initialize(id, hsh, subsection, person_index:)
super(id, hsh, subsection)
@id = "person_#{person_index}_known"
@header = "You’ve given us the details for #{person_index - 1} person in the household"
@depends_on = (person_index..8).map { |index| { "hhmemb" => index } }
@person_index = person_index
end

1
app/models/form/lettings/pages/previous_housing_situation.rb

@ -2,6 +2,7 @@ class Form::Lettings::Pages::PreviousHousingSituation < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "previous_housing_situation"
@copy_key = "lettings.household_situation.prevten.not_renewal"
@depends_on = [{ "is_renewal?" => false }]
end

1
app/models/form/lettings/pages/previous_housing_situation_renewal.rb

@ -2,6 +2,7 @@ class Form::Lettings::Pages::PreviousHousingSituationRenewal < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "previous_housing_situation_renewal"
@copy_key = "lettings.household_situation.prevten.renewal"
@depends_on = [{ "is_renewal?" => true, "is_supported_housing?" => true }]
end

1
app/models/form/lettings/pages/previous_local_authority.rb

@ -2,6 +2,7 @@ class Form::Lettings::Pages::PreviousLocalAuthority < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "previous_local_authority"
@copy_key = "lettings.household_situation.previous_local_authority"
@depends_on = [{ "is_previous_la_inferred" => false, "renewal" => 0 }]
end

1
app/models/form/lettings/pages/previous_postcode.rb

@ -2,6 +2,7 @@ class Form::Lettings::Pages::PreviousPostcode < ::Form::Page
def initialize(id, hsh, page)
super
@depends_on = [{ "renewal" => 0 }]
@copy_key = "lettings.household_situation.previous_postcode"
end
def questions

1
app/models/form/lettings/pages/property_major_repairs.rb

@ -2,6 +2,7 @@ class Form::Lettings::Pages::PropertyMajorRepairs < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "property_major_repairs"
@copy_key = "lettings.property_information.property_major_repairs"
@depends_on = [{ "is_renewal?" => false, "vacancy_reason_not_renewal_or_first_let?" => true }]
end

14
app/models/form/lettings/pages/property_postcode.rb

@ -1,14 +0,0 @@
class Form::Lettings::Pages::PropertyPostcode < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "property_postcode"
@depends_on = [{ "is_general_needs?" => true }]
end
def questions
@questions ||= [
Form::Lettings::Questions::PostcodeKnown.new(nil, nil, self),
Form::Lettings::Questions::PostcodeFull.new(nil, nil, self),
]
end
end

1
app/models/form/lettings/pages/reason_for_leaving_last_settled_home.rb

@ -2,6 +2,7 @@ class Form::Lettings::Pages::ReasonForLeavingLastSettledHome < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "reason_for_leaving_last_settled_home"
@copy_key = "lettings.household_situation.reason.reason_for_leaving_last_settled_home"
@depends_on = [{ "renewal" => 0 }]
end

1
app/models/form/lettings/pages/reason_for_leaving_last_settled_home_renewal.rb

@ -2,6 +2,7 @@ class Form::Lettings::Pages::ReasonForLeavingLastSettledHomeRenewal < ::Form::Pa
def initialize(id, hsh, subsection)
super
@id = "reason_for_leaving_last_settled_home_renewal"
@copy_key = "lettings.household_situation.reason.reason_for_leaving_last_settled_home_renewal"
@depends_on = [{ "renewal" => 1 }]
end

1
app/models/form/lettings/pages/referral.rb

@ -2,6 +2,7 @@ class Form::Lettings::Pages::Referral < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "referral"
@copy_key = "lettings.household_situation.referral.general_needs.la"
@depends_on = [{ "owning_organisation_provider_type" => "LA", "needstype" => 1, "renewal" => 0 }]
end

1
app/models/form/lettings/pages/referral_prp.rb

@ -2,6 +2,7 @@ class Form::Lettings::Pages::ReferralPrp < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "referral_prp"
@copy_key = "lettings.household_situation.referral.general_needs.prp"
@depends_on = [{ "owning_organisation_provider_type" => "PRP", "needstype" => 1, "renewal" => 0 }]
end

1
app/models/form/lettings/pages/referral_supported_housing.rb

@ -2,6 +2,7 @@ class Form::Lettings::Pages::ReferralSupportedHousing < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "referral_supported_housing"
@copy_key = "lettings.household_situation.referral.supported_housing.la"
@depends_on = [{ "owning_organisation_provider_type" => "LA", "needstype" => 2, "renewal" => 0 }]
end

1
app/models/form/lettings/pages/referral_supported_housing_prp.rb

@ -2,6 +2,7 @@ class Form::Lettings::Pages::ReferralSupportedHousingPrp < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "referral_supported_housing_prp"
@copy_key = "lettings.household_situation.referral.supported_housing.prp"
@depends_on = [{ "owning_organisation_provider_type" => "PRP", "needstype" => 2, "renewal" => 0 }]
end

2
app/models/form/lettings/pages/rent_4_weekly.rb

@ -2,7 +2,7 @@ class Form::Lettings::Pages::Rent4Weekly < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "rent_4_weekly"
@header = "Household rent and charges"
@copy_key = "lettings.income_and_benefits.rent_and_charges"
@depends_on = [
{ "household_charge" => 0, "rent_and_charges_paid_every_4_weeks?" => true, "is_carehome?" => false },
{ "household_charge" => nil, "rent_and_charges_paid_every_4_weeks?" => true, "is_carehome?" => false },

2
app/models/form/lettings/pages/rent_bi_weekly.rb

@ -2,7 +2,7 @@ class Form::Lettings::Pages::RentBiWeekly < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "rent_bi_weekly"
@header = "Household rent and charges"
@copy_key = "lettings.income_and_benefits.rent_and_charges"
@depends_on = [
{ "household_charge" => nil, "rent_and_charges_paid_every_2_weeks?" => true, "is_carehome?" => false },
{ "household_charge" => 0, "rent_and_charges_paid_every_2_weeks?" => true, "is_carehome?" => false },

2
app/models/form/lettings/pages/rent_monthly.rb

@ -2,7 +2,7 @@ class Form::Lettings::Pages::RentMonthly < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "rent_monthly"
@header = "Household rent and charges"
@copy_key = "lettings.income_and_benefits.rent_and_charges"
@depends_on = [
{ "household_charge" => nil, "rent_and_charges_paid_monthly?" => true, "is_carehome?" => false },
{ "household_charge" => 0, "rent_and_charges_paid_monthly?" => true, "is_carehome?" => false },

35
app/models/form/lettings/pages/rent_value_check.rb

@ -0,0 +1,35 @@
class Form::Lettings::Pages::RentValueCheck < ::Form::Page
def initialize(id, hsh, subsection, check_answers_card_number: nil)
super(id, hsh, subsection)
@depends_on = [{ "rent_soft_validation_triggered?" => true }]
@title_text = {
"translation" => "soft_validations.rent.outside_range_title",
"arguments" => [
{
"key" => "brent",
"label" => true,
"i18n_template" => "brent",
},
],
}
@informative_text = {
"translation" => "soft_validations.rent.informative_text",
"arguments" => [
{
"key" => "rent_soft_validation_higher_or_lower_text",
"label" => false,
"i18n_template" => "higher_or_lower",
},
],
}
@check_answers_card_number = check_answers_card_number
end
def questions
@questions ||= [Form::Lettings::Questions::RentValueCheck.new(nil, nil, self, check_answers_card_number: @check_answers_card_number)]
end
def interruption_screen_question_ids
%w[brent period startdate uprn postcode_full la beds rent_type needstype]
end
end

2
app/models/form/lettings/pages/rent_weekly.rb

@ -2,7 +2,7 @@ class Form::Lettings::Pages::RentWeekly < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "rent_weekly"
@header = "Household rent and charges"
@copy_key = "lettings.income_and_benefits.rent_and_charges"
@depends_on = [
{ "rent_and_charges_paid_weekly?" => true, "household_charge" => 0, "is_carehome?" => false },
{ "rent_and_charges_paid_weekly?" => true, "household_charge" => nil, "is_carehome?" => false },

1
app/models/form/lettings/pages/starter_tenancy_type.rb

@ -2,6 +2,7 @@ class Form::Lettings::Pages::StarterTenancyType < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "starter_tenancy_type"
@copy_key = "lettings.tenancy_information.tenancy.starter_tenancy_type"
@depends_on = [{ "starter_tenancy?" => true }]
end

1
app/models/form/lettings/pages/tenancy_length.rb

@ -2,6 +2,7 @@ class Form::Lettings::Pages::TenancyLength < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "tenancy_length"
@copy_key = "lettings.tenancy_information.tenancylength.tenancy_length"
@depends_on = [{ "tenancy_type_fixed_term?" => true, "needstype" => 2 }]
end

1
app/models/form/lettings/pages/tenancy_length_affordable_rent.rb

@ -2,6 +2,7 @@ class Form::Lettings::Pages::TenancyLengthAffordableRent < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "tenancy_length_affordable_rent"
@copy_key = "lettings.tenancy_information.tenancylength.tenancy_length_affordable_rent"
@depends_on = [{ "tenancy_type_fixed_term?" => true, "affordable_or_social_rent?" => true, "needstype" => 1 }]
end

1
app/models/form/lettings/pages/tenancy_length_intermediate_rent.rb

@ -2,6 +2,7 @@ class Form::Lettings::Pages::TenancyLengthIntermediateRent < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "tenancy_length_intermediate_rent"
@copy_key = "lettings.tenancy_information.tenancylength.tenancy_length_intermediate_rent"
@depends_on = [{ "tenancy_type_fixed_term?" => true, "affordable_or_social_rent?" => false, "needstype" => 1 }]
end

1
app/models/form/lettings/pages/tenancy_length_periodic.rb

@ -2,6 +2,7 @@ class Form::Lettings::Pages::TenancyLengthPeriodic < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "tenancy_length_periodic"
@copy_key = "lettings.tenancy_information.tenancylength.tenancy_length_periodic"
@depends_on = [{ "tenancy_type_periodic?" => true }]
end

1
app/models/form/lettings/pages/tenancy_type.rb

@ -2,6 +2,7 @@ class Form::Lettings::Pages::TenancyType < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "tenancy_type"
@copy_key = "lettings.tenancy_information.tenancy.tenancy_type"
@depends_on = [{ "starter_tenancy?" => false }]
end

1
app/models/form/lettings/pages/uprn.rb

@ -2,6 +2,7 @@ class Form::Lettings::Pages::Uprn < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "uprn"
@copy_key = "lettings.property_information.uprn"
@depends_on = [{ "is_supported_housing?" => false }]
end

1
app/models/form/lettings/pages/uprn_selection.rb

@ -2,7 +2,6 @@ class Form::Lettings::Pages::UprnSelection < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "uprn_selection"
@header = "We found some addresses that might be this property"
@depends_on = [
{ "is_supported_housing?" => false, "uprn_known" => nil, "address_options_present?" => true },
{ "is_supported_housing?" => false, "uprn_known" => 0, "address_options_present?" => true },

1
app/models/form/lettings/pages/void_date.rb

@ -2,7 +2,6 @@ class Form::Lettings::Pages::VoidDate < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "void_date"
@header = "Void date"
@depends_on = [{ "is_renewal?" => false }]
end

3
app/models/form/lettings/questions/address_line1.rb

@ -2,11 +2,10 @@ class Form::Lettings::Questions::AddressLine1 < ::Form::Question
def initialize(id, hsh, page)
super
@id = "address_line1"
@header = "Address line 1"
@copy_key = "lettings.property_information.address.address_line1"
@error_label = "Address line 1"
@type = "text"
@plain_label = true
@check_answer_label = "Address lines 1 and 2"
@disable_clearing_if_not_routed_or_dynamic_answer_options = true
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
@hide_question_number_on_page = true

3
app/models/form/lettings/questions/address_line1_for_address_matcher.rb

@ -2,11 +2,10 @@ class Form::Lettings::Questions::AddressLine1ForAddressMatcher < ::Form::Questio
def initialize(id, hsh, page)
super
@id = "address_line1_input"
@header = "Address line 1"
@copy_key = "lettings.property_information.address_matcher.address_line1_input"
@error_label = "Address line 1"
@type = "text"
@plain_label = true
@check_answer_label = "Find address"
@disable_clearing_if_not_routed_or_dynamic_answer_options = true
@hide_question_number_on_page = true
end

2
app/models/form/lettings/questions/address_line2.rb

@ -2,7 +2,7 @@ class Form::Lettings::Questions::AddressLine2 < ::Form::Question
def initialize(id, hsh, page)
super
@id = "address_line2"
@header = "Address line 2 (optional)"
@copy_key = "lettings.property_information.address.address_line2"
@type = "text"
@plain_label = true
@disable_clearing_if_not_routed_or_dynamic_answer_options = true

8
app/models/form/lettings/questions/age.rb

@ -1,9 +1,8 @@
class Form::Lettings::Questions::Age < ::Form::Question
def initialize(id, hsh, page, person_index:, person_type:)
def initialize(id, hsh, page, person_index:)
super(id, hsh, page)
@id = "age#{person_index}"
@check_answer_label = "Person #{person_index}’s age"
@header = "Age"
@copy_key = "lettings.household_characteristics.age#{person_index}.age#{person_index}"
@type = "numeric"
@width = 2
@inferred_check_answers_value = [{ "condition" => { "age#{person_index}_known" => 1 }, "value" => "Not known" }]
@ -13,7 +12,6 @@ class Form::Lettings::Questions::Age < ::Form::Question
@step = 1
@person_index = person_index
@question_number = question_number
@person_type = person_type
@hint_text = hint_text
end
@ -31,8 +29,6 @@ class Form::Lettings::Questions::Age < ::Form::Question
def hint_text
if form.start_year_after_2024?
"Answer 1 for children aged under 1 year old"
elsif @person_type == "child"
"For a child under 1, enter 1"
end
end
end

3
app/models/form/lettings/questions/age1.rb

@ -2,8 +2,7 @@ class Form::Lettings::Questions::Age1 < ::Form::Question
def initialize(id, hsh, page)
super
@id = "age1"
@check_answer_label = "Lead tenant’s age"
@header = "Age"
@copy_key = "lettings.household_characteristics.age1.age1"
@type = "numeric"
@width = 2
@inferred_check_answers_value = [{ "condition" => { "age1_known" => 1 }, "value" => "Not known" }]

11
app/models/form/lettings/questions/age1_known.rb

@ -2,8 +2,7 @@ class Form::Lettings::Questions::Age1Known < ::Form::Question
def initialize(id, hsh, page)
super
@id = "age1_known"
@check_answer_label = ""
@header = "Do you know the lead tenant’s age?"
@copy_key = "lettings.household_characteristics.age1.age1_known"
@type = "radio"
@check_answers_card_number = 1
@answer_options = ANSWER_OPTIONS
@ -14,13 +13,5 @@ class Form::Lettings::Questions::Age1Known < ::Form::Question
ANSWER_OPTIONS = { "0" => { "value" => "Yes" }, "1" => { "value" => "No" } }.freeze
def hint_text
if form.start_year_after_2024?
"The ’lead’ or ’main’ tenant is the person in the household who does the most paid work. If several people do the same amount of paid work, the lead tenant is whoever is the oldest."
else
"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."
end
end
QUESTION_NUMBER_FROM_YEAR = { 2023 => 32, 2024 => 31 }.freeze
end

4
app/models/form/lettings/questions/age_known.rb

@ -2,11 +2,9 @@ class Form::Lettings::Questions::AgeKnown < ::Form::Question
def initialize(id, hsh, page, person_index:)
super(id, hsh, page)
@id = "age#{person_index}_known"
@check_answer_label = ""
@header = "Do you know person #{person_index}’s age?"
@copy_key = "lettings.household_characteristics.age#{person_index}.age#{person_index}_known"
@type = "radio"
@check_answers_card_number = person_index
@hint_text = ""
@answer_options = ANSWER_OPTIONS
@conditional_for = { "age#{person_index}" => [0] }
@hidden_in_check_answers = {

6
app/models/form/lettings/questions/beds.rb

@ -2,8 +2,6 @@ class Form::Lettings::Questions::Beds < ::Form::Question
def initialize(id, hsh, page)
super
@id = "beds"
@check_answer_label = "Number of bedrooms"
@header = "How many bedrooms does the property have?"
@type = "numeric"
@width = 2
@check_answers_card_number = 0
@ -17,9 +15,5 @@ class Form::Lettings::Questions::Beds < ::Form::Question
log.is_bedsit?
end
def hint_text
form.start_year_after_2024? ? "If shared accommodation, enter the number of bedrooms occupied by this household." : "If shared accommodation, enter the number of bedrooms occupied by this household. A bedsit has 1 bedroom."
end
QUESTION_NUMBER_FROM_YEAR = { 2023 => 22 }.freeze
end

3
app/models/form/lettings/questions/benefits.rb

@ -2,11 +2,8 @@ class Form::Lettings::Questions::Benefits < ::Form::Question
def initialize(id, hsh, page)
super
@id = "benefits"
@check_answer_label = "Household income from Universal Credit, state pension or benefits"
@header = "How much of the household’s income is from Universal Credit, state pensions or benefits?"
@type = "radio"
@check_answers_card_number = 0
@hint_text = "This excludes child and housing benefit, council tax support and tax credits."
@answer_options = ANSWER_OPTIONS
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
end

4
app/models/form/lettings/questions/brent_4_weekly.rb

@ -2,13 +2,11 @@ class Form::Lettings::Questions::Brent4Weekly < ::Form::Question
def initialize(id, hsh, page)
super
@id = "brent"
@check_answer_label = "Basic rent"
@header = "What is the basic rent?"
@copy_key = "lettings.income_and_benefits.rent_and_charges.brent"
@type = "numeric"
@width = 5
@check_answers_card_number = 0
@min = 0
@hint_text = "This is the amount paid before any charges are added for services (for example, hot water or cleaning). Households may receive housing benefit or Universal Credit towards basic rent."
@step = 0.01
@fields_to_add = %w[brent scharge pscharge supcharg]
@result_field = "tcharge"

4
app/models/form/lettings/questions/brent_bi_weekly.rb

@ -2,13 +2,11 @@ class Form::Lettings::Questions::BrentBiWeekly < ::Form::Question
def initialize(id, hsh, page)
super
@id = "brent"
@check_answer_label = "Basic rent"
@header = "What is the basic rent?"
@copy_key = "lettings.income_and_benefits.rent_and_charges.brent"
@type = "numeric"
@width = 5
@check_answers_card_number = 0
@min = 0
@hint_text = "This is the amount paid before any charges are added for services (for example, hot water or cleaning). Households may receive housing benefit or Universal Credit towards basic rent."
@step = 0.01
@fields_to_add = %w[brent scharge pscharge supcharg]
@result_field = "tcharge"

4
app/models/form/lettings/questions/brent_monthly.rb

@ -2,13 +2,11 @@ class Form::Lettings::Questions::BrentMonthly < ::Form::Question
def initialize(id, hsh, page)
super
@id = "brent"
@check_answer_label = "Basic rent"
@header = "What is the basic rent?"
@copy_key = "lettings.income_and_benefits.rent_and_charges.brent"
@type = "numeric"
@width = 5
@check_answers_card_number = 0
@min = 0
@hint_text = "This is the amount paid before any charges are added for services (for example, hot water or cleaning). Households may receive housing benefit or Universal Credit towards basic rent."
@step = 0.01
@fields_to_add = %w[brent scharge pscharge supcharg]
@result_field = "tcharge"

4
app/models/form/lettings/questions/brent_weekly.rb

@ -2,13 +2,11 @@ class Form::Lettings::Questions::BrentWeekly < ::Form::Question
def initialize(id, hsh, page)
super
@id = "brent"
@check_answer_label = "Basic rent"
@header = "What is the basic rent?"
@copy_key = "lettings.income_and_benefits.rent_and_charges.brent"
@type = "numeric"
@width = 5
@check_answers_card_number = 0
@min = 0
@hint_text = "This is the amount paid before any charges are added for services (for example, hot water or cleaning). Households may receive housing benefit or Universal Credit towards basic rent."
@step = 0.01
@fields_to_add = %w[brent scharge pscharge supcharg]
@result_field = "tcharge"

3
app/models/form/lettings/questions/builtype.rb

@ -2,11 +2,8 @@ class Form::Lettings::Questions::Builtype < ::Form::Question
def initialize(id, hsh, page)
super
@id = "builtype"
@check_answer_label = "Type of building"
@header = "What type of building is the property?"
@type = "radio"
@check_answers_card_number = 0
@hint_text = ""
@answer_options = ANSWER_OPTIONS
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
end

4
app/models/form/lettings/questions/chcharge_4_weekly.rb

@ -2,12 +2,10 @@ class Form::Lettings::Questions::Chcharge4Weekly < ::Form::Question
def initialize(id, hsh, page)
super
@id = "chcharge"
@check_answer_label = "Care home charges"
@header = "How much does the household pay every 4 weeks?"
@copy_key = "lettings.income_and_benefits.care_home.chcharge_4_weekly"
@type = "numeric"
@width = 5
@check_answers_card_number = 0
@hint_text = ""
@step = 0.01
@prefix = "£"
@suffix = " every 4 weeks"

4
app/models/form/lettings/questions/chcharge_bi_weekly.rb

@ -2,12 +2,10 @@ class Form::Lettings::Questions::ChchargeBiWeekly < ::Form::Question
def initialize(id, hsh, page)
super
@id = "chcharge"
@check_answer_label = "Care home charges"
@header = "How much does the household pay every 2 weeks?"
@copy_key = "lettings.income_and_benefits.care_home.chcharge_bi_weekly"
@type = "numeric"
@width = 5
@check_answers_card_number = 0
@hint_text = ""
@step = 0.01
@prefix = "£"
@suffix = " every 2 weeks"

4
app/models/form/lettings/questions/chcharge_monthly.rb

@ -2,12 +2,10 @@ class Form::Lettings::Questions::ChchargeMonthly < ::Form::Question
def initialize(id, hsh, page)
super
@id = "chcharge"
@check_answer_label = "Care home charges"
@header = "How much does the household pay every month?"
@copy_key = "lettings.income_and_benefits.care_home.chcharge_monthly"
@type = "numeric"
@width = 5
@check_answers_card_number = 0
@hint_text = ""
@step = 0.01
@prefix = "£"
@suffix = " every month"

4
app/models/form/lettings/questions/chcharge_weekly.rb

@ -2,12 +2,10 @@ class Form::Lettings::Questions::ChchargeWeekly < ::Form::Question
def initialize(id, hsh, page)
super
@id = "chcharge"
@check_answer_label = "Care home charges"
@header = "How much does the household pay every week?"
@copy_key = "lettings.income_and_benefits.care_home.chcharge_weekly"
@type = "numeric"
@width = 5
@check_answers_card_number = 0
@hint_text = ""
@step = 0.01
@prefix = "£"
@suffix = " every week"

3
app/models/form/lettings/questions/county.rb

@ -2,10 +2,9 @@ class Form::Lettings::Questions::County < ::Form::Question
def initialize(id, hsh, page)
super
@id = "county"
@header = "County (optional)"
@copy_key = "lettings.property_information.address.county"
@type = "text"
@plain_label = true
@check_answer_label = "County"
@disable_clearing_if_not_routed_or_dynamic_answer_options = true
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
@hide_question_number_on_page = true

4
app/models/form/lettings/questions/declaration.rb

@ -2,11 +2,9 @@ class Form::Lettings::Questions::Declaration < ::Form::Question
def initialize(id, hsh, page)
super
@id = "declaration"
@check_answer_label = "Tenant has seen the privacy notice"
@header = "Declaration"
@type = "checkbox"
@check_answers_card_number = 0 unless form.start_year_after_2024?
@top_guidance_partial = form.start_year_after_2024? ? "privacy_notice_tenant_2024" : "privacy_notice_tenant"
@top_guidance_partial = "privacy_notice_tenant"
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
end

3
app/models/form/lettings/questions/details_known.rb

@ -2,11 +2,8 @@ class Form::Lettings::Questions::DetailsKnown < ::Form::Question
def initialize(id, hsh, page, person_index:)
super(id, hsh, page)
@id = "details_known_#{person_index}"
@check_answer_label = "Details known for person #{person_index}"
@header = "Do you know details for person #{person_index}?"
@type = "radio"
@check_answers_card_number = person_index
@hint_text = "You must provide details for everyone in the household if you know them."
@answer_options = ANSWER_OPTIONS
end

4
app/models/form/lettings/questions/earnings.rb

@ -2,14 +2,12 @@ class Form::Lettings::Questions::Earnings < ::Form::Question
def initialize(id, hsh, page)
super
@id = "earnings"
@check_answer_label = "Total household income"
@header = "How much income does the household have in total?"
@copy_key = "lettings.income_and_benefits.income_amount.earnings"
@type = "numeric"
@width = 5
@check_answers_card_number = 0
@min = 0
@top_guidance_partial = "what_counts_as_income"
@hint_text = ""
@step = 0.01
@prefix = "£"
@suffix = [

4
app/models/form/lettings/questions/ethnic_arab.rb

@ -2,11 +2,9 @@ class Form::Lettings::Questions::EthnicArab < ::Form::Question
def initialize(id, hsh, page)
super
@id = "ethnic"
@check_answer_label = "Lead tenant’s ethnic background"
@header = "Which of the following best describes the lead tenant’s Arab background?"
@copy_key = "lettings.household_characteristics.ethnic.ethnic_background_arab"
@type = "radio"
@check_answers_card_number = 1
@hint_text = form.start_year_after_2024? ? "" : "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."
@answer_options = ANSWER_OPTIONS
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
end

4
app/models/form/lettings/questions/ethnic_asian.rb

@ -2,11 +2,9 @@ class Form::Lettings::Questions::EthnicAsian < ::Form::Question
def initialize(id, hsh, page)
super
@id = "ethnic"
@check_answer_label = "Lead tenant’s ethnic background"
@header = "Which of the following best describes the lead tenant’s Asian or Asian British background?"
@copy_key = "lettings.household_characteristics.ethnic.ethnic_background_asian"
@type = "radio"
@check_answers_card_number = 1
@hint_text = form.start_year_after_2024? ? "" : "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."
@answer_options = ANSWER_OPTIONS
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
end

4
app/models/form/lettings/questions/ethnic_black.rb

@ -2,11 +2,9 @@ class Form::Lettings::Questions::EthnicBlack < ::Form::Question
def initialize(id, hsh, page)
super
@id = "ethnic"
@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?"
@copy_key = "lettings.household_characteristics.ethnic.ethnic_background_black"
@type = "radio"
@check_answers_card_number = 1
@hint_text = form.start_year_after_2024? ? "" : "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."
@answer_options = ANSWER_OPTIONS
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
end

3
app/models/form/lettings/questions/ethnic_group.rb

@ -2,11 +2,8 @@ class Form::Lettings::Questions::EthnicGroup < ::Form::Question
def initialize(id, hsh, page)
super
@id = "ethnic_group"
@check_answer_label = "Lead tenant’s ethnic group"
@header = "What is the lead tenant’s ethnic group?"
@type = "radio"
@check_answers_card_number = 1
@hint_text = form.start_year_after_2024? ? "" : "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."
@answer_options = ANSWER_OPTIONS
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
end

4
app/models/form/lettings/questions/ethnic_mixed.rb

@ -2,11 +2,9 @@ class Form::Lettings::Questions::EthnicMixed < ::Form::Question
def initialize(id, hsh, page)
super
@id = "ethnic"
@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?"
@copy_key = "lettings.household_characteristics.ethnic.ethnic_background_mixed"
@type = "radio"
@check_answers_card_number = 1
@hint_text = form.start_year_after_2024? ? "" : "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."
@answer_options = ANSWER_OPTIONS
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
end

4
app/models/form/lettings/questions/ethnic_white.rb

@ -2,11 +2,9 @@ class Form::Lettings::Questions::EthnicWhite < ::Form::Question
def initialize(id, hsh, page)
super
@id = "ethnic"
@check_answer_label = "Lead tenant’s ethnic background"
@header = "Which of the following best describes the lead tenant’s White background?"
@copy_key = "lettings.household_characteristics.ethnic.ethnic_background_white"
@type = "radio"
@check_answers_card_number = 1
@hint_text = form.start_year_after_2024? ? "" : "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."
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
end

3
app/models/form/lettings/questions/first_time_property_let_as_social_housing.rb

@ -2,11 +2,8 @@ class Form::Lettings::Questions::FirstTimePropertyLetAsSocialHousing < ::Form::Q
def initialize(id, hsh, page)
super
@id = "first_time_property_let_as_social_housing"
@check_answer_label = "First time being let as social-housing?"
@header = "Is this the first time the property has been let as social housing?"
@type = "radio"
@check_answers_card_number = 0
@hint_text = ""
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
end

10
app/models/form/lettings/questions/gender_identity1.rb

@ -2,8 +2,6 @@ class Form::Lettings::Questions::GenderIdentity1 < ::Form::Question
def initialize(id, hsh, page)
super
@id = "sex1"
@check_answer_label = "Lead tenant’s gender identity"
@header = "Which of these best describes the lead tenant’s gender identity?"
@type = "radio"
@check_answers_card_number = 1
@answer_options = ANSWER_OPTIONS
@ -18,13 +16,5 @@ class Form::Lettings::Questions::GenderIdentity1 < ::Form::Question
"R" => { "value" => "Tenant prefers not to say" },
}.freeze
def hint_text
if form.start_year_after_2024?
"This should be however they personally choose to identify from the options below. This may or may not be the same as their biological sex or the sex they were assigned at birth."
else
"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."
end
end
QUESTION_NUMBER_FROM_YEAR = { 2023 => 33, 2024 => 32 }.freeze
end

3
app/models/form/lettings/questions/hb.rb

@ -2,11 +2,8 @@ class Form::Lettings::Questions::Hb < ::Form::Question
def initialize(id, hsh, page)
super
@id = "hb"
@check_answer_label = "Housing-related benefits received"
@header = "Is the household likely to be receiving any of these housing-related benefits?"
@type = "radio"
@check_answers_card_number = 0
@hint_text = form.start_year_after_2024? ? "This is about when the tenant is in their new let. If they are unsure about the situation for their new let and their financial and working situation hasn’t changed significantly, answer based on what housing-related benefits they currently receive." : ""
@answer_options = ANSWER_OPTIONS
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
end

3
app/models/form/lettings/questions/hbrentshortfall.rb

@ -2,11 +2,8 @@ class Form::Lettings::Questions::Hbrentshortfall < ::Form::Question
def initialize(id, hsh, page)
super
@id = "hbrentshortfall"
@check_answer_label = "Any outstanding amount for basic rent and charges"
@header = "After the household has received any housing-related benefits, will they still need to pay for rent and charges?"
@type = "radio"
@check_answers_card_number = 0
@hint_text = "Also known as the ‘outstanding amount’."
@answer_options = ANSWER_OPTIONS
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
end

3
app/models/form/lettings/questions/hhmemb.rb

@ -2,14 +2,11 @@ class Form::Lettings::Questions::Hhmemb < ::Form::Question
def initialize(id, hsh, page)
super
@id = "hhmemb"
@check_answer_label = "Number of household members"
@header = "How many people live in the household for this letting?"
@type = "numeric"
@width = 2
@check_answers_card_number = 0
@max = 8
@min = 1
@hint_text = "You can provide details for a maximum of 8 people."
@step = 1
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
end

3
app/models/form/lettings/questions/homeless.rb

@ -2,11 +2,8 @@ class Form::Lettings::Questions::Homeless < ::Form::Question
def initialize(id, hsh, page)
super
@id = "homeless"
@check_answer_label = "Household homeless immediately before letting"
@header = "Did the household experience homelessness immediately before this letting?"
@type = "radio"
@check_answers_card_number = 0
@hint_text = ""
@answer_options = ANSWER_OPTIONS
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
end

3
app/models/form/lettings/questions/household_charge.rb

@ -2,11 +2,8 @@ class Form::Lettings::Questions::HouseholdCharge < ::Form::Question
def initialize(id, hsh, page)
super
@id = "household_charge"
@check_answer_label = "Does the household pay rent or charges?"
@header = "Does the household pay rent or other charges for the accommodation?"
@type = "radio"
@check_answers_card_number = 0
@hint_text = "If rent is charged on the property then answer Yes to this question, even if the tenants do not pay it themselves."
@answer_options = ANSWER_OPTIONS
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
end

4
app/models/form/lettings/questions/incfreq.rb

@ -2,11 +2,9 @@ class Form::Lettings::Questions::Incfreq < ::Form::Question
def initialize(id, hsh, page)
super
@id = "incfreq"
@check_answer_label = "How often does the household receive this amount?"
@header = "How often does the household receive this amount?"
@copy_key = "lettings.income_and_benefits.income_amount.incfreq"
@type = "radio"
@check_answers_card_number = 0
@hint_text = ""
@answer_options = ANSWER_OPTIONS
@hidden_in_check_answers = true
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]

4
app/models/form/lettings/questions/is_carehome.rb

@ -2,11 +2,9 @@ class Form::Lettings::Questions::IsCarehome < ::Form::Question
def initialize(id, hsh, page)
super
@id = "is_carehome"
@check_answer_label = "Care home accommodation"
@header = "Is this accommodation a care home?"
@copy_key = "lettings.income_and_benefits.care_home.is_carehome"
@type = "radio"
@check_answers_card_number = 0
@hint_text = ""
@conditional_for = { "chcharge" => [1] }
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
end

3
app/models/form/lettings/questions/joint.rb

@ -2,11 +2,8 @@ class Form::Lettings::Questions::Joint < ::Form::Question
def initialize(id, hsh, page)
super
@id = "joint"
@check_answer_label = "Is this a joint tenancy?"
@header = "Is this a joint tenancy?"
@type = "radio"
@check_answers_card_number = 0
@hint_text = form.start_year_after_2024? ? "This is where two or more people are named on the tenancy agreement" : ""
@answer_options = ANSWER_OPTIONS
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
end

2
app/models/form/lettings/questions/la.rb

@ -2,8 +2,6 @@ class Form::Lettings::Questions::La < ::Form::Question
def initialize(id, hsh, page)
super
@id = "la"
@check_answer_label = "Local Authority"
@header = "What is the property’s local authority?"
@type = "select"
@check_answers_card_number = nil
@hint_text = ""

3
app/models/form/lettings/questions/layear.rb

@ -2,11 +2,8 @@ class Form::Lettings::Questions::Layear < ::Form::Question
def initialize(id, hsh, page)
super
@id = "layear"
@check_answer_label = "Length of time in local authority area"
@header = "How long has the household continuously lived in the local authority area of the new letting?"
@type = "radio"
@check_answers_card_number = 0
@hint_text = ""
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
end

3
app/models/form/lettings/questions/letting_allocation.rb

@ -2,11 +2,8 @@ class Form::Lettings::Questions::LettingAllocation < ::Form::Question
def initialize(id, hsh, page)
super
@id = "letting_allocation"
@check_answer_label = "Allocation system"
@header = "How was this letting allocated?"
@type = "checkbox"
@check_answers_card_number = 0
@hint_text = "Select all that apply."
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
end

4
app/models/form/lettings/questions/majorrepairs.rb

@ -2,11 +2,9 @@ class Form::Lettings::Questions::Majorrepairs < ::Form::Question
def initialize(id, hsh, page)
super
@id = "majorrepairs"
@check_answer_label = "Major repairs carried out during void period"
@header = "Were any major repairs carried out during the void period?"
@copy_key = "lettings.property_information.property_major_repairs.majorrepairs"
@type = "radio"
@check_answers_card_number = 0
@hint_text = "Major repairs are works that could not be reasonably carried out with a tenant living at the property. For example, structural repairs."
@answer_options = ANSWER_OPTIONS
@conditional_for = { "mrcdate" => [1] }
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]

15
app/models/form/lettings/questions/max_rent_value_check.rb

@ -1,15 +0,0 @@
class Form::Lettings::Questions::MaxRentValueCheck < ::Form::Question
def initialize(id, hsh, page, check_answers_card_number:)
super(id, hsh, page)
@id = "rent_value_check"
@check_answer_label = "Total rent confirmation"
@header = "Are you sure this is correct?"
@type = "interruption_screen"
@hint_text = I18n.t("soft_validations.rent.hint_text", higher_or_lower: "higher")
@check_answers_card_number = check_answers_card_number
@answer_options = ANSWER_OPTIONS
@hidden_in_check_answers = { "depends_on" => [{ "rent_value_check" => 0 }, { "rent_value_check" => 1 }] }
end
ANSWER_OPTIONS = { "0" => { "value" => "Yes" }, "1" => { "value" => "No" } }.freeze
end

3
app/models/form/lettings/questions/mrcdate.rb

@ -2,8 +2,7 @@ class Form::Lettings::Questions::Mrcdate < ::Form::Question
def initialize(id, hsh, page)
super
@id = "mrcdate"
@check_answer_label = "Completion date of repairs"
@header = "When were the repairs completed?"
@copy_key = "lettings.property_information.property_major_repairs.mrcdate"
@type = "date"
@check_answers_card_number = 0
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]

3
app/models/form/lettings/questions/nationality.rb

@ -2,11 +2,8 @@ class Form::Lettings::Questions::Nationality < ::Form::Question
def initialize(id, hsh, page)
super
@id = "national"
@check_answer_label = "Lead tenant’s nationality"
@header = "What is the nationality of the lead tenant?"
@type = "radio"
@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."
@answer_options = ANSWER_OPTIONS
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
end

3
app/models/form/lettings/questions/nationality_all.rb

@ -2,8 +2,7 @@ class Form::Lettings::Questions::NationalityAll < ::Form::Question
def initialize(id, hsh, page)
super
@id = "nationality_all"
@check_answer_label = "Lead tenant’s nationality"
@header = "Enter a nationality"
@copy_key = "lettings.household_characteristics.nationality_all.nationality_all"
@type = "select"
@check_answers_card_number = 1
@answer_options = GlobalConstants::COUNTRIES_ANSWER_OPTIONS

4
app/models/form/lettings/questions/nationality_all_group.rb

@ -2,11 +2,9 @@ class Form::Lettings::Questions::NationalityAllGroup < ::Form::Question
def initialize(id, hsh, page)
super
@id = "nationality_all_group"
@check_answer_label = "Lead tenant’s nationality"
@header = "What is the nationality of the lead tenant?"
@copy_key = "lettings.household_characteristics.nationality_all.nationality_all_group"
@type = "radio"
@check_answers_card_number = 1
@hint_text = "If the lead tenant is a dual national of the United Kingdom and another country, enter United Kingdom. If they are a dual national of two other countries, the tenant should decide which country to enter."
@answer_options = ANSWER_OPTIONS
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
@conditional_for = { "nationality_all" => [12] }

3
app/models/form/lettings/questions/net_income_known.rb

@ -2,12 +2,9 @@ class Form::Lettings::Questions::NetIncomeKnown < ::Form::Question
def initialize(id, hsh, page)
super
@id = "net_income_known"
@check_answer_label = "Do you know the household’s combined total income after tax?"
@header = "Do you know the household’s combined income after tax?"
@type = "radio"
@check_answers_card_number = 0
@top_guidance_partial = "what_counts_as_income"
@hint_text = ""
@answer_options = ANSWER_OPTIONS
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
end

2
app/models/form/lettings/questions/offered.rb

@ -2,8 +2,6 @@ class Form::Lettings::Questions::Offered < ::Form::Question
def initialize(id, hsh, page)
super
@id = "offered"
@check_answer_label = I18n.t("check_answer_labels.offered")
@header = I18n.t("questions.offered")
@type = "numeric"
@width = 2
@check_answers_card_number = 0

3
app/models/form/lettings/questions/period.rb

@ -2,11 +2,8 @@ class Form::Lettings::Questions::Period < ::Form::Question
def initialize(id, hsh, page)
super
@id = "period"
@check_answer_label = "Frequency of household rent and charges"
@header = "How often does the household pay rent and other charges?"
@type = "radio"
@check_answers_card_number = 0
@hint_text = "Select how often the household is charged. This may be different to how often they pay."
@answer_options = ANSWER_OPTIONS
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
end

10
app/models/form/lettings/questions/person_gender_identity.rb

@ -2,8 +2,6 @@ class Form::Lettings::Questions::PersonGenderIdentity < ::Form::Question
def initialize(id, hsh, page, person_index:)
super(id, hsh, page)
@id = "sex#{person_index}"
@check_answer_label = "Person #{person_index}’s gender identity"
@header = "Which of these best describes person #{person_index}’s gender identity?"
@type = "radio"
@check_answers_card_number = person_index
@answer_options = ANSWER_OPTIONS
@ -19,14 +17,6 @@ class Form::Lettings::Questions::PersonGenderIdentity < ::Form::Question
"R" => { "value" => "Person prefers not to say" },
}.freeze
def hint_text
if form.start_year_after_2024?
"This should be however they personally choose to identify from the options below. This may or may not be the same as their biological sex or the sex they were assigned at birth."
else
""
end
end
def question_number
base_question_number = case form.start_date.year
when 2023

3
app/models/form/lettings/questions/person_relationship.rb

@ -2,11 +2,8 @@ class Form::Lettings::Questions::PersonRelationship < ::Form::Question
def initialize(id, hsh, page, person_index:)
super(id, hsh, page)
@id = "relat#{person_index}"
@check_answer_label = "Person #{person_index}’s relationship to the lead tenant"
@header = "What is person #{person_index}’s relationship to the lead tenant?"
@type = "radio"
@check_answers_card_number = person_index
@hint_text = ""
@answer_options = answer_options
@person_index = person_index
@question_number = question_number

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save