Computation engine rewrite continues

This commit is contained in:
Stefan Zermatten
2021-09-10 19:51:03 +02:00
parent 28ec7082ee
commit b877a8b45f
15 changed files with 235 additions and 28 deletions

View File

@@ -9,15 +9,20 @@ export default function parseCalculationFields(prop, schemas){
if (key.slice(-12) !== '.calculation') return;
const calcKey = key.sclice(0, -12);
// Determine the level the calculation should compute down to
let parseLevel = schemas[prop.type].getDefinition(calcKey).parseLevel;
// For all fields matching they keys
// supports `keys.$.with.$.arrays`
applyFnToKey(prop, calcKey, calcObj => {
// Store a reference to all the calculations
prop._computationDetails.calculations.push(calcObj);
// Store the level to compute down to later
calcObj._parseLevel = parseLevel;
// Parse the calculation
parseCalculation(calcObj);
});
});
}