From 3a95588d5d435816bd9812d3ee2d9be974c2cf89 Mon Sep 17 00:00:00 2001 From: Laurent Bossavit Date: Fri, 13 Oct 2017 11:47:30 +0200 Subject: [PATCH 1/2] :chart_with_upwards_trend: Ajoute le suivi de 'Tout effacer' --- source/components/Simulateur.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/components/Simulateur.js b/source/components/Simulateur.js index fc86a7a0c..2f44462fd 100644 --- a/source/components/Simulateur.js +++ b/source/components/Simulateur.js @@ -14,6 +14,7 @@ import './Simulateur.css' import {capitalise0} from '../utils' import Conversation from './conversation/Conversation' +import ReactPiwik from 'react-piwik'; let situationSelector = formValueSelector('conversation') @@ -62,6 +63,7 @@ export default class extends React.Component { sim = path => R.path(R.unless(R.is(Array), R.of)(path))(this.rule.simulateur || {}), reinitalise = () => { + ReactPiwik.push(['trackEvent', 'restart', '']); this.props.resetForm(this.name) this.props.startConversation(this.name) }, From f7e0d6ec02889229f623028143fabfcffa984564 Mon Sep 17 00:00:00 2001 From: Laurent Bossavit Date: Fri, 13 Oct 2017 12:06:04 +0200 Subject: [PATCH 2/2] :chart_with_upwards_trend: Ajoute le suivi de la fin de simulation --- source/reducers.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/source/reducers.js b/source/reducers.js index 2419d629f..ffdaa8e02 100644 --- a/source/reducers.js +++ b/source/reducers.js @@ -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,