Browse Source

feat: add validation that staircase % is >= threshold

pull/1404/head
Sam Seed 3 years ago
parent
commit
e1d5d06780
  1. 10
      app/models/validations/sales/financial_validations.rb
  2. 1
      config/locales/en.yml

10
app/models/validations/sales/financial_validations.rb

@ -52,6 +52,16 @@ module Validations::Sales::FinancialValidations
end
end
def validate_percentage_bought_at_least_threshold(record)
return unless record.stairbought && record.type
if ([2, 18, 16, 24].include? record.type) && record.stairbought < 10
record.errors.add :stairbought, I18n.t("validations.financial.staircasing.percentage_bought_must_be_at_least_threshold", percentage: 10)
elsif record.type == 30 && record.stairbought < 1
record.errors.add :stairbought, I18n.t("validations.financial.staircasing.percentage_bought_must_be_at_least_threshold", percentage: 1)
end
end
def validate_child_income(record)
return unless record.income2 && record.ecstat2

1
config/locales/en.yml

@ -302,6 +302,7 @@ en:
staircasing:
percentage_bought_must_be_greater_than_percentage_owned: "Total percentage buyer now owns must be more than percentage bought in this transaction"
older_person_percentage_owned_maximum_75: "Percentage cannot be above 75% under Older Person's Shared Ownership"
percentage_bought_must_be_at_least_threshold: "The minimum increase in equity while staircasing is %{percentage}%"
household:
reasonpref:

Loading…
Cancel
Save