Show Point buy on Build tab

This commit is contained in:
Stefan Zermatten
2022-08-25 13:18:24 +02:00
parent 8d729216b5
commit 11a527481e
9 changed files with 221 additions and 57 deletions

View File

@@ -247,6 +247,7 @@ function linkPointBuy(dependencyGraph, prop){
dependOnCalc({ dependencyGraph, prop, key: 'min' });
dependOnCalc({ dependencyGraph, prop, key: 'max' });
dependOnCalc({ dependencyGraph, prop, key: 'cost' });
dependOnCalc({ dependencyGraph, prop, key: 'total' });
prop.values?.forEach(row => {
// Wrap the document in a new object so we don't bash it unintentionally
const pointBuyRow = {

View File

@@ -42,6 +42,7 @@ export default function computePointBuy(computation, node) {
prop.spent += costFunction.value;
}
});
prop.pointsLeft = (prop.total?.value || 0) - (prop.spent || 0);
if (prop.spent > prop.total?.value) {
prop.errors = prop.errors || [];
prop.errors.push({