diff --git a/source/components/TargetSelection.tsx b/source/components/TargetSelection.tsx index 09920b94e..4a278d237 100644 --- a/source/components/TargetSelection.tsx +++ b/source/components/TargetSelection.tsx @@ -232,11 +232,13 @@ let TargetInputOrValue = ({ const inversionFail = useSelector(analysisWithDefaultsSelector)?.cache._meta .inversionFail const value = - targetWithValue?.nodeValue != null && !inversionFail - ? Math.round(targetWithValue?.nodeValue) + targetWithValue.nodeValue != null && !inversionFail + ? Math.round(targetWithValue.nodeValue) : undefined - const blurValue = inversionFail && !isActiveInput + if (Number.isNaN(value)) { + return null + } return ( ( let transforms = map(k => [k, evaluateOne], keys(objectShape)), automaticExplanation = evolve(fromPairs(transforms))(node.explanation) // the result of effect can either be just a nodeValue, or an object {additionalExplanation, nodeValue}. The latter is useful for a richer JSX visualisation of the mecanism : the view should not duplicate code to recompute intermediate values (e.g. for a marginal 'barème', the marginal 'tranche') - let evaluated = effect(automaticExplanation, cache), + let evaluated = effect(automaticExplanation, cache, situationGate, parsedRules), explanation = is(Object, evaluated) ? { ...automaticExplanation, ...evaluated.additionalExplanation } : automaticExplanation, diff --git a/source/engine/mecanisms.js b/source/engine/mecanisms.js index db502ca8c..f42a6fead 100644 --- a/source/engine/mecanisms.js +++ b/source/engine/mecanisms.js @@ -231,7 +231,6 @@ let doInversion = (oldCache, situationGate, parsedRules, v, dottedName) => { nodeValue = 0 } } - return { nodeValue, missingVariables: {}, diff --git a/source/engine/mecanisms/barème-linéaire.js b/source/engine/mecanisms/barème-linéaire.js index d872a93ec..2b9486dc4 100644 --- a/source/engine/mecanisms/barème-linéaire.js +++ b/source/engine/mecanisms/barème-linéaire.js @@ -2,6 +2,7 @@ import { defaultNode, evaluateObject, parseObject } from 'Engine/evaluation' import { decompose } from 'Engine/mecanisms/utils' import variations from 'Engine/mecanisms/variations' import Barème from 'Engine/mecanismViews/Barème' +import { evaluateNode } from 'Engine/evaluation' import { val } from 'Engine/traverse-common-functions' import { parseUnit } from 'Engine/units' import { desugarScale } from './barème' @@ -31,7 +32,7 @@ export default (recurse, k, v) => { multiplicateur: defaultNode(1) } - let effect = ({ assiette, multiplicateur, tranches }) => { + let effect = ({ assiette, multiplicateur, tranches }, cache, situationGate, parsedRules) => { if (val(assiette) === null) return null let roundedAssiette = Math.round(val(assiette)) @@ -49,11 +50,14 @@ export default (recurse, k, v) => { ? matchedTranche.taux.nodeValue : (matchedTranche.taux.nodeValue / 100) * val(assiette) } else { + matchedTranche.montant = evaluateNode(cache, situationGate, parsedRules, matchedTranche.montant) nodeValue = matchedTranche.montant.nodeValue } + return { nodeValue, additionalExplanation: { + matchedTranche, unit: returnRate ? parseUnit('%') : (v['unité'] && parseUnit(v['unité'])) || explanation.assiette.unit diff --git a/source/règles/base.yaml b/source/règles/base.yaml index 76648c500..450e6c460 100644 --- a/source/règles/base.yaml +++ b/source/règles/base.yaml @@ -5687,19 +5687,19 @@ contrat salarié . convention collective . sport . cotisations . assiette forfai unité: heures/mois tranches: - en-dessous de: 45 - montant: 5 * SMIC horaire + montant: 5 - de: 45 à: 60 - montant: 15 * SMIC horaire + montant: 15 - de: 60 à: 80 - montant: 25 * SMIC horaire + montant: 25 - de: 80 à: 100 - montant: 35 * SMIC horaire + montant: 35 - de: 100 à: 115 - montant: 50 * SMIC horaire + montant: 50 contrat salarié . convention collective . sport . primes . nombre de manifestations: question: Combien de manifestations rémunérées le joueur a-t'il effectué ? @@ -6008,6 +6008,8 @@ contrat salarié . cotisations . assiette forfaitaire . montant: - assiette CSG et CRDS . assiette abattue - règle: réduction générale par: non + - règle: plafond sécurité sociale + par: plafond sécurité sociale temps plein formule: encadrement: valeur: assiette forfaitaire @@ -6015,6 +6017,7 @@ contrat salarié . cotisations . assiette forfaitaire . montant: références: exception agirc-arco (fiche 3): https://www.agirc-arrco.fr/fileadmin/agircarrco/documents/circulaires/agirc_arrco/2019/2019-1-DRJ_Reglementation__applicable_aux_entreprises.pdf CSG et CRDS: https://www.urssaf.fr/portail/home/employeur/calculer-les-cotisations/la-base-de-calcul/assiette-csg-crds.html + plafond de sécurité sociale (urssaf.fr): https://www.urssaf.fr/portail/home/employeur/calculer-les-cotisations/la-base-de-calcul/lassiette-maximale/salarie-a-temps-partiel.html#FilAriane contrat salarié . cotisations . assiette forfaitaire . minimum: description: >