WIP
This commit is contained in:
parent
1fe550fe1e
commit
eea230de60
10 changed files with 42 additions and 47 deletions
|
|
@ -30,17 +30,13 @@ function fallbackValue (crypto, machine, instances) {
|
|||
|
||||
function generalScoped (crypto, machine, config) {
|
||||
const scopedValue = (key, instances) =>
|
||||
[key, fallbackValue(crypto, machine, keyedValues(key, instances))]
|
||||
fallbackValue(crypto, machine, instances)
|
||||
|
||||
const keyedValues = (key, instances) => R.filter(r => r.fieldLocator.code === key, instances)
|
||||
const keys = instances => R.uniq(R.map(r => r.fieldLocator.code, instances))
|
||||
const allScopes = key => config.filter(R.pathEq(['fieldLocator', 'code'], key))
|
||||
const keys = R.uniq(R.map(r => r.fieldLocator.code, config))
|
||||
const keyedValues = keys.map(key => scopedValue(key, allScopes(key)))
|
||||
|
||||
const scopedGroups = group => {
|
||||
const instances = group.values
|
||||
return [group.code, R.fromPairs(keys(instances).map(key => scopedValue(key, instances)))]
|
||||
}
|
||||
|
||||
return R.fromPairs(config.groups.map(scopedGroups))
|
||||
return R.fromPairs(keys, keyedValues)
|
||||
}
|
||||
|
||||
function machineScoped (machine, config) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue