lims_interface: allow Test Formula wizard to change expression

This commit is contained in:
Sebastián Marró 2021-01-17 11:19:37 -03:00
parent 94ddf7bef2
commit 7e8cfb9bf4
1 changed files with 5 additions and 7 deletions

View File

@ -2039,13 +2039,8 @@ class TestFormulaView(ModelView):
msg += (', '.join(missing_methods))
return ('error', msg)
ast = builder.compile()
missing = (set([x.lower() for x in ast.inputs]) -
self.previous_formulas())
if not missing:
return
return ('warning', 'Referenced alias "%s" not found. Ensure it is '
'declared before this formula.' % ', '.join(missing))
return
except formulas.errors.FormulaError as error:
msg = error.msg.replace('\n', ' ')
if error.args[1:]:
@ -2088,8 +2083,11 @@ class TestFormulaView(ModelView):
except Exception:
return None
expression_inputs = (' '.join([x for x in ast.inputs])).lower().split()
inputs = []
for variable in self.variables:
if variable.variable not in expression_inputs:
continue
try:
input_value = float(variable.value)
except ValueError: