Browse Source

Fix not equals logic

CLDC-4146-infer-no-other-partners
oscar-richardson-softwire 2 weeks ago
parent
commit
e519710726
  1. 5
      app/models/form.rb

5
app/models/form.rb

@ -323,7 +323,12 @@ class Form
if value.is_a?(Hash) && value.key?("operator") if value.is_a?(Hash) && value.key?("operator")
operator = value["operator"] operator = value["operator"]
operand = value["operand"] operand = value["operand"]
if operator == "!=" # This branch is needed as `nil` does not behave as expected with the default logic (`nil&.send("!=", operand)` => `nil` i.e., `false`).
log[question] != operand
else
log[question]&.send(operator, operand) log[question]&.send(operator, operand)
end
else else
parts = question.split(".") parts = question.split(".")
log_value = send_chain(parts, log) log_value = send_chain(parts, log)

Loading…
Cancel
Save