From f35ba75788e56cc45504f21c2ac5c80fe29bfcaf Mon Sep 17 00:00:00 2001 From: Johan Girod Date: Tue, 26 Jan 2021 17:07:11 +0100 Subject: [PATCH] =?UTF-8?q?R=C3=A9pare=20un=20bug=20dans=20l'affichage=20d?= =?UTF-8?q?es=20variations?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Si une condition était sur un noeud valant 0, la consequence était appliquée dans le calcul, mais pas pour la visualisation. C'est maintenant réparé --- publicodes/core/source/mecanisms/variations.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/publicodes/core/source/mecanisms/variations.ts b/publicodes/core/source/mecanisms/variations.ts index 9f55b8a01..7cff54a1c 100644 --- a/publicodes/core/source/mecanisms/variations.ts +++ b/publicodes/core/source/mecanisms/variations.ts @@ -1,7 +1,7 @@ import { EvaluationFunction } from '..' import { ASTNode, Unit } from '../AST/types' import { warning } from '../error' -import { bonus, defaultNode } from '../evaluation' +import { bonus, defaultNode, mergeAllMissing } from '../evaluation' import { registerEvaluationFunction } from '../evaluationFunctions' import { convertNodeToUnit } from '../nodeUnits' import parse from '../parse' @@ -12,7 +12,6 @@ import { Temporal, temporalAverage, } from '../temporal' -import { mergeAllMissing } from '../evaluation' export type VariationNode = { explanation: Array<{ @@ -142,7 +141,7 @@ const evaluate: EvaluationFunction<'variations'> = function (node) { ...explanations, { condition: evaluatedCondition, - satisfied: !!evaluatedCondition.nodeValue, + satisfied: evaluatedCondition.nodeValue !== false, consequence: evaluatedConsequence, }, ],