diff --git a/source/components/TargetSelection.js b/source/components/TargetSelection.js
index 1e8af3c5a..b6067a9d5 100644
--- a/source/components/TargetSelection.js
+++ b/source/components/TargetSelection.js
@@ -266,7 +266,7 @@ const TargetValue = connect(
editable: target.question,
attractClick: target.question && isNil(target.nodeValue)
})}
- tabIndex="0"
+ {...(target.question ? { tabIndex: 0 } : {})}
onClick={this.showField(value)}
onFocus={this.showField(value)}>
@@ -277,7 +277,7 @@ const TargetValue = connect(
let { target, setFormValue, activeInput, setActiveInput } = this.props
return () => {
if (!target.question) return
- if (value != null)
+ if (value != null && !Number.isNaN(value))
setFormValue(target.dottedName, Math.round(value) + '')
if (activeInput) setFormValue(activeInput, '')
@@ -286,65 +286,3 @@ const TargetValue = connect(
}
}
)
-
-// let TargetInput = withLanguage(
-// ({
-// target,
-// targets,
-// activeInput,
-// setActiveInput,
-// language,
-// setFormValue
-// }) => (
-//
-// {!target.question ? (
-// {target.nodeValue}
-// ) : activeInput === target.dottedName || !target.formule ? (
-// {
-// if (target.dottedName !== activeInput) {
-// setActiveInput(target.dottedName)
-// }
-// }}
-// component={CurrencyField}
-// defaultValue={0}
-// autoFocus={target.formule}
-// className={classnames('targetInput', {
-// active: target.dottedName === activeInput
-// })}
-// language={language}
-// />
-// ) : (
-//
-// {
-// if (!target.question) return
-// if (target.nodeValue)
-// setFormValue(
-// target.dottedName,
-// Math.round(target.nodeValue) + ''
-// )
-// const previousActiveTarget = targets.find(
-// t => t.dottedName === activeInput
-// )
-// if (
-// previousActiveTarget?.formule ||
-// previousActiveTarget?.explanation?.formule
-// ) {
-// setFormValue(activeInput, '')
-// }
-// setActiveInput(target.dottedName)
-// }}
-// className={classnames('targetInput', {
-// active: target.dottedName === activeInput
-// })}
-// language={language}
-// value={Math.round(target.nodeValue) || ''}
-// />
-//
-//
-// )}
-//
-// )
-// )
diff --git a/source/selectors/analyseSelectors.js b/source/selectors/analyseSelectors.js
index 88f413b93..a410b17d8 100644
--- a/source/selectors/analyseSelectors.js
+++ b/source/selectors/analyseSelectors.js
@@ -68,9 +68,10 @@ export let noUserInputSelector = createSelector(
[
formattedSituationSelector,
targetNamesSelector,
+ parsedRulesSelector,
state => state.simulation?.config?.bloquant
],
- (situation, targetNames, bloquant) => {
+ (situation, targetNames, parsedRules, bloquant) => {
if (!situation) {
return true
}
@@ -79,7 +80,11 @@ export let noUserInputSelector = createSelector(
bloquant && bloquant.every(rule => situations.includes(rule))
const targetIsAnswered =
targetNames &&
- targetNames.some(target => Object.keys(situation).includes(target))
+ targetNames.some(
+ targetName =>
+ findRuleByDottedName(parsedRules, targetName)?.formule &&
+ targetName in situation
+ )
return !(allBlockingAreAnswered || targetIsAnswered)
}
)