Browse Source

CLDC-4169, CLDC-4170, CLDC-4171, CLDC-4172: Remove VRTB discounted ownership type option from question and copy (#3202)

* CLDC-4169: remove VRTB option functionality

* CLDC-4169: remove VRTB option from copy

* CLDC-4169: update tests

* CLDC-4169: copy updates

* CLDC-4169: test updates

* CLDC-4169: test bu file updates

* CLDC-4169: test bu file updates
pull/3208/head^2
Nat Dean-Lewis 6 days ago committed by GitHub
parent
commit
1c4cfe5d1d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 11
      app/models/form/sales/questions/discounted_ownership_type.rb
  2. 4
      app/services/bulk_upload/sales/year2026/row_parser.rb
  3. 1
      config/locales/forms/2026/sales/guidance.en.yml
  4. 6
      config/locales/forms/2026/sales/sale_information.en.yml
  5. 4
      spec/fixtures/files/2026_27_sales_bulk_upload.csv
  6. 2
      spec/models/form/sales/pages/discounted_ownership_type_spec.rb
  7. 24
      spec/models/form/sales/questions/discounted_ownership_type_spec.rb

11
app/models/form/sales/questions/discounted_ownership_type.rb

@ -5,7 +5,7 @@ class Form::Sales::Questions::DiscountedOwnershipType < ::Form::Question
@copy_key = "sales.setup.type.discounted_ownership"
@type = "radio"
@top_guidance_partial = guidance_partial
@answer_options = ANSWER_OPTIONS
@answer_options = form.start_year_2026_or_later? ? ANSWER_OPTIONS_2026_OR_LATER : ANSWER_OPTIONS
@question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
end
@ -19,6 +19,15 @@ class Form::Sales::Questions::DiscountedOwnershipType < ::Form::Question
"22" => { "value" => "Any other equity loan scheme" },
}.freeze
ANSWER_OPTIONS_2026_OR_LATER = {
"8" => { "value" => "Right to Acquire (RTA)" },
"14" => { "value" => "Preserved Right to Buy (PRTB)" },
"9" => { "value" => "Right to Buy (RTB)" },
"29" => { "value" => "Rent to Buy - Full Ownership" },
"21" => { "value" => "Social HomeBuy for outright purchase" },
"22" => { "value" => "Any other equity loan scheme" },
}.freeze
def guidance_partial
"discounted_ownership_type_definitions" if form.start_date.year >= 2023
end

4
app/services/bulk_upload/sales/year2026/row_parser.rb

