⚙️ Refactoring et suppression de buildNextSteps

pull/121/merge
Laurent Bossavit 2017-11-05 16:57:43 +01:00
parent 1bb596c99b
commit 0abccfb5dd
1 changed files with 1 additions and 6 deletions

View File

@ -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)
}