diff --git a/app/imports/api/engine/computation/buildComputation/linkTypeDependencies.js b/app/imports/api/engine/computation/buildComputation/linkTypeDependencies.js index 72add806..ebd4f5e0 100644 --- a/app/imports/api/engine/computation/buildComputation/linkTypeDependencies.js +++ b/app/imports/api/engine/computation/buildComputation/linkTypeDependencies.js @@ -30,7 +30,6 @@ function dependOnCalc({dependencyGraph, prop, key}){ let calc = get(prop, key); if (!calc) return; if (calc.type !== '_calculation'){ - console.log(calc); throw `Expected calculation got ${calc.type}` } dependencyGraph.addLink(prop._id, `${prop._id}.${key}`, 'calculation'); @@ -63,7 +62,7 @@ function linkAction(dependencyGraph, prop, {propsById}){ dependOnCalc({ dependencyGraph, prop, - key: `${prop._id}.resources.itemsConsumed.${index}.quantity`, + key: `resources.itemsConsumed[${index}].quantity`, }); }); // Link attributes consumed @@ -74,7 +73,7 @@ function linkAction(dependencyGraph, prop, {propsById}){ dependOnCalc({ dependencyGraph, prop, - key: `${prop._id}.resources.attributesConsumed.${index}.quantity`, + key: `resources.attributesConsumed[${index}].quantity`, }); }); } diff --git a/app/imports/api/engine/computeCreature.js b/app/imports/api/engine/computeCreature.js index 066a3cee..fc94edd2 100644 --- a/app/imports/api/engine/computeCreature.js +++ b/app/imports/api/engine/computeCreature.js @@ -11,14 +11,13 @@ export default function computeCreature(creatureId){ computeCreatureComputation(computation); writeAlteredProperties(computation); writeScope(creatureId, computation.scope); - writeErrors(creatureId, computation.errors); } catch (e){ computation.errors.push({ type: 'crash', details: e.reason, }); } finally { - writeErrors(creatureId, [...computation.errors]); + writeErrors(creatureId, computation.errors); } }