Trouver les variables appelées et non calculables

pull/1/head
Mael Thomas 2016-08-10 16:13:17 +02:00
parent 8e8e05b7ca
commit 40423b8b6b
5 changed files with 65 additions and 8 deletions

View File

@ -1,7 +1,60 @@
import React, { Component } from 'react'
import {connect} from 'react-redux'
import {usedVariables} from '../selectors'
let mapStateToProps = state => (
{
usedVariables: usedVariables(state)
}
)
@connect(mapStateToProps)
export default class Analyse extends Component {
render() {
let {usedVariables} = this.props,
calculable = usedVariables[5].calculable
For each of these cases, extract used variables. Regexp, remove accents, list of variables.
check
count all
let scalarMult = value => {
let [match, multiple, variable] = value.match(/(?:([0-9])*\s\*\s)?((?:[a-z]|\s|_)+)/g)
}
let possibilities = {
linear: {
base: 'scalar mult',
limit: 'scalar mult',
historique: null,
// VAR/case: logic predicate
},
marginalRateTaxScale: {
base: 'scalar mult',
// VAR/case: logic predicate
},
concerne: 'logic',
'ne concerne pas': 'logic',
logique: 'logic', // predicates leading to a boolean,
'logique numérique': 'numeric logic', // predicates leading to a number
/*
logic = string ? logic predicate -> & the rest
|| list of string predicates : ||
*/
}
console.log(calculable);
return (<div>Analyse</div>)
}
}

View File

@ -63,17 +63,16 @@ let
// Gardons seulement les variables ayant une implémentation : capable de faire un calcul
calculable: R.filter(itemIsCalculable)(mergedVariableItems)
}}
)(groupedItemsByVariable)
let calculableItems =
)(groupedItemsByVariable),
mergedItems = R.values(mergedItemsByVariable),
calculableItems =
R.pipe(
R.values,
R.pluck('calculable'),
R.unnest
)(mergedItemsByVariable),
mergedItems = R.values(mergedItemsByVariable)
)(mergedItemsByVariable)
console.log('LA', mergedItems)
export {
groupedItemsByVariable,
calculableItems,

View File

@ -12,6 +12,6 @@
- embauche en CDI suivant le CDD
# - OU CDD prolongé en CDI
linéaire:
linear:
base: assiette cotisations sociales
historique: 9.999999

View File

@ -18,6 +18,6 @@ ne concerne pas :
- engagement employeur complément formation professionnelle
- contrat jeune vacances (contrat conclu avec un jeune pendant ses vacances scolaires ou universitaires.)
linéaire:
linear:
base: salaire brut
historique: .1

View File

@ -55,3 +55,8 @@ export let variablesSelector = createSelector(
)(selectedTags)
)(mergedItems)
)
export let usedVariables = createSelector(
[variablesSelector],
variables => variables
)