diff --git a/source/components/CDDIntro.js b/source/components/CDDIntro.js
index 9f9b3261e..168b9b9e4 100644
--- a/source/components/CDDIntro.js
+++ b/source/components/CDDIntro.js
@@ -19,10 +19,10 @@ export default () => (
Ce simulateur calcule pour vous les 4 éléments de ce surcoût :
- - l'indemnité de fin de contrat
- - le CIF
- - la majoration chômage
- - l'indemnité compensatrice de congés payés
+ - l'indemnité de fin de contrat
+ - le CIF
+ - la majoration chômage
+ - l'indemnité compensatrice de congés payés
Par simplification, ces éléments sont tous calculés par mois de contrat.
diff --git a/source/components/Rule.js b/source/components/Rule.js
index 24f2b5da9..4496f757d 100644
--- a/source/components/Rule.js
+++ b/source/components/Rule.js
@@ -1,12 +1,10 @@
import React, { Component } from 'react'
// import {findRuleByName} from '../engine/rules.js'
-import {analyseSituation} from '../engine/traverse'
import './Rule.css'
import JSONTree from 'react-json-tree'
import R from 'ramda'
import PageTypeIcon from './PageTypeIcon'
import {connect} from 'react-redux'
-import {formValueSelector} from 'redux-form'
import mockSituation from '../engine/mockSituation.yaml'
import {START_CONVERSATION} from '../actions'
import classNames from 'classnames'
diff --git a/source/engine/traverse.js b/source/engine/traverse.js
index 79bc88800..202b34246 100644
--- a/source/engine/traverse.js
+++ b/source/engine/traverse.js
@@ -78,6 +78,7 @@ let fillVariableNode = (rule, situationGate) => (parseResult) => {
category: 'variable',
fragments: fragments,
variableName,
+ name: variableName,
type: 'boolean | numeric',
explanation: parsedRule,
missingVariables: (variableIsRule || known) ? [] : [variableName],
@@ -90,7 +91,6 @@ let fillVariableNode = (rule, situationGate) => (parseResult) => {
}
let treat = (situationGate, rule) => rawNode => {
-// console.log('rawNode', rawNode)
let reTreat = treat(situationGate, rule)
if (R.is(String)(rawNode)) {
@@ -253,7 +253,7 @@ let treat = (situationGate, rule) => rawNode => {
value={result.nodeValue}
child={
- {result.explanation.map(item => - {item.jsx}
)}
+ {result.explanation.map(item => - {item.jsx}
)}
}
/>
@@ -353,7 +353,7 @@ let treat = (situationGate, rule) => rawNode => {
value={node.nodeValue}
child={
- {node.explanation.map(item => - {item.jsx}
)}
+ {node.explanation.map(item => - {item.jsx}
)}
}
/>
@@ -450,17 +450,17 @@ let treat = (situationGate, rule) => rawNode => {
value={nodeValue}
child={
- -
+
-
assiette:
{base.jsx}
{rate.nodeValue != 1 &&
- -
+
-
taux:
{rate.jsx}
}
{facteur.nodeValue != 1 &&
- -
+
-
facteur:
{facteur.jsx}
}
@@ -490,7 +490,7 @@ let treat = (situationGate, rule) => rawNode => {
child={
{contenders.map((item, i) =>
- -
+
-
{v[i].description}
{item.jsx}
@@ -599,7 +599,8 @@ let treatRuleRoot = (situationGate, rule) => R.pipe(
- do they need variables that are not present in the user situation ?
- if not, do they have a computed value or are they non applicable ?
*/
-export let analyseSituation = situationGate =>
+export let analyseSituation = situationGate => console.log('analyseSituation' + Math.random()) ||
+
//TODO l'objectif devrait être spécifié par la page qui lance un simulateur
treatRuleRoot(
situationGate,
diff --git a/source/reducers.js b/source/reducers.js
index 61b901255..1c5d637fb 100644
--- a/source/reducers.js
+++ b/source/reducers.js
@@ -45,10 +45,14 @@ function pointedOutObjectives(state=[], {type, objectives}) {
let handleSteps = (state, action) => {
+ if (![START_CONVERSATION, STEP_ACTION].includes(action.type))
+ return state
+
let returnObject = {
...state,
analysedSituation: analyse(state)
}
+
if (action.type == START_CONVERSATION) {
return {
...returnObject,
@@ -68,14 +72,12 @@ let handleSteps = (state, action) => {
R.splitWhen(stepFinder),
R.head
)(state.foldedSteps)
- console.log('foldedSteps', foldedSteps)
return {
...returnObject,
foldedSteps,
unfoldedSteps: [R.find(stepFinder)(state.foldedSteps)]
}
}
- return state
}
let analyse = R.pipe(