diff --git a/source/components/RuleValueVignette.js b/source/components/RuleValueVignette.js index fae1c0895..812b96d2c 100644 --- a/source/components/RuleValueVignette.js +++ b/source/components/RuleValueVignette.js @@ -11,20 +11,14 @@ import './RuleValueVignette.css' export default ({ name, type, - "non applicable si": nonApplicable, - formule: { nodeValue: formuleValue }, - conversationStarted + conversationStarted, + nodeValue: ruleValue }) => do { - //TODO quel bordel, à revoir - let ruleValue = computeRuleValue( - formuleValue, - nonApplicable && nonApplicable.nodeValue - ), + let unsatisfied = ruleValue == null, - nonApplicableValue = nonApplicable ? nonApplicable.nodeValue : false, - irrelevant = nonApplicableValue === true || formuleValue == 0, - number = nonApplicableValue == false && formuleValue != null + irrelevant = ruleValue == 0, + number = typeof ruleValue == 'number' && ruleValue > 0 ; - {humanFigure(2)(formuleValue) + "€"} + {humanFigure(2)(ruleValue) + "€"} )}

diff --git a/source/engine/traverse.js b/source/engine/traverse.js index 88762e651..d4e9454ab 100644 --- a/source/engine/traverse.js +++ b/source/engine/traverse.js @@ -328,20 +328,17 @@ let treat = (rules, rule) => rawNode => { let parsedNode = onNodeType(rawNode) return parsedNode.evaluate ? parsedNode : - {...parsedNode, evaluate: defaultEvaluate} + {...parsedNode, evaluate: defaultEvaluate} } //TODO c'est moche : export let computeRuleValue = (formuleValue, condValue) => condValue === undefined - ? formuleValue - : formuleValue === 0 - ? 0 - : condValue === null - ? null - : condValue === true + ? formuleValue + : formuleValue === 0 ? 0 - : formuleValue + : condValue === null ? null : condValue === true ? 0 : formuleValue + export let treatRuleRoot = (rules, rule) => { let evaluate = (situationGate, parsedRules, r) => {