Skip to content

fix: respect countNetWorth flag when calculating net worth totals#518

Merged
lucaantonelli merged 3 commits into
RIP-Comm:mainfrom
theperu:fix/count-net-worth
Jun 19, 2026
Merged

fix: respect countNetWorth flag when calculating net worth totals#518
lucaantonelli merged 3 commits into
RIP-Comm:mainfrom
theperu:fix/count-net-worth

Conversation

@theperu

@theperu theperu commented Feb 28, 2026

Copy link
Copy Markdown
Collaborator

🎯 Description

Accounts have a "Counts for the net worth" toggle, but this setting was being ignored when calculating the available liquidity shown in the Graphs page.

The monthly transaction queries already correctly filtered by countNetWorth = 1, but the initial balance (summed from all accounts) did not apply the same filter causing accounts excluded from net worth to still inflate the displayed total.

Closes: N/A

📱 Changes

  • Filter accounts by countNetWorth when computing the starting balance in StatisticsProvider

🧪 Testing Instructions

Behaviour

  1. Create (or edit) an account and set "Counts for the net worth" to off
  2. Navigate to the Graphs page
  3. Verify that the net worth graph and total do not include the balance of the excluded account
  4. Re-enable the toggle on the same account
  5. Verify that the net worth graph and total do include that account's balance again

🔍 Checklist for reviewers

  • Code is formatted correctly
  • Tests are passing
  • New tests are added (if needed)
  • Style matches the figma/designer requests
  • Tested on:
    • iOS
    • Android

Comment thread lib/providers/statistics_provider.dart Outdated
(sum, account) => sum + (account.total ?? 0),
);
double currentBalance = accounts
.where((account) => account.countNetWorth)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

maybe also add the new account.deletedAt == null ? Just to be sure, even if deleted always set countnetworth to false.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I agree, I won't be able to push the changes for at least a week so if you want to do it yourself and merge be my guest 😁

@lucaantonelli lucaantonelli merged commit 2ebfe9e into RIP-Comm:main Jun 19, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants