⚙️ Meilleure implémentation des périodes

co2
Mael 2018-10-01 08:22:05 +00:00
parent a62bde43ba
commit c24d838c15
2 changed files with 21 additions and 3 deletions

View File

@ -28,12 +28,14 @@ export let treatVariable = (rules, rule, filter) => parseResult => {
node.explanation.dottedName
)
let variablePeriod = ruleToTransform['période'] || situation('période')
let environmentPeriod = situation('période') || 'mois'
let callingPeriod = rule['période'] || environmentPeriod
let calledPeriod = ruleToTransform['période'] || environmentPeriod
let newNodeValue =
rule['période'] === 'mois' && variablePeriod === 'année'
callingPeriod === 'mois' && calledPeriod === 'année'
? nodeValue / 12
: rule['période'] === 'année' && variablePeriod === 'mois'
: callingPeriod === 'année' && calledPeriod === 'mois'
? nodeValue * 12
: nodeValue

View File

@ -105,3 +105,19 @@
assiette deux: 3000
valeur attendue: 300
- nom: assiette trois
période: année
format:
- test: Périodes, variable neutre appelant variable annuelle
formule:
multiplication:
assiette: assiette trois
taux: 10%
exemples:
- situation:
période: mois
assiette trois: 36000
valeur attendue: 300