From 21f39f3fe1e25c9aee89c7ddf4122a9c790a9555 Mon Sep 17 00:00:00 2001 From: mama Date: Fri, 24 Nov 2017 18:45:28 +0100 Subject: [PATCH] =?UTF-8?q?:bug:=20R=C3=A9solution=20d'un=20bug=20dans=20l?= =?UTF-8?q?a=20construction=20des=20donn=C3=A9es=20d'inversion?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/engine/generateQuestions.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/source/engine/generateQuestions.js b/source/engine/generateQuestions.js index cf0113b21..07eda0374 100644 --- a/source/engine/generateQuestions.js +++ b/source/engine/generateQuestions.js @@ -75,8 +75,10 @@ let buildVariantTree = (allRules, path) => { } let buildPossibleInversion = (rule, flatRules, targetNames) => { - let inversions = R.path(['formule', 'inversion', 'avec'])(rule), - inversionObjects = inversions.map(i => + let ruleInversions = R.path(['formule', 'inversion', 'avec'])(rule) + if (!ruleInversions) return null + let + inversionObjects = ruleInversions.map(i => findRuleByDottedName( flatRules, disambiguateRuleReference(flatRules, rule, i) @@ -84,13 +86,11 @@ let buildPossibleInversion = (rule, flatRules, targetNames) => { ), yo = R.reject(({ name }) => targetNames.includes(name))([rule].concat(inversionObjects)) - return ( - inversions && { - inversions: yo, - question: rule.formule.inversion.question, - title: rule.formule.inversion.titre - } - ) + return { + inversions: yo, + question: rule.formule.inversion.question, + title: rule.formule.inversion.titre + } } export let makeQuestion = (flatRules, targetNames) => dottedName => {