actualbudget / actual

A local-first personal finance app
https://actualbudget.org
MIT License
15.76k stars 1.22k forks source link

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

Open Teprifer opened 1 week ago

Teprifer commented 1 week ago

Verified issue does not already exist?

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

youngcw commented 1 week ago

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.

Teprifer commented 1 week ago

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.