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

1.1 KiB

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

  • Fix deactivateCategory: promote children to root, only deactivate the parent itself
  • Add getChildrenUsageCount to block deletion when children have transactions
  • Add reinitializeCategories service function (re-runs seed data)
  • Add reinitializeCategories to hook
  • Add re-initialize button with confirmation on CategoriesPage
  • Add i18n keys (en + fr)
  • Update deleteConfirm/deleteBlocked messages to reflect new behavior
  • 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).