Browse Source

Rename old referral pages and questions

pull/2958/head
Manny Dinssa 2 months ago
parent
commit
46470842ad
  1. 12
      app/models/form/lettings/pages/referral.rb
  2. 6
      app/models/form/lettings/pages/referral_general_needs.rb
  3. 12
      app/models/form/lettings/pages/referral_general_needs_prp.rb
  4. 11
      app/models/form/lettings/questions/referral_general_needs.rb
  5. 13
      app/models/form/lettings/questions/referral_general_needs_prp.rb
  6. 2
      app/models/form/lettings/subsections/household_situation.rb
  7. 5
      spec/models/form/lettings/questions/referral_general_needs_prp_spec.rb
  8. 3
      spec/models/form/lettings/questions/referral_general_needs_spec.rb

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

@ -1,12 +0,0 @@
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
def questions
@questions ||= [Form::Lettings::Questions::Referral.new(nil, nil, self)]
end
end

6
app/models/form/lettings/pages/referral_general_needs.rb

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

12
app/models/form/lettings/pages/referral_general_needs_prp.rb

@ -0,0 +1,12 @@
class Form::Lettings::Pages::ReferralGeneralNeedsPrp < ::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::ReferralGeneralNeedsPrp.new(nil, nil, self)]
end
end

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

