Fixed a lot broken with nested sets
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { docsToForest } from '/imports/api/parenting/parentingFunctions';
|
||||
import { applyNestedSetProperties, calculateNestedSetOperations } from '/imports/api/parenting/parentingFunctions';
|
||||
import { DenormalisedOnlyCreaturePropertySchema as denormSchema }
|
||||
from '/imports/api/creature/creatureProperties/CreatureProperties';
|
||||
import { getProperties, getCreature, getVariables } from '/imports/api/engine/loadCreatures';
|
||||
@@ -85,8 +85,14 @@ export function buildComputationFromProps(properties, creature, variables) {
|
||||
|
||||
});
|
||||
|
||||
// Get all the properties as trees based on their ancestors
|
||||
let forest = docsToForest(properties);
|
||||
// Get all the properties as a forest, with their nested set properties set
|
||||
const forest = applyNestedSetProperties(properties);
|
||||
const ops = calculateNestedSetOperations(properties);
|
||||
if (ops.length > 20) {
|
||||
console.log(ops.length + ' operations to get fixed nested sets');
|
||||
} else {
|
||||
console.log(JSON.stringify(ops, null, 2));
|
||||
}
|
||||
// Walk the property trees computing things that need to be inherited
|
||||
walkDown(forest, node => {
|
||||
computeInactiveStatus(node);
|
||||
|
||||
Reference in New Issue
Block a user