📈 Ajoute le suivi de la fin de simulation

pull/93/head
Laurent Bossavit 2017-10-13 12:06:04 +02:00
parent 3a95588d5d
commit f7e0d6ec02
1 changed files with 10 additions and 2 deletions

View File

@ -62,15 +62,19 @@ export let reduceSteps = (state, action) => {
ReactPiwik.push(['trackEvent', 'answer', action.step+": "+situationGate(action.step)]);
let foldedSteps = [...state.foldedSteps, R.head(state.unfoldedSteps)],
unfoldedSteps = buildNextSteps(situationGate, flatRules, newState.analysedSituation)
unfoldedSteps = buildNextSteps(situationGate, flatRules, newState.analysedSituation),
assumptionsMade = !R.isEmpty(softAssumptions),
done = unfoldedSteps.length == 0
// The simulation is "over" - except we can now fill in extra questions
// where the answers were previously given default reasonable assumptions
if (unfoldedSteps.length == 0 && !R.isEmpty(softAssumptions)) {
if (done && assumptionsMade) {
let newSituation = intermediateSituation(state),
reanalyse = analyseTopDown(flatRules,rootVariable)(newSituation),
extraSteps = buildNextSteps(newSituation, flatRules, reanalyse)
ReactPiwik.push(['trackEvent', 'done', 'extra questions: '+extraSteps.length]);
return {
...newState,
foldedSteps,
@ -79,6 +83,10 @@ export let reduceSteps = (state, action) => {
}
}
if (done) {
ReactPiwik.push(['trackEvent', 'done', 'no more questions']);
}
return {
...newState,
foldedSteps,