✨ Code plus prévisible
parent
a7d88e8514
commit
363d2795e8
|
@ -904,3 +904,11 @@ export let mecanismSynchronisation = (recurse, k, v) => {
|
|||
export let mecanismError = (recurse, k, v) => {
|
||||
throw new Error("Le mécanisme '" + k + "' est inconnu !" + v)
|
||||
}
|
||||
export let mecanismOnePossibility = (recurse, k, v) => ({
|
||||
...v,
|
||||
'une possibilité': 'oui',
|
||||
evaluate: (cache, situationGate, parsedRules, node) => ({
|
||||
...node,
|
||||
missingVariables: { [node.dottedName]: 1 }
|
||||
})
|
||||
})
|
||||
|
|
|
@ -44,7 +44,8 @@ import {
|
|||
mecanismReduction,
|
||||
mecanismSum,
|
||||
mecanismSynchronisation,
|
||||
mecanismVariations
|
||||
mecanismVariations,
|
||||
mecanismOnePossibility
|
||||
} from './mecanisms'
|
||||
import { Node } from './mecanismViews/common'
|
||||
import { treat } from './traverse'
|
||||
|
@ -228,11 +229,7 @@ export let treatObject = (rules, rule, treatOptions) => rawNode => {
|
|||
'le maximum de': mecanismMax,
|
||||
'le minimum de': mecanismMin,
|
||||
complément: mecanismComplement,
|
||||
'une possibilité': always({
|
||||
...v,
|
||||
'une possibilité': 'oui',
|
||||
missingVariables: { [rule.dottedName]: 1 }
|
||||
}),
|
||||
'une possibilité': mecanismOnePossibility,
|
||||
'inversion numérique': mecanismInversion(rule.dottedName),
|
||||
allègement: mecanismReduction,
|
||||
variations: mecanismVariations,
|
||||
|
|
|
@ -28,7 +28,7 @@ export let treatVariable = (rules, rule, filter) => parseResult => {
|
|||
situationValue == null &&
|
||||
(variableHasCond ||
|
||||
variableHasFormula ||
|
||||
findParentDependency(rules, variable))
|
||||
findParentDependency(parsedRules, variable))
|
||||
|
||||
// if (dottedName.includes('jeune va')) debugger
|
||||
|
||||
|
@ -131,7 +131,7 @@ export let treatVariableTransforms = (rules, rule) => parseResult => {
|
|||
let supportedPeriods = ['mois', 'année', 'flexible']
|
||||
if (nodeValue == null) return filteredNode
|
||||
let ruleToTransform = findRuleByDottedName(
|
||||
rules,
|
||||
parsedRules,
|
||||
filteredNode.explanation.dottedName
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in New Issue