⚙️ Première estimation rapide grâce aux défauts
parent
f6717a4754
commit
5e8385ab22
|
@ -72,6 +72,9 @@ export let disambiguateRuleReference = (allRules, {ns, name}, partialName) => {
|
|||
}
|
||||
}
|
||||
|
||||
export let collectDefaults = rules => R.fromPairs(rules.map(r => [r.dottedName, r.defaultValue]))
|
||||
|
||||
|
||||
// On enrichit la base de règles avec des propriétés dérivées de celles du YAML
|
||||
export let rules = rawRules.map(rule => enrichRule(rule, {taux_versement_transport}))
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ import { combineReducers } from 'redux'
|
|||
import reduceReducers from 'reduce-reducers'
|
||||
import {reducer as formReducer, formValueSelector} from 'redux-form'
|
||||
|
||||
import {rules, findRuleByName, findRuleByDottedName } from 'Engine/rules'
|
||||
import {rules, findRuleByName, findRuleByDottedName, collectDefaults} from 'Engine/rules'
|
||||
import {nextSteps} from 'Engine/generateQuestions'
|
||||
import computeThemeColours from 'Components/themeColours'
|
||||
import { STEP_ACTION, START_CONVERSATION, EXPLAIN_VARIABLE, CHANGE_THEME_COLOUR} from './actions'
|
||||
|
@ -47,9 +47,10 @@ export let reduceSteps = (tracker, flatRules, answerSource) => (state, action) =
|
|||
// Soft assumptions are revealed after the simulation ends, and can be changed
|
||||
softAssumptions = R.pathOr({},['simulateur','par défaut'],sim),
|
||||
intermediateSituation = assume(answerSource, hardAssumptions),
|
||||
completeSituation = assume(intermediateSituation,softAssumptions)
|
||||
completeSituation = assume(intermediateSituation,softAssumptions),
|
||||
situationWithDefaults = assume(completeSituation, collectDefaults(flatRules))
|
||||
|
||||
let situationGate = completeSituation(state),
|
||||
let situationGate = situationWithDefaults(state),
|
||||
analysis = analyse(flatRules, targetNames)(situationGate)
|
||||
|
||||
let newState = {
|
||||
|
|
Loading…
Reference in New Issue