diff --git a/source/components/rule/Rule.js b/source/components/rule/Rule.js index c29d821aa..ffe286451 100644 --- a/source/components/rule/Rule.js +++ b/source/components/rule/Rule.js @@ -4,7 +4,7 @@ import {connect} from 'react-redux' import {formValueSelector} from 'redux-form' import R from 'ramda' import './Rule.css' -import {rules, decodeRuleName} from 'Engine/rules.js' +import {rules, decodeRuleName, nameLeaf} from 'Engine/rules.js' import mockSituation from 'Engine/mockSituation.yaml' import {analyseSituation} from 'Engine/traverse' import {START_CONVERSATION} from '../../actions' @@ -36,7 +36,7 @@ export default class Rule extends Component { } } setRule(name){ - this.rule = analyseSituation(rules, decodeRuleName(name))(this.props.situationGate) + this.rule = analyseSituation(rules, nameLeaf(decodeRuleName(name)))(this.props.situationGate) } componentWillMount(){ let { diff --git a/source/engine/traverse.js b/source/engine/traverse.js index fc71e87db..5ffc03896 100644 --- a/source/engine/traverse.js +++ b/source/engine/traverse.js @@ -449,6 +449,8 @@ export let analyseTopDown = (rules, rootVariable) => situationGate => { //On fait ainsi pour chaque règle de la base. parsedRules = R.map(treatOne,rules), + // TODO: we should really make use of namespaces at this level, in particular + // setRule in Rule.js needs to get smarter and pass dottedName rootRule = findRuleByName(parsedRules, rootVariable), /*