Skip to content

Fix: demo data issues and category reorder with subcategories#515

Merged
lucaantonelli merged 3 commits intoRIP-Comm:mainfrom
theperu:fix/demo-data
Feb 27, 2026
Merged

Fix: demo data issues and category reorder with subcategories#515
lucaantonelli merged 3 commits intoRIP-Comm:mainfrom
theperu:fix/demo-data

Conversation

@theperu
Copy link
Copy Markdown
Collaborator

@theperu theperu commented Feb 22, 2026

🎯 Description

Fixes several issues in the fillDemoData function that caused incorrect or incomplete data to be inserted into the database, leading to unexpected behaviour when using the demo mode.

Also fixes a bug in reorderCategories where the presence of subcategories in the full category list caused drag indices to map to the wrong items, this is a general bug that affects any user who has created subcategories, not just demo data.

Closes: #507

📱 Changes

  • Added missing countNetWorth and position columns to the bankAccount demo INSERT. All 3 accounts were defaulting to position = 0 causing undefined ordering, and countNetWorth was omitted entirely
  • Added missing position column to the categoryTransaction demo INSERT. All 7 categories were defaulting to position = 0 causing undefined ordering
  • Fixed "Furniture" subcategory color to match its parent "Home" (21). The app enforces colour inheritance when creating subcategories via addSubcategory()
  • Fixed transfer transactions using idCategory = 0 instead of null, 0 is not a valid category id; transfers have no category and must store NULL
  • Fixed reorderCategories applying drag indices against the full flat list (parents + subcategories) instead of the parent-only list shown in the UI. Dragging any category while subcategories existed would reorder the wrong item

🧪 Testing Instructions

Behaviour

  1. Clear the app database (Settings → Reset database)
  2. Trigger demo data generation (Settings → Fill with demo data)
  3. Verify that the 3 bank accounts appear in the correct order (Revolut, N26, Fineco) on the accounts screen
  4. Open the Categories screen and verify the 7 categories appear in order with no duplicates
  5. Verify that "Furniture" appears as a subcategory under "Home" and shares the same colour
  6. Open any transfer transaction and verify it has no category assigned
  7. On the Categories screen, drag any category to reorder it and verify the correct category moves (not an adjacent subcategory)

🔍 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

@lucaantonelli
Copy link
Copy Markdown
Collaborator

LGTM

@lucaantonelli lucaantonelli merged commit e0529d8 into RIP-Comm:main Feb 27, 2026
1 check passed
Mattia-Sacchi pushed a commit to Mattia-Sacchi/sossoldi that referenced this pull request Mar 6, 2026
…mm#515)

* Fix demo data

* Dart format

* Fix category reordering when subcategories are added
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.

[Bug] Demo data does not correctly populate categories records

2 participants