# Phase 6: Task History - Context **Gathered:** 2026-03-16 **Status:** Ready for planning ## Phase Boundary Let users view past completion dates for any individual task. The data layer already records completions (TaskCompletions table + completeTask writes timestamps). This phase adds a DAO query and a UI to surface that data. Requirements: HIST-01 (verify recording works), HIST-02 (view history). ## Implementation Decisions ### Entry point - From the task edit form (TaskFormScreen) in edit mode: add a "Verlauf" (History) button/row that opens the history view - From CalendarTaskRow: add onTap to navigate to the task edit form (currently only has checkbox) — history is then one tap away - No long-press or context menu — keep interaction model simple and consistent ### History view format - Bottom sheet (showModalBottomSheet) — consistent with existing template_picker_sheet and icon_picker_sheet patterns - Each entry shows: date formatted as "dd.MM.yyyy" and time as "HH:mm" — German locale - Entries listed reverse-chronological (newest first) - No grouping or pagination — household tasks won't have thousands of completions; simple ListView is sufficient ### Empty state - When task has never been completed: centered icon (e.g., Icons.history) + "Noch nie erledigt" message — meaningful, not just blank - No special state for many completions — just scroll ### Claude's Discretion - Exact bottom sheet height and styling - Whether to show a completion count summary at the top of the sheet - Animation and transition details - DAO query structure (single method returning List) - Whether CalendarTaskRow onTap goes to edit form or directly to history ## Specific Ideas No specific requirements — user chose "You decide." Open to standard approaches that match existing app patterns. ## Existing Code Insights ### Reusable Assets - `TaskCompletions` table: Already exists in database.dart (id, taskId, completedAt) — no schema change needed - `TasksDao.completeTask()`: Already inserts into taskCompletions on every completion — HIST-01 data recording is done - `showModalBottomSheet`: Used by template_picker_sheet.dart and icon_picker_sheet.dart — established pattern for overlays - `AppLocalizations` + `.arb` files: German-only localization pipeline in place ### Established Patterns - DAOs extend `DatabaseAccessor` with `@DriftAccessor` annotation - Riverpod `StreamProvider.autoDispose` or `FutureProvider` for reactive data - Feature folder structure: `features/tasks/data/`, `domain/`, `presentation/` - Bottom sheets use `showModalBottomSheet` with `DraggableScrollableSheet` or simple `Column` ### Integration Points - `TaskFormScreen` (edit mode): Entry point for history — add a row/button when `isEditing` - `TasksDao`: Add `watchCompletionsForTask(int taskId)` or `getCompletionsForTask(int taskId)` method - `CalendarTaskRow`: Currently no onTap — needs navigation to task edit form for history access - `router.dart`: Route `/rooms/:roomId/tasks/:taskId` already exists for TaskFormScreen — no new route needed if using bottom sheet - `app_de.arb`: Add localization strings for history UI labels ## Deferred Ideas None — discussion stayed within phase scope --- *Phase: 06-task-history* *Context gathered: 2026-03-16*