Browse Source

typo

pull/1429/head
Kat 3 years ago
parent
commit
e08b319d6c
  1. 2
      app/models/form/sales/pages/discounted_sale_value_check.rb
  2. 2
      app/models/sales_log.rb
  3. 2
      app/models/validations/sales/sale_information_validations.rb
  4. 2
      app/models/validations/sales/soft_validations.rb
  5. 2
      config/locales/en.yml
  6. 2
      spec/models/form/sales/pages/discounted_sale_value_check_spec.rb

2
app/models/form/sales/pages/discounted_sale_value_check.rb

@ -8,7 +8,7 @@ class Form::Sales::Pages::DiscountedSaleValueCheck < ::Form::Page
}
@informative_text = {
"translation" => "soft_validations.discounted_sale_value.informative_text",
"arguments" => [{ "key" => "mortgage_deposit_and_grand_total", "label" => false, "i18n_template" => "mortgage_deposit_and_grand_total" }],
"arguments" => [{ "key" => "mortgage_deposit_and_grant_total", "label" => false, "i18n_template" => "mortgage_deposit_and_grant_total" }],
}
@person_index = person_index
@depends_on = [

2
app/models/sales_log.rb

@ -338,7 +338,7 @@ class SalesLog < Log
value - discount_amount
end
def mortgage_deposit_and_grand_total
def mortgage_deposit_and_grant_total
return if deposit.blank?
grant_amount = grant || 0

2
app/models/validations/sales/sale_information_validations.rb

@ -52,7 +52,7 @@ module Validations::Sales::SaleInformationValidations
return unless record.mortgage || record.mortgageused == 2
return unless record.discount || record.grant || record.type == 29
if record.mortgage_deposit_and_grand_total != record.value_with_discount && record.discounted_ownership_sale?
if record.mortgage_deposit_and_grant_total != record.value_with_discount && record.discounted_ownership_sale?
%i[mortgage deposit grant value discount ownershipsch].each do |field|
record.errors.add field, I18n.t("validations.sale_information.discounted_ownership_value", value_with_discount: sprintf("%.2f", record.value_with_discount))
end

2
app/models/validations/sales/soft_validations.rb

@ -120,7 +120,7 @@ module Validations::Sales::SoftValidations
return unless mortgage || mortgageused == 2
return unless discount || grant || type == 29
mortgage_deposit_and_grand_total != value_with_discount && discounted_ownership_sale?
mortgage_deposit_and_grant_total != value_with_discount && discounted_ownership_sale?
end
private

2
config/locales/en.yml

@ -527,7 +527,7 @@ en:
title_text: "You told us this person is a student aged beween 16 and 19"
discounted_sale_value:
title_text: "Mortgage, deposit, and grant total must equal £%{value_with_discount}"
informative_text: "Your given mortgage, deposit and grand total is £%{mortgage_deposit_and_grand_total}"
informative_text: "Your given mortgage, deposit and grant total is £%{mortgage_deposit_and_grant_total}"
devise:
two_factor_authentication:

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

@ -34,7 +34,7 @@ RSpec.describe Form::Sales::Pages::DiscountedSaleValueCheck, type: :model do
it "has the correct informative_text" do
expect(page.informative_text).to eq({
"translation" => "soft_validations.discounted_sale_value.informative_text",
"arguments" => [{ "key" => "mortgage_deposit_and_grand_total", "label" => false, "i18n_template" => "mortgage_deposit_and_grand_total" }],
"arguments" => [{ "key" => "mortgage_deposit_and_grant_total", "label" => false, "i18n_template" => "mortgage_deposit_and_grant_total" }],
})
end

Loading…
Cancel
Save