From b6218cba8df0ea5d1c25d1008fa2b3aa7e156562 Mon Sep 17 00:00:00 2001 From: Mael Date: Mon, 15 Oct 2018 13:38:41 +0000 Subject: [PATCH] =?UTF-8?q?:bug:=20Probl=C3=A8me=20dans=20l'=C3=A9valuatio?= =?UTF-8?q?n=20des=20variables=20=C3=A0=20question=20et=20condition?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/engine/treatVariable.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/source/engine/treatVariable.js b/source/engine/treatVariable.js index 6c5eb90fc..aca570d7d 100644 --- a/source/engine/treatVariable.js +++ b/source/engine/treatVariable.js @@ -52,14 +52,18 @@ export let treatVariable = (rules, rule, filter) => parseResult => { if (situationValue == null && !variableHasFormula && variableHasCond) { // SITUATION 4.1 : La condition est connue et vrai if (explanation.isApplicable) - return cacheAndNode(explanation.nodeValue, { [dottedName]: 1 }) + return variable.question + ? cacheAndNode(null, { [dottedName]: 1 }) + : cacheAndNode(true, {}) // SITUATION 4.2 : La condition est connue et fausse - if (explanation.isApplicable === false) - return cacheAndNode(explanation.nodeValue, {}) + if (explanation.isApplicable === false) return cacheAndNode(false, {}) // SITUATION 4.3 : La condition n'est pas connue if (explanation.isApplicable == null) - return cacheAndNode(null, explanation.missingVariables) + return cacheAndNode(null, { + ...explanation.missingVariables, + ...(variable.question ? { [dottedName]: 1 } : {}) + }) } }