Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLDC-3843: Lettings household situation change Q84 question format #2958

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
7 changes: 7 additions & 0 deletions app/models/derived_variables/lettings_log_variables.rb
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,10 @@ def set_derived_fields!
self.is_la_inferred = false
end

if referral_type == 7 || referral_type == 16
self.referral = referral_type
end

reset_address_fields! if is_supported_housing?

set_checkbox_values!
Expand Down Expand Up @@ -208,6 +212,9 @@ def clear_inapplicable_derived_values!
if form.start_year_2024_or_later? && (unittype_gn_changed? && unittype_gn_was == 2)
self.beds = nil
end
if referral_type_changed? && (referral_type_was == 7 || referral_type_was == 16)
self.referral = nil
end
Comment on lines +215 to +217
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What would happen if it changed from 7 to 16? Can it be cleared by routing rules?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a test for this?

end

def get_totelder
Expand Down
11 changes: 11 additions & 0 deletions app/models/form/lettings/pages/referral_direct.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
class Form::Lettings::Pages::ReferralDirect < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "referral_direct"
@depends_on = [{ "referral_type" => 101 }]
end

def questions
@questions ||= [Form::Lettings::Questions::ReferralDirect.new(nil, nil, self)]
end
end
12 changes: 12 additions & 0 deletions app/models/form/lettings/pages/referral_general_needs.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
class Form::Lettings::Pages::ReferralGeneralNeeds < ::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

def questions
@questions ||= [Form::Lettings::Questions::ReferralGeneralNeeds.new(nil, nil, self)]
end
end
Comment on lines +1 to +12
Copy link
Contributor Author

@Dinssa Dinssa Feb 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed the old 2024 referral_prp page & question to referral_general_needs to reuse the name for the new 2025 version.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But the other referral is also used for general needs? Maybe ReferralGeneralNeedsPrp?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok will change it to that

11 changes: 11 additions & 0 deletions app/models/form/lettings/pages/referral_hsc.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
class Form::Lettings::Pages::ReferralHsc < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "referral_hsc"
@depends_on = [{ "referral_type" => 104 }]
end

def questions
@questions ||= [Form::Lettings::Questions::ReferralHsc.new(nil, nil, self)]
end
end
11 changes: 11 additions & 0 deletions app/models/form/lettings/pages/referral_justice.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
class Form::Lettings::Pages::ReferralJustice < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "referral_justice"
@depends_on = [{ "referral_type" => 105 }]
end

def questions
@questions ||= [Form::Lettings::Questions::ReferralJustice.new(nil, nil, self)]
end
end
11 changes: 11 additions & 0 deletions app/models/form/lettings/pages/referral_la.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
class Form::Lettings::Pages::ReferralLa < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "referral_la"
@depends_on = [{ "referral_type" => 102 }]
end

def questions
@questions ||= [Form::Lettings::Questions::ReferralLa.new(nil, nil, self)]
end
end
3 changes: 1 addition & 2 deletions app/models/form/lettings/pages/referral_prp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +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 }]
@depends_on = [{ "referral_type" => 103 }]
end

def questions
Expand Down
10 changes: 10 additions & 0 deletions app/models/form/lettings/pages/referral_type.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class Form::Lettings::Pages::ReferralType < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "referral"
end

def questions
@questions ||= [Form::Lettings::Questions::ReferralType.new(nil, nil, self)]
end
end
26 changes: 26 additions & 0 deletions app/models/form/lettings/questions/referral_direct.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
class Form::Lettings::Questions::ReferralDirect < ::Form::Question
def initialize(id, hsh, page)
super
@id = "referral"
@copy_key = "lettings.household_situation.referral.direct"
@type = "radio"
@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]
end

def answer_options
{
"20" => {
"value" => "Homeless households owed a duty and not on a housing register or waiting list",
},
"2" => {
"value" => "Tenant applied directly for an available property",
},
"8" => {
"value" => "Relocated through official housing mobility scheme",
},
}.freeze
end

QUESTION_NUMBER_FROM_YEAR = { 2025 => 84 }.freeze
end
105 changes: 105 additions & 0 deletions app/models/form/lettings/questions/referral_general_needs.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
class Form::Lettings::Questions::ReferralGeneralNeeds < ::Form::Question
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume this is also just a rename?

