diff --git a/app/models/derived_variables/sales_log_variables.rb b/app/models/derived_variables/sales_log_variables.rb index 56d687f59..1e7489015 100644 --- a/app/models/derived_variables/sales_log_variables.rb +++ b/app/models/derived_variables/sales_log_variables.rb @@ -1,6 +1,7 @@ module DerivedVariables::SalesLogVariables def set_derived_fields! self.ethnic = 17 if ethnic_refused? + self.mscharge = nil if monthly_leasehold_charges_unknown? if exdate.present? self.exday = exdate.day self.exmonth = exdate.month @@ -12,9 +13,6 @@ module DerivedVariables::SalesLogVariables self.hoyear = hodate.year end self.deposit = value if outright_sale? && mortgage_not_used? - if mscharge_known.present? && mscharge_known.zero? - self.mscharge = 0 - end if mortgage_not_used? self.mortgage = 0 end diff --git a/app/models/form/sales/questions/leasehold_charges_known.rb b/app/models/form/sales/questions/leasehold_charges_known.rb index a800690e4..92370a3ac 100644 --- a/app/models/form/sales/questions/leasehold_charges_known.rb +++ b/app/models/form/sales/questions/leasehold_charges_known.rb @@ -3,7 +3,7 @@ class Form::Sales::Questions::LeaseholdChargesKnown < ::Form::Question super(id, hsh, subsection) @id = "mscharge_known" @check_answer_label = "Monthly leasehold charges known?" - @header = "Does the property have any monthly leasehold charges?" + @header = "Do you know the monthly leasehold charges for the property?" @hint_text = "For example, service and management charges" @type = "radio" @answer_options = ANSWER_OPTIONS diff --git a/app/models/sales_log.rb b/app/models/sales_log.rb index 2a6e1a6d3..721209ee9 100644 --- a/app/models/sales_log.rb +++ b/app/models/sales_log.rb @@ -299,6 +299,10 @@ class SalesLog < Log companybuy == 1 end + def monthly_leasehold_charges_unknown? + mscharge_known&.zero? + end + def buyers_age_for_old_persons_shared_ownership_invalid? return unless old_persons_shared_ownership? diff --git a/spec/models/form/sales/questions/leasehold_charges_known_spec.rb b/spec/models/form/sales/questions/leasehold_charges_known_spec.rb index 64cd08f33..b8d191d3b 100644 --- a/spec/models/form/sales/questions/leasehold_charges_known_spec.rb +++ b/spec/models/form/sales/questions/leasehold_charges_known_spec.rb @@ -16,7 +16,7 @@ RSpec.describe Form::Sales::Questions::LeaseholdChargesKnown, type: :model do end it "has the correct header" do - expect(question.header).to eq("Does the property have any monthly leasehold charges?") + expect(question.header).to eq("Do you know the monthly leasehold charges for the property?") end it "has the correct check_answer_label" do