From 0abccfb5dd16be2818c82e795470d6e9003a9f0e Mon Sep 17 00:00:00 2001 From: Laurent Bossavit Date: Sun, 5 Nov 2017 16:57:43 +0100 Subject: [PATCH] :gear: Refactoring et suppression de buildNextSteps --- source/engine/generateQuestions.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/source/engine/generateQuestions.js b/source/engine/generateQuestions.js index 358389531..65695c920 100644 --- a/source/engine/generateQuestions.js +++ b/source/engine/generateQuestions.js @@ -77,17 +77,12 @@ export let collectMissingVariables = (groupMethod='groupByMissingVariable') => ( )(root, parsedRules) } -export let buildNextSteps = (situationGate, flatRules, analysedSituation) => { - let missing = nextSteps(situationGate, flatRules, analysedSituation) - return R.map(makeQuestion(flatRules), missing) -} - export let nextSteps = (situationGate, flatRules, analysedSituation) => { let impact = ([variable, objectives]) => R.length(objectives) let missingVariables = collectMissingVariables('groupByMissingVariable')(situationGate, analysedSituation), pairs = R.toPairs(missingVariables), - sortedPairs = R.sort((a,b) => impact(b) - impact(a), pairs) + sortedPairs = R.sort(R.descend(impact), pairs) return R.map(R.head, sortedPairs) }