Simpl-Resultat/tasks/todo.md
Le-King-Fu c73f466429
Some checks failed
Release / build (windows-latest) (push) Has been cancelled
fix: persist has_header for imports, fix orphan categories, add re-initialize
- Import: persist `has_header` flag to DB (migration v3) so headerless
  CSVs like Desjardins don't lose their first data row on re-import.
- Categories: promote children to root on parent deletion instead of
  cascading deactivation, preventing invisible orphans.
- Categories: add re-initialize button to reset all categories and
  keywords to seed defaults.
- Bump version to 0.2.1 across tauri.conf.json, package.json, Cargo.toml.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 11:54:33 +00:00

21 lines
1.1 KiB
Markdown

# Task: Fix orphan categories + add re-initialize button
## Root Cause (orphan categories)
`deactivateCategory` ran `SET is_active = 0 WHERE id = $1 OR parent_id = $1`, which silently
deactivated ALL children when a parent was deleted — even children that had transactions assigned.
Since `getAllCategoriesWithCounts` filters `WHERE is_active = 1`, those children vanished from the UI
with no way to recover them.
## Plan
- [x] Fix `deactivateCategory`: promote children to root, only deactivate the parent itself
- [x] Add `getChildrenUsageCount` to block deletion when children have transactions
- [x] Add `reinitializeCategories` service function (re-runs seed data)
- [x] Add `reinitializeCategories` to hook
- [x] Add re-initialize button with confirmation on CategoriesPage
- [x] Add i18n keys (en + fr)
- [x] Update deleteConfirm/deleteBlocked messages to reflect new behavior
- [x] `npm run build` passes
## Review
6 files changed. Orphan fix promotes children to root level instead of cascading deactivation.
Re-initialize button resets all categories+keywords to seed state (with user confirmation).