From bda764680ab812e66ee27a36e778334e53c89760 Mon Sep 17 00:00:00 2001 From: Laurent Bossavit Date: Tue, 24 Apr 2018 10:45:31 +0200 Subject: [PATCH] :bug: Corrige le calcul de l'avancement --- source/components/TargetSelection.js | 6 +++--- source/engine/generateQuestions.js | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/source/components/TargetSelection.js b/source/components/TargetSelection.js index 1ff7fe484..2a557d2e9 100644 --- a/source/components/TargetSelection.js +++ b/source/components/TargetSelection.js @@ -2,7 +2,7 @@ import React, { Component } from 'react' import { Trans, translate } from 'react-i18next' import formValueTypes from 'Components/conversation/formValueTypes' import { rules, findRuleByName } from 'Engine/rules' -import { propEq, isEmpty, curry } from 'ramda' +import { propEq, isEmpty, curry, values } from 'ramda' import './TargetSelection.css' import BlueButton from './BlueButton' import { Field, reduxForm, formValueSelector, change } from 'redux-form' @@ -115,8 +115,8 @@ export default class TargetSelection extends Component { let computeRatio = (mvt, name) => !isEmpty(mvt) && - mvt.current[name].missingVariables.length / - mvt.initial[name].missingVariables.length + values(mvt.current[name]).length / + values(mvt.initial[name]).length let Header = ({ conversationStarted, diff --git a/source/engine/generateQuestions.js b/source/engine/generateQuestions.js index 10f87d3f1..937174253 100644 --- a/source/engine/generateQuestions.js +++ b/source/engine/generateQuestions.js @@ -49,7 +49,7 @@ import { missingVariables: {variable: [objectives]} */ -export let collectMissingVariablesByTarget = targets => fromPairs(targets.map(target => [target, target.missingVariables])) +export let collectMissingVariablesByTarget = targets => fromPairs(targets.map(target => [target.dottedName, target.missingVariables])) export let getNextSteps = missingVariablesByTarget => { let impact = ([, count]) => count