Browse Source

handle null period in validation

pull/3010/head
Carolyn 1 month ago
parent
commit
00db1986ea
  1. 4
      app/models/validations/financial_validations.rb

4
app/models/validations/financial_validations.rb

@ -159,9 +159,11 @@ module Validations::FinancialValidations
end end
def validate_care_home_charges(record) def validate_care_home_charges(record)
return unless record.period && record.chcharge
if record.is_carehome? if record.is_carehome?
period = record.form.get_question("period", record).label_from_value(record.period).downcase period = record.form.get_question("period", record).label_from_value(record.period).downcase
if record.chcharge.present? && !weekly_value_in_range(record, "chcharge", 10, 5000) unless weekly_value_in_range(record, "chcharge", 10, 5000)
max_chcharge = record.weekly_to_value_per_period(5000) max_chcharge = record.weekly_to_value_per_period(5000)
min_chcharge = record.weekly_to_value_per_period(10) min_chcharge = record.weekly_to_value_per_period(10)

Loading…
Cancel
Save