Browse Source

CLDC-4243: Use question.suffix_label in range error (#3191)

this will correctly do any calculations if a dictionary suffix is provided
pull/3205/head
Samuel Young 2 weeks ago committed by GitHub
parent
commit
70fe970ae5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 4
      app/models/validations/shared_validations.rb

4
app/models/validations/shared_validations.rb

@ -105,8 +105,8 @@ private
def add_range_error(record, question) def add_range_error(record, question)
field = question.check_answer_label || question.id field = question.check_answer_label || question.id
min = [question.prefix, number_with_delimiter(question.min, delimiter: ","), question.suffix].join("") if question.min min = [question.prefix, number_with_delimiter(question.min, delimiter: ","), question.suffix_label(record)].join("") if question.min
max = [question.prefix, number_with_delimiter(question.max, delimiter: ","), question.suffix].join("") if question.max max = [question.prefix, number_with_delimiter(question.max, delimiter: ","), question.suffix_label(record)].join("") if question.max
if min && max if min && max
record.errors.add question.id.to_sym, :outside_the_range, message: I18n.t("validations.shared.numeric.within_range", field:, min:, max:) record.errors.add question.id.to_sym, :outside_the_range, message: I18n.t("validations.shared.numeric.within_range", field:, min:, max:)

Loading…
Cancel
Save