Browse Source

Switch order in if statement

pull/427/head
Kat 3 years ago
parent
commit
89b6522bc2
  1. 2
      app/models/validations/financial_validations.rb

2
app/models/validations/financial_validations.rb

@ -122,7 +122,7 @@ private
%i[scharge pscharge supcharg].each do |charge| %i[scharge pscharge supcharg].each do |charge|
maximum = CHARGE_MAXIMUMS.dig(charge, LANDLORD_VALUES[record.landlord], NEEDSTYPE_VALUES[record.needstype]) maximum = CHARGE_MAXIMUMS.dig(charge, LANDLORD_VALUES[record.landlord], NEEDSTYPE_VALUES[record.needstype])
if maximum.present? && !weekly_value_in_range(record, charge, 0, maximum) && record[charge].present? if maximum.present? && record[charge].present? && !weekly_value_in_range(record, charge, 0, maximum)
record.errors.add charge, I18n.t("validations.financial.rent.#{charge}.#{LANDLORD_VALUES[record.landlord]}.#{NEEDSTYPE_VALUES[record.needstype]}") record.errors.add charge, I18n.t("validations.financial.rent.#{charge}.#{LANDLORD_VALUES[record.landlord]}.#{NEEDSTYPE_VALUES[record.needstype]}")
end end
end end

Loading…
Cancel
Save