mirror of
https://github.com/actualbudget/actual.git
synced 2026-04-30 18:20:24 -05:00
[Goals]: fix stacked templates (#4120)
* fix stacked amounts * note/lint
This commit is contained in:
@@ -95,31 +95,32 @@ export class CategoryTemplate {
|
|||||||
let scheduleFlag = false;
|
let scheduleFlag = false;
|
||||||
// switch on template type and calculate the amount for the line
|
// switch on template type and calculate the amount for the line
|
||||||
for (let i = 0; i < t.length; i++) {
|
for (let i = 0; i < t.length; i++) {
|
||||||
|
let newBudget = 0;
|
||||||
switch (t[i].type) {
|
switch (t[i].type) {
|
||||||
case 'simple': {
|
case 'simple': {
|
||||||
toBudget += this.runSimple(t[i], this.limitAmount);
|
newBudget = this.runSimple(t[i], this.limitAmount);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'copy': {
|
case 'copy': {
|
||||||
toBudget += await this.runCopy(t[i]);
|
newBudget = await this.runCopy(t[i]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'week': {
|
case 'week': {
|
||||||
toBudget += this.runWeek(t[i]);
|
newBudget = this.runWeek(t[i]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'spend': {
|
case 'spend': {
|
||||||
toBudget += await this.runSpend(t[i]);
|
newBudget = await this.runSpend(t[i]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'percentage': {
|
case 'percentage': {
|
||||||
toBudget += await this.runPercentage(t[i], availStart);
|
newBudget = await this.runPercentage(t[i], availStart);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'by': {
|
case 'by': {
|
||||||
//TODO add the logic to run all of these at once or whatever is needed
|
//TODO add the logic to run all of these at once or whatever is needed
|
||||||
const ret = this.runBy(t[i], first, remainder);
|
const ret = this.runBy(t[i], first, remainder);
|
||||||
toBudget += ret.ret;
|
newBudget = ret.ret;
|
||||||
remainder = ret.remainder;
|
remainder = ret.remainder;
|
||||||
first = false;
|
first = false;
|
||||||
break;
|
break;
|
||||||
@@ -140,18 +141,21 @@ export class CategoryTemplate {
|
|||||||
[],
|
[],
|
||||||
this.category,
|
this.category,
|
||||||
);
|
);
|
||||||
toBudget = ret.to_budget;
|
// Schedules assume that its to budget value is the whole thing so this
|
||||||
|
// needs to remove the previous funds so they aren't double counted
|
||||||
|
newBudget = ret.to_budget - toBudget;
|
||||||
remainder = ret.remainder;
|
remainder = ret.remainder;
|
||||||
scheduleFlag = ret.scheduleFlag;
|
scheduleFlag = ret.scheduleFlag;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'average': {
|
case 'average': {
|
||||||
toBudget += await this.runAverage(t[i]);
|
newBudget = await this.runAverage(t[i]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
available = available - toBudget;
|
available = available - newBudget;
|
||||||
|
toBudget += newBudget;
|
||||||
}
|
}
|
||||||
|
|
||||||
//check limit
|
//check limit
|
||||||
|
|||||||
6
upcoming-release-notes/4120.md
Normal file
6
upcoming-release-notes/4120.md
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
category: Bugfix
|
||||||
|
authors: [youngcw]
|
||||||
|
---
|
||||||
|
|
||||||
|
Fixed stacked templates with priorities
|
||||||
Reference in New Issue
Block a user