From 0af2854fc9db2831bffc3330f96e452e0eb9318c Mon Sep 17 00:00:00 2001 From: Maxime Quandalle Date: Fri, 23 Apr 2021 09:24:48 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Corrige=20un=20bug=20sur=20le=20?= =?UTF-8?q?simulateur=20d'aide?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Lorsqu'on répondait "jeune de -26 ans" emploi franc était actif mais affichait "non" au lieu du bon montant. --- .../source/pages/Simulateurs/AidesEmbauche.tsx | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/mon-entreprise/source/pages/Simulateurs/AidesEmbauche.tsx b/mon-entreprise/source/pages/Simulateurs/AidesEmbauche.tsx index eb7179ee6..22b4fa88d 100644 --- a/mon-entreprise/source/pages/Simulateurs/AidesEmbauche.tsx +++ b/mon-entreprise/source/pages/Simulateurs/AidesEmbauche.tsx @@ -10,7 +10,7 @@ import { useSimulationProgress } from 'Components/utils/useNextQuestion' import { useParamsFromSituation } from 'Components/utils/useSearchParamsSimulationSharing' import useSimulationConfig from 'Components/utils/useSimulationConfig' import { DottedName } from 'modele-social' -import { formatValue } from 'publicodes' +import Engine, { formatValue } from 'publicodes' import { partition } from 'ramda' import { useContext } from 'react' import { Trans, useTranslation } from 'react-i18next' @@ -234,7 +234,7 @@ function Results() { const isActive = typeof engine.evaluate(aide.dottedName).nodeValue === 'number' const situation = { ...baseEngine.parsedSituation, ...aide.situation } - return { ...aide, situation, isActive } + return { ...aide, situation, engine, isActive } }) const [aidesActives, aidesInactives] = partition( ({ isActive }) => isActive, @@ -249,7 +249,9 @@ function Results() { Les aides - + ({ ...aide, engine: baseEngine }))} + /> ) : ( @@ -269,7 +271,11 @@ function Results() { ) } -function AidesGrid({ aides }: { aides: Array }) { +function AidesGrid({ + aides, +}: { + aides: Array +}) { return (
{aides.map((aide, i) => ( @@ -283,11 +289,11 @@ function ResultCard({ situation, title, dottedName, + engine, dateFin, versement, description, -}: AideDescriptor) { - const engine = useEngine() +}: AideDescriptor & { engine: Engine }) { const rule = engine.getParsedRules()[dottedName] const valueNode = (rule.explanation.valeur as any)?.explanation.valeur const evaluation = engine.evaluate(valueNode)