[Bug]: Apply Templates will budget non-whole numbers when decimal places are hidden #1594

Closed
opened 2026-02-28 19:48:07 -06:00 by GiteaMirror · 2 comments
Owner

Originally created by @Teprifer on GitHub (Nov 17, 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?

From Discord: https://discord.com/channels/937901803608096828/1306841659493060628

If templates are applied while the hide decimal places user setting is enabled, a non-whole number can be budgeted via Apply Templates.

Steps to reproduce:

  1. Setup a test budget
  2. If using an existing category, zero out what is budgeted so it's easier to see.
  3. Enable the hide decimal places option on the settings page
  4. Enable goal templates
  5. Set a template to a category to #template 1517 by 2025-10 (or anything that'll result in the amount per month not to be a whole number)
  6. Apply budget template
  7. Disable the hide decimals setting
  8. Review the category budgeted amount and note it budgeted after the decimal place

Expected result, when hide decimals is enabled, templates only budgets whole numbers. This is a bug because currencies without decimal places can't realistically budget with decimal places and can result in their budgeted values not balancing (visually).

With decimals hidden this looks like:
image

When re-showing decimals it shows what it actually did:
image

If someone hides decimals even though they do have a currency with them, this change would have a negligible effect anyway of up to +/- 1 until the last month.

Where are you hosting Actual?

Docker

What browsers are you seeing the problem on?

Firefox

Operating System

Windows 11

Originally created by @Teprifer on GitHub (Nov 17, 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? From Discord: https://discord.com/channels/937901803608096828/1306841659493060628 If templates are applied while the hide decimal places user setting is enabled, a non-whole number can be budgeted via Apply Templates. Steps to reproduce: 1. Setup a test budget 2. If using an existing category, zero out what is budgeted so it's easier to see. 3. Enable the hide decimal places option on the settings page 4. Enable goal templates 5. Set a template to a category to `#template 1517 by 2025-10` (or anything that'll result in the amount per month not to be a whole number) 6. Apply budget template 7. Disable the hide decimals setting 8. Review the category budgeted amount and note it budgeted after the decimal place Expected result, when hide decimals is enabled, templates only budgets whole numbers. This is a bug because currencies without decimal places can't realistically budget with decimal places and can result in their budgeted values not balancing (visually). With decimals hidden this looks like: ![image](https://github.com/user-attachments/assets/5935afc6-bdc5-43ff-9132-acab35c43a58) When re-showing decimals it shows what it actually did: ![image](https://github.com/user-attachments/assets/f11c83a8-5f66-4837-9d72-158b70ec89fd) If someone hides decimals even though they do have a currency with them, this change would have a negligible effect anyway of up to +/- 1 until the last month. ### Where are you hosting Actual? Docker ### What browsers are you seeing the problem on? Firefox ### Operating System Windows 11
GiteaMirror added the buggoal templates labels 2026-02-28 19:48:07 -06:00
Author
Owner

@youngcw commented on GitHub (Nov 17, 2024):

I think that in order to have the math not break things like priorities, there should be a round stage at the end of each processing stage, if this setting is enabled. It shouldn't be overly difficult to add. I do worry that the templates will be off by 1 sometimes, but we would have to test and see.

@youngcw commented on GitHub (Nov 17, 2024): I think that in order to have the math not break things like priorities, there should be a round stage at the end of each processing stage, if this setting is enabled. It shouldn't be overly difficult to add. I do worry that the templates will be off by 1 sometimes, but we would have to test and see.
Author
Owner

@Teprifer commented on GitHub (Nov 18, 2024):

I think that in order to have the math not break things like priorities, there should be a round stage at the end of each processing stage, if this setting is enabled. It shouldn't be overly difficult to add. I do worry that the templates will be off by 1 sometimes, but we would have to test and see.

Ah yep, I think in most cases it should be fine overall - it would only affect the templates where actual is doing the maths, and would even out over time. It would still result in the correct end balance in the last month right?

I'd imagine it's quite similar to how cents must be rounded for decimal currencies.

@Teprifer commented on GitHub (Nov 18, 2024): > I think that in order to have the math not break things like priorities, there should be a round stage at the end of each processing stage, if this setting is enabled. It shouldn't be overly difficult to add. I do worry that the templates will be off by 1 sometimes, but we would have to test and see. Ah yep, I think in most cases it should be fine overall - it would only affect the templates where actual is doing the maths, and would even out over time. It would still result in the correct end balance in the last month right? I'd imagine it's quite similar to how cents must be rounded for decimal currencies.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/actual#1594