On ne propose pas de saisir un objectif

pull/138/head
mama 2017-11-16 10:43:36 +01:00
parent cbbdbbf3d4
commit 6a3a8ebff3
2 changed files with 14 additions and 10 deletions

View File

@ -24,7 +24,8 @@ import Results from 'Components/Results'
foldedSteps: state.foldedSteps,
extraSteps: state.extraSteps,
themeColours: state.themeColours,
situationGate: state.situationGate
situationGate: state.situationGate,
targetNames: state.targetNames
}),
dispatch => ({
startConversation: targetNames =>
@ -58,7 +59,8 @@ export default class extends Component {
extraSteps,
currentQuestion,
situationGate,
themeColours
themeColours,
targetNames
} = this.props,
reinitalise = () => {
ReactPiwik.push(['trackEvent', 'restart', ''])
@ -78,13 +80,13 @@ export default class extends Component {
reinitalise,
currentQuestion:
currentQuestion &&
this.buildStep({ unfolded: true })(situationGate)(currentQuestion),
this.buildStep({ unfolded: true })(situationGate, targetNames)(currentQuestion),
foldedSteps: R.map(
this.buildStep({ unfolded: false })(situationGate),
this.buildStep({ unfolded: false })(situationGate, targetNames),
foldedSteps
),
extraSteps: R.map(
this.buildStep({ unfolded: true })(situationGate),
this.buildStep({ unfolded: true })(situationGate, targetNames),
extraSteps
),
textColourOnWhite: themeColours.textColourOnWhite
@ -94,8 +96,8 @@ export default class extends Component {
)
}
buildStep = ({ unfolded }) => accessor => question => {
let step = makeQuestion(rules)(question)
buildStep = ({ unfolded }) => (accessor, targetNames) => question => {
let step = makeQuestion(rules, targetNames)(question)
return (
<step.component
key={step.name}

View File

@ -103,7 +103,7 @@ let buildVariantTree = (allRules, path) => {
return rec(path)
}
export let makeQuestion = flatRules => dottedName => {
export let makeQuestion = (flatRules, targetNames) => dottedName => {
let rule = findRuleByDottedName(flatRules, dottedName)
let inputQuestion = rule => ({
@ -116,14 +116,16 @@ export let makeQuestion = flatRules => dottedName => {
suggestions: rule.suggestions,
inversions:
rule['inversions possibles'] &&
rule['inversions possibles']
R.reject(
({name}) => targetNames.includes(name)
)(rule['inversions possibles']
.map(i =>
findRuleByDottedName(
flatRules,
disambiguateRuleReference(flatRules, rule, i)
)
)
.concat([rule])
.concat([rule]))
})
let selectQuestion = rule => ({
component: Select,