From 75df54ed2554b24e612b454963d7c7d89a9e200a Mon Sep 17 00:00:00 2001 From: mama Date: Tue, 19 Dec 2017 12:23:55 +0100 Subject: [PATCH] :bug: Changement d'objectifs lors d'une inversion MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Tant que l'on n'a qu'une inversion possible, ce code spécifique est le plus pratique --- source/reducers.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/source/reducers.js b/source/reducers.js index 504eaba0c..42cb4529f 100644 --- a/source/reducers.js +++ b/source/reducers.js @@ -63,7 +63,6 @@ export let reduceSteps = (tracker, flatRules, answerSource) => ( situationWithDefaults = assume(intermediateSituation, rulesDefaults) let - parsedRules = R.path(['analysis', 'parsedRules'], state), analysis = analyseMany(state.parsedRules, targetNames)(situationWithDefaults(state)), nextWithDefaults = getNextSteps(situationWithDefaults(state), analysis), assumptionsMade = !R.isEmpty(rulesDefaults), @@ -87,8 +86,10 @@ export let reduceSteps = (tracker, flatRules, answerSource) => ( if (action.type == START_CONVERSATION) { return { ...newState, - // when objectives change, reject theme from answered questions - foldedSteps: action.fromScratch ? [] : R.reject(name => targetNames.includes(nameLeaf(name)))( + /* when objectives change, reject them from answered questions + Hack : 'salaire de base' is the only inversable variable, so the only + one that could be the next target AND already in the answered steps */ + foldedSteps: action.fromScratch ? [] : R.reject(R.contains('salaire de base'))( state.foldedSteps ) }