Fixed dependency graph not building correctly for resources consumed

This commit is contained in:
Stefan Zermatten
2022-02-28 00:02:55 +02:00
parent e6c7d79d7d
commit afe6c044cd
2 changed files with 3 additions and 5 deletions

View File

@@ -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`,
});
});
}