More engine rewrite progress, starting to get messy again
This commit is contained in:
@@ -6,23 +6,31 @@ export default function parseCalculationFields(prop, schemas){
|
||||
// For each key in the schema
|
||||
schemas[prop.type]._schemaKeys.forEach( key => {
|
||||
// that ends in '.calculation'
|
||||
if (key.slice(-12) !== '.calculation') return;
|
||||
const calcKey = key.sclice(0, -12);
|
||||
if (key.slice(-12) === '.calculation'){
|
||||
const calcKey = key.sclice(0, -12);
|
||||
|
||||
// Determine the level the calculation should compute down to
|
||||
let parseLevel = schemas[prop.type].getDefinition(calcKey).parseLevel;
|
||||
// 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);
|
||||
});
|
||||
// Or that ends in .inlineCalculations
|
||||
} else if (key.slice(-19) === '.inlineCalculations'){
|
||||
const inlineCalcKey = key.sclice(0, -19);
|
||||
applyFnToKey(prop, inlineCalcKey, inlineCalcObj => {
|
||||
// Store a reference to all the inline calculations
|
||||
prop._computationDetails.inlineCalculations.push(inlineCalcObj);
|
||||
});
|
||||
}
|
||||
|
||||
// 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);
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user