Skip to content
This repository was archived by the owner on Jul 27, 2025. It is now read-only.

Conversation

JLambertazzo
Copy link
Contributor

@JLambertazzo JLambertazzo commented Jan 26, 2025

fixes #1663

Root Cause:

  • "Spent" and "Expenses" values on the budget page are being calculated by different functions

  • The value under "Spent" is calculated with budget.actual_spending, which does not include Uncategorized spending

    • in #1663, notice that 62% of the $3007 is missing
    • was able to recreate this locally
      Screenshot 2025-01-26 110409
  • This is because Uncategorized category is not present on the budget_categories array in the budget class
    Screenshot 2025-01-26 222721

Proposed Fix:

  • Reuse expense_categories_with_totals.total_money which already calculates monthly expense totals, including Uncategorized spending
  • Convert Money to amount to stay consistent with expected return type of actual_spending

Alternatively

Could fix by explicit inclusion of uncategorized expenses in actual_spending, but expense_categories_with_totals.total_money already calculates the desired value, and from the issue it seems we do expect the results to be the same, so I implemented the proposal above instead in this PR.

Results

After implementing the fix, the totals are consistent
Screenshot 2025-01-26 124105

Copy link
Collaborator

@zachgoll zachgoll left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thanks for tracking this down! I think your chosen solution makes sense here.

@zachgoll zachgoll merged commit 8be5bb0 into maybe-finance:main Jan 27, 2025
5 checks passed
@JLambertazzo JLambertazzo deleted the fix/1663-consistent-expense-totals branch January 28, 2025 04:47
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: Budget spending totals don't always match
2 participants