🐛 fix la possibilité d'avoir choix obligatoire = non pour le mécanisme une possibilité
parent
0535e67fe5
commit
1a628879a2
|
@ -87,6 +87,7 @@ export default function RuleInput<Name extends string = DottedName>({
|
|||
required: true,
|
||||
}
|
||||
if (getVariant(engine.getParsedRules()[dottedName])) {
|
||||
console.log(buildVariantTree(engine.getParsedRules(), dottedName))
|
||||
return (
|
||||
<Question
|
||||
{...commonProps}
|
||||
|
@ -200,7 +201,9 @@ export const buildVariantTree = <Name extends string>(
|
|||
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
|
||||
|
|
|
@ -5,7 +5,7 @@ import { Context } from '../parsePublicodes'
|
|||
|
||||
export type PossibilityNode = {
|
||||
explanation: Array<ASTNode>
|
||||
'choix obligatoire'?: 'oui'
|
||||
'choix obligatoire'?: 'oui' | 'non'
|
||||
context: string
|
||||
nodeKind: 'une possibilité'
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue