🐛 L'affichage des objectifs (point blanc) avait disparu

pull/2/head
mama 2017-05-09 17:14:13 +02:00
parent 23bd1909d9
commit f4e00d0bd2
6 changed files with 10 additions and 54 deletions

View File

@ -22,7 +22,6 @@
"ramda": "^0.23.0",
"react": "^15.5.4",
"react-dom": "^15.5.4",
"react-json-tree": "^0.10.0",
"react-redux": "^5.0.3",
"react-router-dom": "^4.1.1",
"reduce-reducers": "^0.1.2",

View File

@ -137,38 +137,3 @@ class Algorithm extends React.Component {
)
}
}
let JSONView = ({o, rootKey}) => (
<div className="json">
<JSONTree
getItemString={() => ''}
theme={theme}
hideRoot={true}
shouldExpandNode={() => true}
data={rootKey ? {[rootKey]: o} : o}
/>
</div>
)
var theme = {
scheme: 'atelier forest',
author: 'bram de haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/forest)',
base00: '#1b1918',
base01: '#2c2421',
base02: '#68615e',
base03: '#766e6b',
base04: '#9c9491',
base05: '#a8a19f',
base06: '#e6e2e0',
base07: '#f1efee',
base08: '#f22c40',
base09: '#df5320',
base0A: '#d5911a',
base0B: '#5ab738',
base0C: '#00ad9c',
base0D: '#407ee7',
base0E: '#6666ea',
base0F: '#c33ff3'
}

View File

@ -82,6 +82,8 @@ let buildNextSteps = analysedSituation => {
analysedSituation
)
console.log('missingVariables', missingVariables)
/*
Parmi les variables manquantes, certaines sont citées dans une règle de type 'une possibilité'.
**On appelle ça des groupes de type 'variante'.**
@ -181,14 +183,6 @@ export let generateGridQuestions = missingVariables => R.pipe(
)(relevantVariants)
})
)
//TODO reintroduce objectives
// {
// objectives: R.pipe(
// R.chain(v => missingVariables[variant.dottedName + ' . ' + v]),
// R.uniq()
// )(variant['une possibilité'])
// }
)
export let generateSimpleQuestions = missingVariables => R.pipe(

View File

@ -128,11 +128,11 @@ let collectNodeMissingVariables = (root, source=root, results=[]) => {
export let collectMissingVariables = (groupMethod='groupByMissingVariable') => analysedSituation =>
R.pipe(
R.unless(R.is(Array), R.of),
R.chain( v =>
R.chain( v => console.log('v', v) ||
R.pipe(
collectNodeMissingVariables,
R.flatten,
R.map(mv => [v.variableName, mv])
R.map(mv => [v.dottedName, mv])
)(v)
),
//groupBy missing variable but remove mv from value, it's now in the key

View File

@ -58,9 +58,8 @@ let fillVariableNode = (rule, situationGate) => (parseResult) => {
let
{fragments} = parseResult,
variablePartialName = fragments.join(' . '),
variableName = disambiguateRuleReference(rule, variablePartialName),
// y = console.log('variableName', variableName),
variable = findRuleByDottedName(variableName),
dottedName = disambiguateRuleReference(rule, variablePartialName),
variable = findRuleByDottedName(dottedName),
variableIsRule = variable.formule != null,
//TODO perf : mettre un cache sur les variables !
// On le fait pas pour l'instant car ça peut compliquer les fonctionnalités futures
@ -70,15 +69,14 @@ let fillVariableNode = (rule, situationGate) => (parseResult) => {
variable
),
nodeValue = variableIsRule ? parsedRule.nodeValue : evaluateVariable(situationGate, variableName, variable.format),
missingVariables = variableIsRule ? [] : (nodeValue == null ? [variableName] : [])
nodeValue = variableIsRule ? parsedRule.nodeValue : evaluateVariable(situationGate, dottedName, variable.format),
missingVariables = variableIsRule ? [] : (nodeValue == null ? [dottedName] : [])
return {
nodeValue,
category: 'variable',
fragments: fragments,
variableName,
name: variableName,
dottedName,
type: 'boolean | numeric',
explanation: parsedRule,
missingVariables,

View File

@ -7,7 +7,7 @@ import { euro, months } from './components/conversation/formValueTypes.js'
import { EXPLAIN_VARIABLE, POINT_OUT_OBJECTIVES} from './actions'
import R from 'ramda'
import {findGroup, findRuleByDottedName, parentName, collectMissingVariables, findVariantsAndRecords} from './engine/rules'
import {findGroup, findRuleByDottedName, parentName, findVariantsAndRecords} from './engine/rules'
import {reduceSteps, generateGridQuestions, generateSimpleQuestions} from './engine/generateQuestions'