[Bug]: Budget goal "#template up to" does not always remove extra funds #1669

Closed
opened 2026-02-28 19:50:32 -06:00 by GiteaMirror · 4 comments
Owner

Originally created by @Arnoud-B on GitHub (Dec 12, 2024).

Verified issue does not already exist?

  • I have searched and found no existing issue
  • I will be providing steps how to reproduce the bug (in most cases this will also mean uploading a demo budget file)

What happened?

When applying a budget template #template up to 0, it does not always remove extra funds.

In the sample budget, it removes the money spent in December, but not in November.

Where are you hosting Actual?

Docker

What browsers are you seeing the problem on?

Firefox, Safari

Operating System

Mac OSX

Originally created by @Arnoud-B on GitHub (Dec 12, 2024). ### Verified issue does not already exist? - [X] I have searched and found no existing issue - [X] I will be providing steps how to reproduce the bug (in most cases this will also mean uploading a demo budget file) ### What happened? When applying a budget template `#template up to 0`, it does not always remove extra funds. In the [sample budget](https://github.com/user-attachments/files/18115986/2024-12-12-My.Finances.zip), it removes the money spent in December, but not in November. ### Where are you hosting Actual? Docker ### What browsers are you seeing the problem on? Firefox, Safari ### Operating System Mac OSX
GiteaMirror added the buggoal templates labels 2026-02-28 19:50:32 -06:00
Author
Owner

@youngcw commented on GitHub (Dec 14, 2024):

I looked into this. Its essentially the same thing as the other issue. An up to template doesn't consider spending when setting the budget value.

So what you are seeing in that example budget is that in November the rollover from the previous month was 0, so when you run "up to 0" its already at zero since leftover(0)+budgeted(0)=0 so the template is met. The "spend" then comes after getting the balance to 50.

For December its removing 50, not from December, but the leftover from November. So its seeing leftover(50)+budgeted(-50)=0. Then after that there is the $50 "spend" that leaves the balance at 50 even after the -50 budgeted amount.

If you run the template for January, it removes the last 50 and the balance is at 0 again.

@youngcw commented on GitHub (Dec 14, 2024): I looked into this. Its essentially the same thing as the other issue. An up to template doesn't consider spending when setting the budget value. So what you are seeing in that example budget is that in November the rollover from the previous month was 0, so when you run "up to 0" its already at zero since leftover(0)+budgeted(0)=0 so the template is met. The "spend" then comes after getting the balance to 50. For December its removing 50, not from December, but the leftover from November. So its seeing leftover(50)+budgeted(-50)=0. Then after that there is the $50 "spend" that leaves the balance at 50 even after the -50 budgeted amount. If you run the template for January, it removes the last 50 and the balance is at 0 again.
Author
Owner

@Arnoud-B commented on GitHub (Dec 14, 2024):

I'm finding it hard to follow the new logic. The current behavior seems to differ from the documentation:

#template up to 150 | Budget up to 150 each month, and remove extra funds over 150

The documentation refers to "extra funds", which seems to correspond to the category balance in the app (as there is no impact on "Available Funds"). When applying the template to a specific month, I'd expect it to adjust that month's category balance to 0 (like in the example where the category balance reaches 50). The goal is to immediately allocate available money to envelopes. Leaving category balances unused until next month doesn't seem to align with zero-based budgeting principles.

Could you clarify the reasoning behind this change?

@Arnoud-B commented on GitHub (Dec 14, 2024): I'm finding it hard to follow the new logic. The current behavior seems to differ from the documentation: > #template up to 150 | Budget up to 150 each month, and remove extra funds over 150 The documentation refers to "extra funds", which seems to correspond to the category balance in the app (as there is no impact on "Available Funds"). When applying the template to a specific month, I'd expect it to adjust that month's category balance to 0 (like in the example where the category balance reaches 50). The goal is to immediately allocate available money to envelopes. Leaving category balances unused until next month doesn't seem to align with zero-based budgeting principles. Could you clarify the reasoning behind this change?
Author
Owner

@youngcw commented on GitHub (Dec 14, 2024):

Like I mentioned in the other ticket, the templates should always attempt the same thing no matter when they are run in the month. In other words, the templates act as if they are run on the first of the month when there aren't any transactions. So the only balance available at the start of the month is what was carried over from the previous month.

The intended workflow for templates is that they get run at or near the first of the month to set up the budget initially, and for future months. Then after the initial month start further changes are manual as the month goes along.

The other flow that works is if someone is paycheck to paycheck they can use priorities to continuously fill in their categories in the current month as money is available.

You may be more interested in the cleanup templates if you want to be removing funds through the month. I could see those being extended to be more flexible as well, but they don't come up very often.

@youngcw commented on GitHub (Dec 14, 2024): Like I mentioned in the other ticket, the templates should always attempt the same thing no matter when they are run in the month. In other words, the templates act as if they are run on the first of the month when there aren't any transactions. So the only balance available at the start of the month is what was carried over from the previous month. The intended workflow for templates is that they get run at or near the first of the month to set up the budget initially, and for future months. Then after the initial month start further changes are manual as the month goes along. The other flow that works is if someone is paycheck to paycheck they can use priorities to continuously fill in their categories in the current month as money is available. You may be more interested in the cleanup templates if you want to be removing funds through the month. I could see those being extended to be more flexible as well, but they don't come up very often.
Author
Owner

@Arnoud-B commented on GitHub (Dec 14, 2024):

I've been experimenting a bit with the cleanup templates (this was new to me), and they may be able to do the job together with the assumption to start each month fresh. It's a different approach, but it makes sense. Thanks!

@Arnoud-B commented on GitHub (Dec 14, 2024): I've been experimenting a bit with the cleanup templates (this was new to me), and they may be able to do the job together with the assumption to start each month fresh. It's a different approach, but it makes sense. Thanks!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/actual#1669