From f2af8c9b398458e1dd07b761e986c084755381c6 Mon Sep 17 00:00:00 2001 From: Mael Date: Fri, 1 Mar 2019 12:32:09 +0100 Subject: [PATCH] =?UTF-8?q?:bug:=20Message=20"bar=C3=A8me=20ne=20retourne?= =?UTF-8?q?=20que=20le=20taux"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ce message s'affichait tout le temps, alors que c'est une option --- source/engine/mecanismViews/BarèmeContinu.js | 8 +++++--- source/engine/mecanisms.js | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/source/engine/mecanismViews/BarèmeContinu.js b/source/engine/mecanismViews/BarèmeContinu.js index c556faea7..7af72072d 100644 --- a/source/engine/mecanismViews/BarèmeContinu.js +++ b/source/engine/mecanismViews/BarèmeContinu.js @@ -46,9 +46,11 @@ let Comp = withLanguage(function Barème({ nodeValue, explanation }) { {(100 * explanation.taux).toFixed(1)} % )} -

- Ce barème ne retourne que le taux. -

+ {explanation.returnRate && ( +

+ Ce barème ne retourne que le taux. +

+ )} } /> diff --git a/source/engine/mecanisms.js b/source/engine/mecanisms.js index 28c25f270..b0f965887 100644 --- a/source/engine/mecanisms.js +++ b/source/engine/mecanisms.js @@ -731,6 +731,8 @@ export let mecanismContinuousScale = (recurse, k, v) => { assiette: false, multiplicateur: defaultNode(1) } + + let returnRate = v['retourne seulement le taux'] === 'oui' let effect = ({ assiette, multiplicateur, points }) => { if (anyNull([assiette, multiplicateur])) return null //We'll build a linear function given the two constraints that must be respected @@ -752,8 +754,7 @@ export let mecanismContinuousScale = (recurse, k, v) => { nodeValue = a * val(assiette) + b, taux = nodeValue / val(assiette) return reduced({ - nodeValue: - v['retourne seulement le taux'] === 'oui' ? taux : nodeValue, + nodeValue: returnRate ? taux : nodeValue, additionalExplanation: { seuil: val(assiette) / val(multiplicateur), taux @@ -767,7 +768,8 @@ export let mecanismContinuousScale = (recurse, k, v) => { } let explanation = { ...parseObject(recurse, objectShape, v), - points: v.points + points: v.points, + returnRate }, evaluate = evaluateObject(objectShape, effect) return {