diff --git a/app/models/form/sales/questions/mortgage_lender.rb b/app/models/form/sales/questions/mortgage_lender.rb index 1fee10b8b..ad584aab5 100644 --- a/app/models/form/sales/questions/mortgage_lender.rb +++ b/app/models/form/sales/questions/mortgage_lender.rb @@ -56,8 +56,55 @@ class Form::Sales::Questions::MortgageLender < ::Form::Question "38" => "West Bromwich Building Society", "39" => "Yorkshire Building Society", "40" => "Other", + "0" => "Don’t know", }.freeze + def displayed_answer_options(_log, _user = nil) + { + "" => "Select an option", + "1" => "Atom Bank", + "2" => "Barclays Bank PLC", + "3" => "Bath Building Society", + "4" => "Buckinghamshire Building Society", + "5" => "Cambridge Building Society", + "6" => "Coventry Building Society", + "7" => "Cumberland Building Society", + "8" => "Darlington Building Society", + "9" => "Dudley Building Society", + "10" => "Ecology Building Society", + "11" => "Halifax", + "12" => "Hanley Economic Building Society", + "13" => "Hinckley and Rugby Building Society", + "14" => "Holmesdale Building Society", + "15" => "Ipswich Building Society", + "16" => "Leeds Building Society", + "17" => "Lloyds Bank", + "18" => "Mansfield Building Society", + "19" => "Market Harborough Building Society", + "20" => "Melton Mowbray Building Society", + "21" => "Nationwide Building Society", + "22" => "Natwest", + "23" => "Nedbank Private Wealth", + "24" => "Newbury Building Society", + "25" => "OneSavings Bank", + "26" => "Parity Trust", + "27" => "Penrith Building Society", + "28" => "Pepper Homeloans", + "29" => "Royal Bank of Scotland", + "30" => "Santander", + "31" => "Skipton Building Society", + "32" => "Teachers Building Society", + "33" => "The Co-operative Bank", + "34" => "Tipton & Coseley Building Society", + "35" => "TSB", + "36" => "Ulster Bank", + "37" => "Virgin Money", + "38" => "West Bromwich Building Society", + "39" => "Yorkshire Building Society", + "40" => "Other", + } + end + def question_number case @ownershipsch when 1 diff --git a/app/models/sales_log.rb b/app/models/sales_log.rb index 5b0d8f17c..ba2ea4fa8 100644 --- a/app/models/sales_log.rb +++ b/app/models/sales_log.rb @@ -42,7 +42,7 @@ class SalesLog < Log } scope :filter_by_organisation, ->(org, _user = nil) { where(owning_organisation: org) } - OPTIONAL_FIELDS = %w[saledate_check purchid monthly_charges_value_check old_persons_shared_ownership_value_check mortgagelender othtype discounted_sale_value_check].freeze + OPTIONAL_FIELDS = %w[saledate_check purchid monthly_charges_value_check old_persons_shared_ownership_value_check othtype discounted_sale_value_check].freeze RETIREMENT_AGES = { "M" => 65, "F" => 60, "X" => 65 }.freeze def lettings? diff --git a/spec/models/form/sales/questions/mortgage_lender_spec.rb b/spec/models/form/sales/questions/mortgage_lender_spec.rb index 84caef701..811746dbe 100644 --- a/spec/models/form/sales/questions/mortgage_lender_spec.rb +++ b/spec/models/form/sales/questions/mortgage_lender_spec.rb @@ -42,6 +42,53 @@ RSpec.describe Form::Sales::Questions::MortgageLender, type: :model do it "has the correct answer_options" do expect(question.answer_options).to eq({ + "" => "Select an option", + "0" => "Don’t know", + "1" => "Atom Bank", + "2" => "Barclays Bank PLC", + "3" => "Bath Building Society", + "4" => "Buckinghamshire Building Society", + "5" => "Cambridge Building Society", + "6" => "Coventry Building Society", + "7" => "Cumberland Building Society", + "8" => "Darlington Building Society", + "9" => "Dudley Building Society", + "10" => "Ecology Building Society", + "11" => "Halifax", + "12" => "Hanley Economic Building Society", + "13" => "Hinckley and Rugby Building Society", + "14" => "Holmesdale Building Society", + "15" => "Ipswich Building Society", + "16" => "Leeds Building Society", + "17" => "Lloyds Bank", + "18" => "Mansfield Building Society", + "19" => "Market Harborough Building Society", + "20" => "Melton Mowbray Building Society", + "21" => "Nationwide Building Society", + "22" => "Natwest", + "23" => "Nedbank Private Wealth", + "24" => "Newbury Building Society", + "25" => "OneSavings Bank", + "26" => "Parity Trust", + "27" => "Penrith Building Society", + "28" => "Pepper Homeloans", + "29" => "Royal Bank of Scotland", + "30" => "Santander", + "31" => "Skipton Building Society", + "32" => "Teachers Building Society", + "33" => "The Co-operative Bank", + "34" => "Tipton & Coseley Building Society", + "35" => "TSB", + "36" => "Ulster Bank", + "37" => "Virgin Money", + "38" => "West Bromwich Building Society", + "39" => "Yorkshire Building Society", + "40" => "Other", + }) + end + + it "has the correct displayed_answer_options" do + expect(question.displayed_answer_options(nil, nil)).to eq({ "" => "Select an option", "1" => "Atom Bank", "2" => "Barclays Bank PLC", diff --git a/spec/models/sales_log_spec.rb b/spec/models/sales_log_spec.rb index d8f4ca5bc..231dc68c4 100644 --- a/spec/models/sales_log_spec.rb +++ b/spec/models/sales_log_spec.rb @@ -59,7 +59,6 @@ RSpec.describe SalesLog, type: :model do purchid monthly_charges_value_check old_persons_shared_ownership_value_check - mortgagelender othtype discounted_sale_value_check proplen @@ -78,7 +77,6 @@ RSpec.describe SalesLog, type: :model do purchid monthly_charges_value_check old_persons_shared_ownership_value_check - mortgagelender othtype discounted_sale_value_check address_line2