From cbbbf83cee18205cc251cd53f560f69b9888a056 Mon Sep 17 00:00:00 2001 From: Mael Date: Mon, 9 Apr 2018 14:19:48 +0200 Subject: [PATCH] Vrai score d'avancement par objectif --- source/components/TargetSelection.js | 21 +++++++++++++-------- source/reducers.js | 10 +++++++++- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/source/components/TargetSelection.js b/source/components/TargetSelection.js index 11295a44e..b7282a97e 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, path, contains, without, curry, append, ifElse } from 'ramda' +import { propEq, isEmpty, curry } from 'ramda' import './TargetSelection.css' import BlueButton from './BlueButton' import { Field, reduxForm, formValueSelector, change } from 'redux-form' @@ -111,6 +111,11 @@ export default class TargetSelection extends Component { } } +let computeRatio = (mvt, name) => + !isEmpty(mvt) && + mvt.current[name].missingVariables.length / + mvt.initial[name].missingVariables.length + let Header = ({ conversationStarted, s, @@ -123,12 +128,13 @@ let Header = ({ className="progressCircle" style={{ visibility: activeInput === s.dottedName ? 'hidden' : 'visible' - }} - > + }}> {do { - let mv = missingVariablesByTarget[s.dottedName], - number = mv && mv.missingVariables.length, - ratio = number / 16 + let ratio = + activeInput === s.dottedName + ? 0 + : computeRatio(missingVariablesByTarget, s.dottedName) + ratio === 0 ? (