From 1a628879a23111729421e02fbb747dd5674223c6 Mon Sep 17 00:00:00 2001 From: Johan Girod Date: Wed, 9 Dec 2020 17:41:29 +0100 Subject: [PATCH] =?UTF-8?q?:bug:=20fix=20la=20possibilit=C3=A9=20d'avoir?= =?UTF-8?q?=20choix=20obligatoire=20=3D=20non=20pour=20le=20m=C3=A9canisme?= =?UTF-8?q?=20une=20possibilit=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mon-entreprise/source/components/conversation/RuleInput.tsx | 5 ++++- publicodes/source/mecanisms/one-possibility.ts | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/mon-entreprise/source/components/conversation/RuleInput.tsx b/mon-entreprise/source/components/conversation/RuleInput.tsx index 62b43633f..9a6f1599d 100644 --- a/mon-entreprise/source/components/conversation/RuleInput.tsx +++ b/mon-entreprise/source/components/conversation/RuleInput.tsx @@ -87,6 +87,7 @@ export default function RuleInput({ required: true, } if (getVariant(engine.getParsedRules()[dottedName])) { + console.log(buildVariantTree(engine.getParsedRules(), dottedName)) return ( ( const node = allRules[path] if (!node) throw new Error(`La règle ${path} est introuvable`) const variant = getVariant(node) - const canGiveUp = variant && !variant['choix obligatoire'] + const canGiveUp = + variant && + (!variant['choix obligatoire'] || variant['choix obligatoire'] === 'non') return Object.assign( node, variant diff --git a/publicodes/source/mecanisms/one-possibility.ts b/publicodes/source/mecanisms/one-possibility.ts index 0ddf0c7ce..8027f292e 100644 --- a/publicodes/source/mecanisms/one-possibility.ts +++ b/publicodes/source/mecanisms/one-possibility.ts @@ -5,7 +5,7 @@ import { Context } from '../parsePublicodes' export type PossibilityNode = { explanation: Array - 'choix obligatoire'?: 'oui' + 'choix obligatoire'?: 'oui' | 'non' context: string nodeKind: 'une possibilité' }