@ -410,7 +410,7 @@ class BulkUpload::Sales::Year2026::RowParser
validates :field_11,
inclusion: {
in: [8, 9, 14, 21, 22, 27, 29],
in: [8, 9, 14, 21, 22, 29],
if: proc { field_11.present? },
category: :setup,
question: QUESTIONS[:field_11].downcase,
@ -731,7 +731,7 @@ private
end
def rtb_like_sale_type?
[9, 14, 27, 29].include?(field_11)
[9, 14, 29].include?(field_11)
end
def field_mapping_for_errors

1
config/locales/forms/2026/sales/guidance.en.yml

@ -18,7 +18,6 @@ en:
title: "Discounted Ownership Type Definitions"
content: "<p><b>Right to Acquire (RTA):</b> a discounted sale of a property built or purchased after 31 March 1997 to tenants of a private registered provider.</p>
<p><b>Preserved Right to Buy (PRTB):</b> a discounted sale of a property that used to be owned by a council to tenants of a private registered provider.</p>
<p><b>Voluntary Right to Buy (VRTB):</b> a discounted sale to tenants in this PRP owned property, as part of a pilot scheme.</p>
<p><b>Right to Buy (RTB):</b> a discounted sale to tenants in this council owned property.</p>
<p><b>Rent to Buy full ownership:</b> a sale on full ownership terms following a period of discounted rent.</p>
<p><b>Social HomeBuy for outright purchase:</b> a discounted sale to tenants of a private registered provider on full ownership terms.</p>

6
config/locales/forms/2026/sales/sale_information.en.yml

@ -303,8 +303,8 @@ en:
page_header: "About the price of the property"
check_answer_label: "Purchase price"
check_answer_prompt: ""
hint_text: "For all schemes, including Right to Acquire (RTA), Right to Buy (RTB), Voluntary Right to Buy (VRTB) or Preserved Right to Buy (PRTB) sales, enter the full price of the property without any discount"
question_text: "What is the full purchase price?"
hint_text: "For all schemes, including Right to Acquire (RTA), Right to Buy (RTB) or Preserved Right to Buy (PRTB) sales, enter the full price of the property without any discount."
outright_sale:
page_header: "About the price of the property"
check_answer_label: "Purchase price"
@ -316,14 +316,14 @@ en:
page_header: "About the price of the property"
check_answer_label: "Percentage discount"
check_answer_prompt: ""
hint_text: "For Right to Buy (RTB), Preserved Right to Buy (PRTB), and Voluntary Right to Buy (VRTB)</br></br>If discount capped, enter capped %</br></br>If the property is being sold to an existing tenant under the RTB, PRTB, or VRTB schemes, enter the % discount from the full market value that is being given."
hint_text: "For Right to Buy (RTB) and Preserved Right to Buy (PRTB).</br></br>For capped discount, enter capped %.</br></br>If the property is sold to an existing tenant under RTB or PRTB, enter % discount from full market value."
question_text: "What was the percentage discount?"
grant:
page_header: "About the price of the property"
check_answer_label: "Amount of any loan, grant or subsidy"
check_answer_prompt: ""
hint_text: "For all schemes except Right to Buy (RTB), Preserved Right to Buy (PRTB), Voluntary Right to Buy (VRTB) and Rent to Buy"
hint_text: "For all schemes except Right to Buy (RTB), Preserved Right to Buy (PRTB) and Rent to Buy"
question_text: "What was the amount of any loan, grant, discount or subsidy given?"
management_fee:

4
spec/fixtures/files/2026_27_sales_bulk_upload.csv vendored

File diff suppressed because one or more lines are too long

2
spec/models/form/sales/pages/discounted_ownership_type_spec.rb

@ -5,7 +5,7 @@ RSpec.describe Form::Sales::Pages::DiscountedOwnershipType, type: :model do
let(:page_id) { nil }
let(:page_definition) { nil }
let(:subsection) { instance_double(Form::Subsection, form: instance_double(Form, start_date:)) }
let(:subsection) { instance_double(Form::Subsection, form: instance_double(Form, start_date:, start_year_2026_or_later?: true)) }
let(:start_date) { Time.zone.today }
it "has correct subsection" do

24
spec/models/form/sales/questions/discounted_ownership_type_spec.rb

@ -6,8 +6,9 @@ RSpec.describe Form::Sales::Questions::DiscountedOwnershipType, type: :model do
let(:question_id) { nil }
let(:question_definition) { nil }
let(:page) { instance_double(Form::Page, subsection:) }
let(:subsection) { instance_double(Form::Subsection, form: instance_double(Form, start_date:)) }
let(:subsection) { instance_double(Form::Subsection, form: instance_double(Form, start_date:, start_year_2026_or_later?: start_year_2026_or_later)) }
let(:start_date) { Time.zone.today }
let(:start_year_2026_or_later) { true }
it "has correct page" do
expect(question.page).to eq(page)
@ -25,7 +26,10 @@ RSpec.describe Form::Sales::Questions::DiscountedOwnershipType, type: :model do
expect(question.derived?(nil)).to be false
end
it "has the correct answer_options" do
context "when form is for 2025 or earlier" do
let(:start_year_2026_or_later) { false }
it "has the correct answer_options including option 27" do
expect(question.answer_options).to eq({
"8" => { "value" => "Right to Acquire (RTA)" },
"14" => { "value" => "Preserved Right to Buy (PRTB)" },
@ -36,6 +40,22 @@ RSpec.describe Form::Sales::Questions::DiscountedOwnershipType, type: :model do
"22" => { "value" => "Any other equity loan scheme" },
})
end
end
context "when form is for 2026 or later" do
let(:start_year_2026_or_later) { true }
it "has the correct answer_options without option 27" do
expect(question.answer_options).to eq({
"8" => { "value" => "Right to Acquire (RTA)" },
"14" => { "value" => "Preserved Right to Buy (PRTB)" },
"9" => { "value" => "Right to Buy (RTB)" },
"29" => { "value" => "Rent to Buy - Full Ownership" },
"21" => { "value" => "Social HomeBuy for outright purchase" },
"22" => { "value" => "Any other equity loan scheme" },
})
end
end
describe "partial guidance" do
context "when the form is for 2023/24" do

Loading…
Cancel
Save