From 6529157ad5070d55c6d72c0fcb69539ffd598514 Mon Sep 17 00:00:00 2001 From: baarkerlounger Date: Tue, 19 Oct 2021 20:12:12 +0100 Subject: [PATCH] More generic numeric conditions --- app/helpers/check_answers_helper.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/helpers/check_answers_helper.rb b/app/helpers/check_answers_helper.rb index c86d10adb..ae2d72fc2 100644 --- a/app/helpers/check_answers_helper.rb +++ b/app/helpers/check_answers_helper.rb @@ -25,7 +25,9 @@ module CheckAnswersHelper def condition_not_met(case_log, question_key, question, condition) case question["type"] when "numeric" - case_log[question_key].blank? || !case_log[question_key].send(condition[0].to_sym, condition[1].to_i) + operator = condition[/[<>=]+/].to_sym + operand = condition[/\d+/].to_i + case_log[question_key].blank? || !case_log[question_key].send(operator, operand) when "radio" case_log[question_key].blank? || !condition.include?(case_log[question_key]) else