Skip to content

fix(dashboard): fix budget section category colors and spending calcu… - #531

Merged
lucaantonelli merged 1 commit into
RIP-Comm:mainfrom
theperu:fix/dashboard-budgets-section
Jul 26, 2026
Merged

lucaantonelli merged 1 commit into
RIP-Comm:mainfrom
theperu:fix/dashboard-budgets-section

Conversation

@theperu

@theperu theperu commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator

🎯 Description

The dashboard's budget section was displaying incorrect category colors and missing spending from child categories. This PR fixes both issues by replacing the pre-computed monthlyBudgetsStatsProvider with direct use of budgetsProvider, monthlyTransactionsProvider, and allParentCategoriesProvider, moving the spending calculation to the widget layer for more accurate and transparent logic.

Closes: N/A

📱 Changes

  • Fix budget indicators showing wrong colors — now uses category.color index instead of cycling by list position
  • Fix spending calculation to include transactions from child categories via categoryParent
  • Remove num.parse/toCurrency round-trip in spending calculation
  • Replace manual ternaries with min/max for amount and perc
  • Add division-by-zero guard when amountLimit is 0

🧪 Testing Instructions

Behaviour

  1. Open the app and navigate to the Dashboard
  2. Ensure at least one budget exists with a category that has sub-categories
  3. Verify that the budget circular indicators display the correct category color (matching the color set in the category settings)
  4. Add transactions under both the parent category and a child category
  5. Verify that the spending amount and progress arc on the indicator correctly reflect the sum of all matching transactions

📸 Screenshots / Screen Recordings (if applicable)

If your PR involves UI changes, please add screenshots or screen recordings here.

Platform Before After
Android
iOS

🔍 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

…lation

- Replace monthlyBudgetsStatsProvider with budgetsProvider + monthlyTransactionsProvider + allParentCategoriesProvider
- Fix category colors using category.color index instead of cycling by list position
- Include child-category transactions in spending aggregation via categoryParent
- Simplify spent calculation by removing num.parse/toCurrency round-trip
- Replace ternaries with min/max and add division-by-zero guard on perc
@lucaantonelli
lucaantonelli merged commit ee9b2a6 into RIP-Comm:main Jul 26, 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.

3 participants