From 5de77ec6f738e4645cb4d1b4b31166100ad19110 Mon Sep 17 00:00:00 2001 From: sniedzielski Date: Thu, 28 Apr 2022 12:06:37 +0200 Subject: [PATCH] OP-762: revert change for 'relevance' and schema --- calculation/schema.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/calculation/schema.py b/calculation/schema.py index fccedb4..34ad225 100644 --- a/calculation/schema.py +++ b/calculation/schema.py @@ -185,6 +185,15 @@ def resolve_calculation_params(parent, info, **kwargs): value=ov["value"], label=LabelParamGQLType(en=ov["label"]["en"], fr=ov["label"]["fr"]) ) for ov in param["optionSet"]] if "optionSet" in param else [] + + if "condition" in param: + condition = param["condition"] if param["condition"] else None + else: + condition = None + if "relevance" in param: + relevance = param["relevance"] if param["relevance"] else None + else: + relevance = None list_params.append( CalculationParamsGQLType( @@ -193,9 +202,9 @@ def resolve_calculation_params(parent, info, **kwargs): label=label, rights=rights, option_set=option_set, - relevance=param["relevance"] if "relevance" in param and param["relevance"] is not None else True, - condition= param["condition"] if "condition" in param and param["condition"] is not None else True, - default_value=param['default'] if 'default' in param and param['default'] is not None else "null" , + relevance=relevance, + condition=condition, + default_value=param['default'] if 'default' in param else "null", ) ) return CalculationParamsListGQLType(list_params)