From 9b5110c175d14e4a3e0de90b8652f675f9856cf1 Mon Sep 17 00:00:00 2001 From: Manny Dinssa <44172848+Dinssa@users.noreply.github.com> Date: Mon, 9 Sep 2024 12:07:29 +0100 Subject: [PATCH] Don't add error message to type twice (#2626) --- app/models/validations/sales/sale_information_validations.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/validations/sales/sale_information_validations.rb b/app/models/validations/sales/sale_information_validations.rb index 8bfa46783..c5febb693 100644 --- a/app/models/validations/sales/sale_information_validations.rb +++ b/app/models/validations/sales/sale_information_validations.rb @@ -299,7 +299,7 @@ module Validations::Sales::SaleInformationValidations return unless record.mortgage if over_tolerance?(record.mortgage_and_deposit_total, record.stairbought_part_of_value, 1) - %i[mortgage value deposit stairbought type].each do |field| + %i[mortgage value deposit stairbought].each do |field| record.errors.add field, I18n.t("validations.sale_information.staircasing_mortgage.mortgage_used", mortgage: record.field_formatted_as_currency("mortgage"), deposit: record.field_formatted_as_currency("deposit"), @@ -315,7 +315,7 @@ module Validations::Sales::SaleInformationValidations stairbought_part_of_value: record.field_formatted_as_currency("stairbought_part_of_value")).html_safe end elsif over_tolerance?(record.deposit, record.stairbought_part_of_value, 1) - %i[mortgageused value deposit stairbought type].each do |field| + %i[mortgageused value deposit stairbought].each do |field| record.errors.add field, I18n.t("validations.sale_information.staircasing_mortgage.mortgage_not_used", deposit: record.field_formatted_as_currency("deposit"), value: record.field_formatted_as_currency("value"),