def initialize(id, hsh, page)
super
@id = "referral"
@copy_key = "lettings.household_situation.referral.general_needs.prp"
@type = "radio"
@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]
end

def answer_options
if form.start_year_2024_or_later?
{
"1" => {
"value" => "Internal transfer",
"hint" => "Where the tenant has moved to another social property owned by the same landlord.",
},
"2" => {
"value" => "Tenant applied directly (no referral or nomination)",
},
"3" => {
"value" => "Nominated by a local housing authority",
},
"8" => {
"value" => "Re-located through official housing mobility scheme",
},
"10" => {
"value" => "Other social landlord",
},
"9" => {
"value" => "Community learning disability team",
},
"14" => {
"value" => "Community mental health team",
},
"15" => {
"value" => "Health service",
},
"18" => {
"value" => "Police, probation, prison or youth offending team – tenant had custodial sentence",
},
"19" => {
"value" => "Police, probation, prison or youth offending team – no custodial sentence",
},
"7" => {
"value" => "Voluntary agency",
},
"17" => {
"value" => "Children’s Social Care",
},
"16" => {
"value" => "Other",
},
}.freeze
else
{
"1" => {
"value" => "Internal transfer",
"hint" => "Where the tenant has moved to another social property owned by the same landlord.",
},
"2" => {
"value" => "Tenant applied directly (no referral or nomination)",
},
"3" => {
"value" => "Nominated by a local housing authority",
},
"4" => {
"value" => "Referred by local authority housing department",
},
"8" => {
"value" => "Re-located through official housing mobility scheme",
},
"10" => {
"value" => "Other social landlord",
},
"9" => {
"value" => "Community learning disability team",
},
"14" => {
"value" => "Community mental health team",
},
"15" => {
"value" => "Health service",
},
"12" => {
"value" => "Police, probation or prison",
},
"7" => {
"value" => "Voluntary agency",
},
"13" => {
"value" => "Youth offending team",
},
"17" => {
"value" => "Children’s Social Care",
},
"16" => {
"value" => "Other",
},
}.freeze
end
end

QUESTION_NUMBER_FROM_YEAR = { 2023 => 85, 2024 => 84 }.freeze
end
32 changes: 32 additions & 0 deletions app/models/form/lettings/questions/referral_hsc.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
class Form::Lettings::Questions::ReferralHsc < ::Form::Question
def initialize(id, hsh, page)
super
@id = "referral"
@copy_key = "lettings.household_situation.referral.hsc"
@type = "radio"
@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]
end

def answer_options
{
"15" => {
"value" => "Health service",
},
"9" => {
"value" => "Community learning disability team",
},
"14" => {
"value" => "Community mental health team",
},
"24" => {
"value" => "Adult social services",
},
"17" => {
"value" => "Children's social care",
},
}.freeze
end

QUESTION_NUMBER_FROM_YEAR = { 2025 => 84 }.freeze
end
23 changes: 23 additions & 0 deletions app/models/form/lettings/questions/referral_justice.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
class Form::Lettings::Questions::ReferralJustice < ::Form::Question
def initialize(id, hsh, page)
super
@id = "referral"
@copy_key = "lettings.household_situation.referral.justice"
@type = "radio"
@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]
end

def answer_options
{
"18" => {
"value" => "With a custodial sentence",
},
"19" => {
"value" => "No custodial sentence",
},
}.freeze
end

QUESTION_NUMBER_FROM_YEAR = { 2025 => 84 }.freeze
end
29 changes: 29 additions & 0 deletions app/models/form/lettings/questions/referral_la.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
class Form::Lettings::Questions::ReferralLa < ::Form::Question
def initialize(id, hsh, page)
super
@id = "referral"
@copy_key = "lettings.household_situation.referral.la"
@type = "radio"
@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]
end

def answer_options
{
"21" => {
"value" => "Local authority lettings",
},
"3" => {
"value" => "PRP lettings nominated by a local authority",
},
"4" => {
"value" => "PRP support lettings referred by a local authority",
},
"22" => {
"value" => "Other",
},
}.freeze
end

QUESTION_NUMBER_FROM_YEAR = { 2025 => 84 }.freeze
end
Loading
Loading