@ -2,7 +2,7 @@ class Form::Lettings::Questions::ReferralGeneralNeeds < ::Form::Question
def initialize(id, hsh, page) def initialize(id, hsh, page)
super super
@id = "referral" @id = "referral"
@copy_key = "lettings.household_situation.referral.general_needs.prp" @copy_key = "lettings.household_situation.referral.general_needs.la"
@type = "radio" @type = "radio"
@check_answers_card_number = 0 @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] @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
@ -18,9 +18,6 @@ class Form::Lettings::Questions::ReferralGeneralNeeds < ::Form::Question
"2" => { "2" => {
"value" => "Tenant applied directly (no referral or nomination)", "value" => "Tenant applied directly (no referral or nomination)",
}, },
"3" => {
"value" => "Nominated by a local housing authority",
},
"8" => { "8" => {
"value" => "Re-located through official housing mobility scheme", "value" => "Re-located through official housing mobility scheme",
}, },
@ -61,12 +58,6 @@ class Form::Lettings::Questions::ReferralGeneralNeeds < ::Form::Question
"2" => { "2" => {
"value" => "Tenant applied directly (no referral or nomination)", "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" => { "8" => {
"value" => "Re-located through official housing mobility scheme", "value" => "Re-located through official housing mobility scheme",
}, },

13
app/models/form/lettings/questions/referral.rb → app/models/form/lettings/questions/referral_general_needs_prp.rb

@ -1,8 +1,8 @@
class Form::Lettings::Questions::Referral < ::Form::Question class Form::Lettings::Questions::ReferralGeneralNeedsPrp < ::Form::Question
def initialize(id, hsh, page) def initialize(id, hsh, page)
super super
@id = "referral" @id = "referral"
@copy_key = "lettings.household_situation.referral.general_needs.la" @copy_key = "lettings.household_situation.referral.general_needs.prp"
@type = "radio" @type = "radio"
@check_answers_card_number = 0 @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] @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
@ -18,6 +18,9 @@ class Form::Lettings::Questions::Referral < ::Form::Question
"2" => { "2" => {
"value" => "Tenant applied directly (no referral or nomination)", "value" => "Tenant applied directly (no referral or nomination)",
}, },
"3" => {
"value" => "Nominated by a local housing authority",
},
"8" => { "8" => {
"value" => "Re-located through official housing mobility scheme", "value" => "Re-located through official housing mobility scheme",
}, },
@ -58,6 +61,12 @@ class Form::Lettings::Questions::Referral < ::Form::Question
"2" => { "2" => {
"value" => "Tenant applied directly (no referral or nomination)", "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" => { "8" => {
"value" => "Re-located through official housing mobility scheme", "value" => "Re-located through official housing mobility scheme",
}, },

2
app/models/form/lettings/subsections/household_situation.rb

@ -38,8 +38,8 @@ class Form::Lettings::Subsections::HouseholdSituation < ::Form::Subsection
] ]
else else
[ [
Form::Lettings::Pages::Referral.new(nil, nil, self),
Form::Lettings::Pages::ReferralGeneralNeeds.new(nil, nil, self), Form::Lettings::Pages::ReferralGeneralNeeds.new(nil, nil, self),
Form::Lettings::Pages::ReferralGeneralNeedsPrp.new(nil, nil, self),
Form::Lettings::Pages::ReferralSupportedHousing.new(nil, nil, self), Form::Lettings::Pages::ReferralSupportedHousing.new(nil, nil, self),
Form::Lettings::Pages::ReferralSupportedHousingPrp.new(nil, nil, self), Form::Lettings::Pages::ReferralSupportedHousingPrp.new(nil, nil, self),
] ]

5
spec/models/form/lettings/questions/referral_spec.rb → spec/models/form/lettings/questions/referral_general_needs_prp_spec.rb

@ -1,6 +1,6 @@
require "rails_helper" require "rails_helper"
RSpec.describe Form::Lettings::Questions::Referral, type: :model do RSpec.describe Form::Lettings::Questions::ReferralGeneralNeedsPrp, type: :model do
subject(:question) { described_class.new(question_id, question_definition, page) } subject(:question) { described_class.new(question_id, question_definition, page) }
let(:question_id) { nil } let(:question_id) { nil }
@ -40,6 +40,8 @@ RSpec.describe Form::Lettings::Questions::Referral, type: :model do
expect(question.answer_options).to eq({ expect(question.answer_options).to eq({
"1" => { "value" => "Internal transfer", "hint" => "Where the tenant has moved to another social property owned by the same landlord." }, "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)" }, "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" }, "8" => { "value" => "Re-located through official housing mobility scheme" },
"10" => { "value" => "Other social landlord" }, "10" => { "value" => "Other social landlord" },
"9" => { "value" => "Community learning disability team" }, "9" => { "value" => "Community learning disability team" },
@ -69,6 +71,7 @@ RSpec.describe Form::Lettings::Questions::Referral, type: :model do
expect(question.answer_options).to eq({ expect(question.answer_options).to eq({
"1" => { "value" => "Internal transfer", "hint" => "Where the tenant has moved to another social property owned by the same landlord." }, "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)" }, "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" }, "8" => { "value" => "Re-located through official housing mobility scheme" },
"10" => { "value" => "Other social landlord" }, "10" => { "value" => "Other social landlord" },
"9" => { "value" => "Community learning disability team" }, "9" => { "value" => "Community learning disability team" },

3
spec/models/form/lettings/questions/referral_general_needs_spec.rb

@ -40,8 +40,6 @@ RSpec.describe Form::Lettings::Questions::ReferralGeneralNeeds, type: :model do
expect(question.answer_options).to eq({ expect(question.answer_options).to eq({
"1" => { "value" => "Internal transfer", "hint" => "Where the tenant has moved to another social property owned by the same landlord." }, "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)" }, "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" }, "8" => { "value" => "Re-located through official housing mobility scheme" },
"10" => { "value" => "Other social landlord" }, "10" => { "value" => "Other social landlord" },
"9" => { "value" => "Community learning disability team" }, "9" => { "value" => "Community learning disability team" },
@ -71,7 +69,6 @@ RSpec.describe Form::Lettings::Questions::ReferralGeneralNeeds, type: :model do
expect(question.answer_options).to eq({ expect(question.answer_options).to eq({
"1" => { "value" => "Internal transfer", "hint" => "Where the tenant has moved to another social property owned by the same landlord." }, "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)" }, "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" }, "8" => { "value" => "Re-located through official housing mobility scheme" },
"10" => { "value" => "Other social landlord" }, "10" => { "value" => "Other social landlord" },
"9" => { "value" => "Community learning disability team" }, "9" => { "value" => "Community learning disability team" },

Loading…
Cancel
Save