5 Commits

6 changed files with 628 additions and 22 deletions

View File

@@ -124,11 +124,17 @@ jobs:
PASS: ${{ secrets.HETZNER_PASS }} PASS: ${{ secrets.HETZNER_PASS }}
run: | run: |
mkdir -p fdroid mkdir -p fdroid
cd fdroid
# Ensure remote path exists (sftp mkdir, ignoring errors if already present).
# Try to download the existing repo/ folder from Hetzner to keep older versions and the keystore sshpass -p "$PASS" sftp -o StrictHostKeyChecking=no "$USER@$HOST" <<'SFTP'
# If it fails (first time), we just initialize a new one -mkdir dev
sshpass -p "$PASS" scp -o StrictHostKeyChecking=no -r $USER@$HOST:dev/fdroid/repo . || fdroid init -mkdir dev/fdroid
-mkdir dev/fdroid/repo
SFTP
# Try to download the existing repo/ folder from Hetzner to keep older versions and the keystore.
# If it fails (first time), initialize a new local repo.
sshpass -p "$PASS" scp -o StrictHostKeyChecking=no -r "$USER@$HOST:dev/fdroid/repo" fdroid/ || (cd fdroid && fdroid init)
- name: Copy new APK to repo - name: Copy new APK to repo
run: | run: |
@@ -157,12 +163,15 @@ jobs:
run: | run: |
set -euo pipefail set -euo pipefail
REMOTE_REPO_DIR="dev/fdroid/repo" REMOTE_REPO_DIR="dev/fdroid/repo"
SCP_OPTS="-o StrictHostKeyChecking=no -o ConnectTimeout=20" SSH_OPTS="-o StrictHostKeyChecking=no -o ConnectTimeout=20"
# Use SCP/SFTP path only (some hosts deny SSH exec channels required by rsync/ssh). # Create remote directory tree via SFTP batch (no exec channel needed).
if sshpass -p "$PASS" scp $SCP_OPTS -r fdroid/repo/. "$USER@$HOST:$REMOTE_REPO_DIR/"; then # Leading '-' on each mkdir means "ignore error if already exists".
exit 0 sshpass -p "$PASS" sftp $SSH_OPTS "$USER@$HOST" <<'SFTP'
fi -mkdir dev
-mkdir dev/fdroid
-mkdir dev/fdroid/repo
SFTP
# Fallback for older SSH servers that require legacy SCP protocol. # Upload all files from fdroid/repo into the remote directory.
sshpass -p "$PASS" scp -O $SCP_OPTS -r fdroid/repo/. "$USER@$HOST:$REMOTE_REPO_DIR/" sshpass -p "$PASS" scp $SSH_OPTS -r fdroid/repo/. "$USER@$HOST:$REMOTE_REPO_DIR/"

View File

@@ -50,7 +50,9 @@ Plans:
1. Every task completion (tap done in any view) is recorded in the database with a precise timestamp — data persists across app restarts 1. Every task completion (tap done in any view) is recorded in the database with a precise timestamp — data persists across app restarts
2. From a task's detail or context menu the user can open a history view listing all past completion dates for that task in reverse-chronological order 2. From a task's detail or context menu the user can open a history view listing all past completion dates for that task in reverse-chronological order
3. The history view shows a meaningful empty state if the task has never been completed 3. The history view shows a meaningful empty state if the task has never been completed
**Plans**: TBD **Plans:** 1 plan
Plans:
- [ ] 06-01-PLAN.md — DAO query + history bottom sheet + TaskFormScreen integration + CalendarTaskRow navigation
### Phase 7: Task Sorting ### Phase 7: Task Sorting
**Goal**: Users can reorder task lists by the dimension most useful to them — name, how often the task recurs, or how much effort it requires **Goal**: Users can reorder task lists by the dimension most useful to them — name, how often the task recurs, or how much effort it requires
@@ -72,5 +74,5 @@ Plans:
| 3. Daily Plan and Cleanliness | v1.0 | 3/3 | Complete | 2026-03-16 | | 3. Daily Plan and Cleanliness | v1.0 | 3/3 | Complete | 2026-03-16 |
| 4. Notifications | v1.0 | 3/3 | Complete | 2026-03-16 | | 4. Notifications | v1.0 | 3/3 | Complete | 2026-03-16 |
| 5. Calendar Strip | 2/2 | Complete | 2026-03-16 | - | | 5. Calendar Strip | 2/2 | Complete | 2026-03-16 | - |
| 6. Task History | v1.1 | 0/? | Not started | - | | 6. Task History | v1.1 | 0/1 | Planned | - |
| 7. Task Sorting | v1.1 | 0/? | Not started | - | | 7. Task Sorting | v1.1 | 0/? | Not started | - |

View File

@@ -2,16 +2,16 @@
gsd_state_version: 1.0 gsd_state_version: 1.0
milestone: v1.0 milestone: v1.0
milestone_name: milestone milestone_name: milestone
status: executing status: completed
stopped_at: Completed 05-calendar-strip 05-02-PLAN.md stopped_at: Phase 6 context gathered
last_updated: "2026-03-16T20:37:30.052Z" last_updated: "2026-03-16T20:46:23.402Z"
last_activity: 2026-03-16 — Completed Phase 5 Plan 01 (CalendarDao + providers) last_activity: 2026-03-16 — Completed Phase 5 Plan 02 (calendar strip UI)
progress: progress:
total_phases: 3 total_phases: 3
completed_phases: 1 completed_phases: 1
total_plans: 2 total_plans: 2
completed_plans: 2 completed_plans: 2
percent: 50 percent: 100
--- ---
# Project State # Project State
@@ -71,7 +71,7 @@ None.
## Session Continuity ## Session Continuity
Last session: 2026-03-16T20:37:30.050Z Last session: 2026-03-16T20:46:23.400Z
Stopped at: Completed 05-calendar-strip 05-02-PLAN.md Stopped at: Phase 6 context gathered
Resume file: None Resume file: .planning/phases/06-task-history/06-CONTEXT.md
Next action: `/gsd:plan-phase 5` Next action: `/gsd:plan-phase 5`

View File

@@ -0,0 +1,202 @@
---
phase: 05-calendar-strip
verified: 2026-03-16T21:00:00Z
status: human_needed
score: 10/10 must-haves verified
human_verification:
- test: "Launch the app on a device or emulator and confirm the calendar strip renders correctly"
expected: "Horizontal row of day cards with German abbreviations (Mo, Di, Mi...) and date number; today's card is bold with a 2px green underline accent; all cards have a light sage tint; selected card has stronger green background and border"
why_human: "Visual appearance, color fidelity, and card proportions cannot be verified programmatically"
- test: "Tap several day cards and verify the task list below updates"
expected: "Tapping a card selects it (green highlight, centered), and the task list below immediately shows that day's tasks"
why_human: "Interactive tap-to-select flow and reactive list update require a running device"
- test: "Scroll the strip far from today, then tap the floating Today button"
expected: "Floating 'Heute' FAB appears when today is scrolled out of view; tapping it re-centers today's card and resets the task list to today"
why_human: "Visibility toggle of FAB and imperative scroll-back behavior require real scroll interaction"
- test: "Verify month boundary treatment"
expected: "At every month boundary a slightly wider gap appears between the last card of one month and the first card of the next, with a small month label (e.g. 'Mrz', 'Apr') in the gap"
why_human: "Month label rendering and gap width are visual properties that require visual inspection"
- test: "With tasks overdue (nextDueDate before today), view today in the strip"
expected: "An 'Uberfaellig' section header in coral appears above the overdue tasks; switching to yesterday or tomorrow hides the overdue section entirely"
why_human: "Requires a device with test data in the database and navigation between days"
- test: "Complete a task via its checkbox"
expected: "The task slides out with a SizeTransition + SlideTransition animation (300ms); it disappears from the list after the animation"
why_human: "Animation quality and timing require visual observation on a running device"
---
# Phase 5: Calendar Strip Verification Report
**Phase Goal:** Users navigate their tasks through a horizontal date-strip that replaces the stacked daily plan, seeing today's tasks by default and any day's tasks on tap
**Verified:** 2026-03-16T21:00:00Z
**Status:** human_needed — all automated checks pass; 6 visual/interactive behaviors need human confirmation
**Re-verification:** No — initial verification
---
## Goal Achievement
### Observable Truths
| # | Truth | Status | Evidence |
|----|-------|--------|---------|
| 1 | Home screen shows a horizontal scrollable strip of day cards with German abbreviation (Mo, Di...) and date number | VERIFIED | `calendar_strip.dart` L265: `DateFormat('E', 'de').format(date)` produces German abbreviations; 181-card `ListView.builder` scroll direction horizontal |
| 2 | Tapping a day card updates the task list below to show that day's tasks | VERIFIED | `_onCardTapped` calls `ref.read(selectedDateProvider.notifier).selectDate(tappedDate)`; `CalendarDayList` watches `calendarDayProvider` which watches `selectedDateProvider` |
| 3 | On app launch the strip auto-scrolls so today's card is centered | VERIFIED | `initState` calls `WidgetsBinding.instance.addPostFrameCallback``_animateToToday()` which calls `_scrollController.animateTo(..., duration: 200ms, curve: Curves.easeOut)` |
| 4 | A subtle wider gap and month label appears at month boundaries | VERIFIED | `_kMonthBoundaryGap = 16.0` vs `_kCardMargin = 4.0`; `_isFirstOfMonth` triggers `DateFormat('MMM', 'de').format(date)` text label; non-boundary cards reserve `SizedBox(height: 16)` to prevent jitter |
| 5 | Overdue tasks appear in a separate coral-accented section when viewing today | VERIFIED | `calendarDayProvider` fetches `watchOverdueTasks` only when `isToday`; `_buildTaskList` renders a coral-colored "Uberfaellig" header via `_overdueColor = Color(0xFFE07A5F)` when `state.overdueTasks.isNotEmpty` |
| 6 | Overdue tasks do NOT appear when viewing past or future days | VERIFIED | `calendarDayProvider`: `isToday` guard — past/future sets `overdueTasks = const []`; 101-test suite includes `does not show overdue section for non-today date` test passing |
| 7 | Completing a task via checkbox triggers slide-out animation | VERIFIED | `_CompletingTaskRow` in `calendar_day_list.dart` implements `SizeTransition` + `SlideTransition` (300ms, `Curves.easeInOut`); `_onTaskCompleted` adds to `_completingTaskIds` and calls `taskActionsProvider.notifier.completeTask` |
| 8 | Floating Today button appears when scrolled away from today, hidden when today is visible | VERIFIED | `CalendarStrip.onTodayVisibilityChanged` callback drives `_showTodayButton` in `HomeScreen`; `_onScroll` computes viewport bounds vs today card position |
| 9 | First-run empty state (no rooms/tasks) still shows the create-room prompt | VERIFIED | `CalendarDayList._buildFirstRunEmpty` shows checklist icon + `l10n.dailyPlanNoTasks` + `l10n.homeEmptyAction` FilledButton.tonal navigating to `/rooms`; gated by `totalTaskCount == 0` |
| 10 | Celebration state shows when all tasks for the selected day are done | VERIFIED | `_buildCelebration` renders `Icons.celebration_outlined` + `dailyPlanAllClearTitle` + `dailyPlanAllClearMessage`; triggered by `isToday && dayTasks.isEmpty && overdueTasks.isEmpty && totalTaskCount > 0` |
**Score: 10/10 truths verified**
---
## Required Artifacts
### Plan 01 Artifacts
| Artifact | Expected | Lines | Status | Details |
|----------|----------|-------|--------|---------|
| `lib/features/home/data/calendar_dao.dart` | Date-parameterized task queries | 87 | VERIFIED | `watchTasksForDate`, `watchOverdueTasks`, `getTaskCount` all implemented; `@DriftAccessor(tables: [Tasks, Rooms, TaskCompletions])` annotation present |
| `lib/features/home/data/calendar_dao.g.dart` | Generated Drift mixin | 25 | VERIFIED | `_$CalendarDaoMixin` generated, part of `calendar_dao.dart` |
| `lib/features/home/domain/calendar_models.dart` | CalendarDayState model | 25 | VERIFIED | `CalendarDayState` with `selectedDate`, `dayTasks`, `overdueTasks`, `totalTaskCount`, `isEmpty` getter |
| `lib/features/home/presentation/calendar_providers.dart` | Riverpod providers | 69 | VERIFIED | `selectedDateProvider` (NotifierProvider), `calendarDayProvider` (StreamProvider.autoDispose) with overdue-today-only logic |
| `test/features/home/data/calendar_dao_test.dart` | DAO unit tests (min 50 lines) | 286 | VERIFIED | 11 tests: 5 for `watchTasksForDate`, 6 for `watchOverdueTasks`; all pass |
### Plan 02 Artifacts
| Artifact | Expected | Lines | Status | Details |
|----------|----------|-------|--------|---------|
| `lib/features/home/presentation/calendar_strip.dart` | Horizontal scrollable date strip (min 100 lines) | 348 | VERIFIED | 181-card ListView, German abbreviations, CalendarStripController, today-visibility callback, month boundary labels |
| `lib/features/home/presentation/calendar_day_list.dart` | Day task list with states (min 80 lines) | 310 | VERIFIED | 5-state machine (loading/first-run/celebration/empty/tasks), overdue section, `_CompletingTaskRow` animation |
| `lib/features/home/presentation/calendar_task_row.dart` | Task row (min 30 lines) | 69 | VERIFIED | Name + room chip + checkbox; `isOverdue` coral styling; no relative date |
| `lib/features/home/presentation/home_screen.dart` | Rewritten HomeScreen (min 40 lines) | 69 | VERIFIED | Stack with Column(CalendarStrip + CalendarDayList) + conditional floating FAB |
---
## Key Link Verification
### Plan 01 Links
| From | To | Via | Status | Details |
|------|----|-----|--------|---------|
| `calendar_dao.dart` | `database.dart` | CalendarDao registered in @DriftDatabase daos | WIRED | `database.dart` L49: `daos: [RoomsDao, TasksDao, DailyPlanDao, CalendarDao]`; `database.g.dart` L1249: `late final CalendarDao calendarDao = CalendarDao(this as AppDatabase)` |
| `calendar_providers.dart` | `calendar_dao.dart` | Provider reads CalendarDao from AppDatabase via `db.calendarDao` | WIRED | `calendar_providers.dart` L46: `db.calendarDao.watchTasksForDate(selectedDate)`; L5354: `db.calendarDao.watchOverdueTasks(selectedDate).first`; L60: `db.calendarDao.getTaskCount()` |
### Plan 02 Links
| From | To | Via | Status | Details |
|------|----|-----|--------|---------|
| `home_screen.dart` | `calendar_strip.dart` | HomeScreen composes CalendarStrip | WIRED | `home_screen.dart` L37: `CalendarStrip(controller: _stripController, ...)` |
| `home_screen.dart` | `calendar_day_list.dart` | HomeScreen composes CalendarDayList | WIRED | `home_screen.dart` L43: `const Expanded(child: CalendarDayList())` |
| `calendar_strip.dart` | `calendar_providers.dart` | Strip reads/writes selectedDateProvider | WIRED | `calendar_strip.dart` L193: `ref.read(selectedDateProvider.notifier).selectDate(tappedDate)`; L199: `ref.watch(selectedDateProvider)` |
| `calendar_day_list.dart` | `calendar_providers.dart` | Day list watches calendarDayProvider | WIRED | `calendar_day_list.dart` L46: `final dayState = ref.watch(calendarDayProvider)` |
| `calendar_day_list.dart` | `task_providers.dart` | Task completion via taskActionsProvider | WIRED | `calendar_day_list.dart` L39: `ref.read(taskActionsProvider.notifier).completeTask(taskId)` |
---
## Requirements Coverage
| Requirement | Source Plan | Description | Status | Evidence |
|-------------|-------------|-------------|--------|---------|
| CAL-01 | Plan 02 | User sees horizontal scrollable date-strip with day abbreviation (Mo, Di...) and date number per card | SATISFIED | `calendar_strip.dart`: 181-card horizontal ListView; `DateFormat('E', 'de')` for German abbreviations; `date.day.toString()` for date number |
| CAL-02 | Plan 01 | User can tap a day card to see that day's tasks in a list below the strip | SATISFIED | `_onCardTapped``selectedDateProvider``calendarDayProvider``CalendarDayList` reactive update |
| CAL-03 | Plan 02 | User sees a subtle color shift at month boundaries for visual orientation | SATISFIED | `_isFirstOfMonth` check triggers `_kMonthBoundaryGap = 16.0` (vs 4px normal) and `DateFormat('MMM', 'de')` month label in `theme.colorScheme.primary` |
| CAL-04 | Plan 02 | Calendar strip auto-scrolls to today on app launch | SATISFIED | `addPostFrameCallback``_animateToToday()``animateTo(200ms, Curves.easeOut)` centered on today's index |
| CAL-05 | Plans 01+02 | Undone tasks carry over to the next day with red/orange color accent | SATISFIED | `watchOverdueTasks` returns tasks with `nextDueDate < today`; `calendarDayProvider` includes them only for `isToday`; `_overdueColor = Color(0xFFE07A5F)` applied to section header and task name text |
**All 5 CAL requirements: SATISFIED**
No orphaned requirements — REQUIREMENTS.md maps CAL-01 through CAL-05 exclusively to Phase 5, all accounted for.
---
## Anti-Patterns Found
No anti-patterns detected. Scan of all 7 phase-created/modified files found:
- No TODO/FIXME/XXX/HACK/PLACEHOLDER comments
- No empty implementations (`return null`, `return {}`, `return []`)
- No stub handlers (`() => {}` or `() => console.log(...)`)
- No unimplemented API routes
---
## Test Results
| Suite | Result | Count |
|-------|--------|-------|
| `flutter test test/features/home/data/calendar_dao_test.dart` | All passed | 11/11 |
| `flutter test` (full suite) | All passed | 101/101 |
| `flutter analyze --no-fatal-infos` | No issues | 0 errors, 0 warnings |
---
## Commit Verification
All 5 commits documented in SUMMARY files confirmed to exist in git history:
| Hash | Description |
|------|-------------|
| `f5c4b49` | test(05-01): add failing tests for CalendarDao |
| `c666f9a` | feat(05-01): implement CalendarDao with date-parameterized task queries |
| `68ba7c6` | feat(05-01): add CalendarDayState model, Riverpod providers, and l10n strings |
| `f718ee8` | feat(05-02): build CalendarStrip, CalendarTaskRow, CalendarDayList widgets |
| `88ef248` | feat(05-02): replace HomeScreen with calendar composition and floating Today button |
---
## Human Verification Required
All automated checks pass. The following items require a device or emulator to confirm:
### 1. Calendar Strip Visual Rendering
**Test:** Launch the app, navigate to the home tab.
**Expected:** Horizontal row of day cards each showing a German day abbreviation (Mo, Di, Mi, Do, Fr, Sa, So) and a date number. All cards have a light sage/green tint background. Today's card has bold text and a 2px green underline accent bar below the date number.
**Why human:** Color fidelity, card proportions, and font weight treatment are visual properties.
### 2. Day Selection Updates Task List
**Test:** Tap several different day cards in the strip.
**Expected:** The tapped card becomes highlighted (stronger green background + border, centered in the strip), and the task list below immediately updates to show that day's scheduled tasks.
**Why human:** Interactive responsiveness and smooth centering animation require a running device.
### 3. Floating Today Button Behavior
**Test:** Scroll the strip well past today (e.g., 30+ days forward). Then tap the floating "Heute" button.
**Expected:** The "Heute" FAB appears when today's card is no longer in the viewport. Tapping it re-centers today's card with a smooth scroll animation and resets the task list to today's tasks. The FAB then disappears.
**Why human:** FAB visibility toggling based on scroll position and imperative scroll-back require real interaction.
### 4. Month Boundary Labels
**Test:** Scroll through a month boundary in the strip.
**Expected:** At the boundary, a small month name label (e.g., "Apr") appears above the first card of the new month, and the gap between the last card of the old month and the first card of the new month is visibly wider than the normal gap.
**Why human:** Gap width and label placement are visual properties.
### 5. Overdue Section Today-Only
**Test:** With at least one task whose nextDueDate is before today in the database, view the home screen on today's date, then tap a past or future date.
**Expected:** On today's view, a coral-colored "Uberfaellig" section header appears above the overdue task(s) with coral-colored task names. Switching to any other day hides the overdue section entirely — only that day's scheduled tasks appear.
**Why human:** Requires real data in the database and navigation between dates.
### 6. Task Completion Slide-Out Animation
**Test:** Tap a checkbox on any task in the day list.
**Expected:** The task row slides out to the right while simultaneously collapsing its height to zero, over approximately 300ms, then disappears from the list.
**Why human:** Animation smoothness, duration, and visual quality require observation on a running device.
---
## Summary
Phase 5 goal is **fully achieved at the code level**. The horizontal calendar strip replaces the stacked daily plan, the data layer correctly handles date-parameterized queries and overdue isolation, all UI widgets are substantive and properly wired, all key links are connected, all 5 CAL requirements are satisfied, and the full 101-test suite passes with zero analysis issues.
The `human_needed` status reflects that 6 visual and interactive behaviors (strip appearance, tap selection, Today button scroll-back, month boundary labels, overdue section isolation, and task completion animation) require a running device to confirm their real-world quality. No code gaps were found.
---
_Verified: 2026-03-16T21:00:00Z_
_Verifier: Claude (gsd-verifier)_

View File

@@ -0,0 +1,312 @@
---
phase: 06-task-history
plan: 01
type: execute
wave: 1
depends_on: []
files_modified:
- lib/features/tasks/data/tasks_dao.dart
- lib/features/tasks/data/tasks_dao.g.dart
- lib/features/tasks/presentation/task_history_sheet.dart
- lib/features/tasks/presentation/task_form_screen.dart
- lib/features/home/presentation/calendar_task_row.dart
- lib/l10n/app_de.arb
- lib/l10n/app_localizations.dart
- lib/l10n/app_localizations_de.dart
- test/features/tasks/data/task_history_dao_test.dart
autonomous: true
requirements: [HIST-01, HIST-02]
must_haves:
truths:
- "Every task completion is recorded with a timestamp and persists across app restarts"
- "User can open a history view from the task edit form showing all past completion dates in reverse-chronological order"
- "History view shows a meaningful empty state if the task has never been completed"
artifacts:
- path: "lib/features/tasks/data/tasks_dao.dart"
provides: "watchCompletionsForTask(int taskId) stream method"
contains: "watchCompletionsForTask"
- path: "lib/features/tasks/presentation/task_history_sheet.dart"
provides: "Bottom sheet displaying task completion history"
exports: ["showTaskHistorySheet"]
- path: "lib/features/tasks/presentation/task_form_screen.dart"
provides: "Verlauf button in edit mode opening history sheet"
contains: "showTaskHistorySheet"
- path: "lib/features/home/presentation/calendar_task_row.dart"
provides: "onTap navigation to task edit form"
contains: "context.go"
- path: "test/features/tasks/data/task_history_dao_test.dart"
provides: "Tests for completion history DAO query"
min_lines: 30
key_links:
- from: "lib/features/tasks/presentation/task_form_screen.dart"
to: "lib/features/tasks/presentation/task_history_sheet.dart"
via: "showTaskHistorySheet call in Verlauf button onTap"
pattern: "showTaskHistorySheet"
- from: "lib/features/tasks/presentation/task_history_sheet.dart"
to: "lib/features/tasks/data/tasks_dao.dart"
via: "watchCompletionsForTask stream consumption"
pattern: "watchCompletionsForTask"
- from: "lib/features/home/presentation/calendar_task_row.dart"
to: "TaskFormScreen"
via: "GoRouter navigation on row tap"
pattern: "context\\.go.*tasks"
---
<objective>
Add task completion history: a DAO query to fetch completions, a bottom sheet to display them, integration into the task edit form, and CalendarTaskRow onTap navigation.
Purpose: Users can see exactly when each task was completed in the past, building trust that the scheduling loop is working correctly.
Output: Working history view accessible from task edit form, completion data surfaced from existing TaskCompletions table.
</objective>
<execution_context>
@/home/jlmak/.claude/get-shit-done/workflows/execute-plan.md
@/home/jlmak/.claude/get-shit-done/templates/summary.md
</execution_context>
<context>
@.planning/PROJECT.md
@.planning/ROADMAP.md
@.planning/STATE.md
@.planning/phases/06-task-history/06-CONTEXT.md
<interfaces>
<!-- Key types and contracts the executor needs. Extracted from codebase. -->
<!-- Executor should use these directly -- no codebase exploration needed. -->
From lib/core/database/database.dart:
```dart
/// TaskCompletions table: records when a task was completed.
class TaskCompletions extends Table {
IntColumn get id => integer().autoIncrement()();
IntColumn get taskId => integer().references(Tasks, #id)();
DateTimeColumn get completedAt => dateTime()();
}
@DriftDatabase(
tables: [Rooms, Tasks, TaskCompletions],
daos: [RoomsDao, TasksDao, DailyPlanDao, CalendarDao],
)
class AppDatabase extends _$AppDatabase { ... }
```
From lib/features/tasks/data/tasks_dao.dart:
```dart
@DriftAccessor(tables: [Tasks, TaskCompletions])
class TasksDao extends DatabaseAccessor<AppDatabase> with _$TasksDaoMixin {
TasksDao(super.attachedDatabase);
Stream<List<Task>> watchTasksInRoom(int roomId) { ... }
Future<int> insertTask(TasksCompanion task) => into(tasks).insert(task);
Future<bool> updateTask(Task task) => update(tasks).replace(task);
Future<void> deleteTask(int taskId) { ... }
Future<void> completeTask(int taskId, {DateTime? now}) { ... }
Future<int> getOverdueTaskCount(int roomId, {DateTime? today}) { ... }
}
```
From lib/features/tasks/presentation/task_form_screen.dart:
```dart
class TaskFormScreen extends ConsumerStatefulWidget {
final int? roomId;
final int? taskId;
const TaskFormScreen({super.key, this.roomId, this.taskId});
bool get isEditing => taskId != null;
}
// build() returns Scaffold with AppBar + Form > ListView with fields
// In edit mode: _existingTask is loaded via _loadExistingTask()
```
From lib/features/home/presentation/calendar_task_row.dart:
```dart
class CalendarTaskRow extends StatelessWidget {
const CalendarTaskRow({
super.key,
required this.taskWithRoom,
required this.onCompleted,
this.isOverdue = false,
});
final TaskWithRoom taskWithRoom;
final VoidCallback onCompleted;
final bool isOverdue;
}
// TaskWithRoom has: task (Task), roomName (String), roomId (int)
```
From lib/features/home/domain/daily_plan_models.dart:
```dart
class TaskWithRoom {
final Task task;
final String roomName;
final int roomId;
const TaskWithRoom({required this.task, required this.roomName, required this.roomId});
}
```
Bottom sheet pattern from lib/features/rooms/presentation/icon_picker_sheet.dart:
```dart
Future<String?> showIconPickerSheet({
required BuildContext context,
String? selectedIconName,
}) {
return showModalBottomSheet<String>(
context: context,
isScrollControlled: true,
builder: (context) => IconPickerSheet(...),
);
}
// Sheet uses SafeArea > Padding > Column(mainAxisSize: MainAxisSize.min) with drag handle
```
Router pattern from lib/core/router/router.dart:
```dart
// Task edit route: /rooms/:roomId/tasks/:taskId
GoRoute(
path: 'tasks/:taskId',
builder: (context, state) {
final taskId = int.parse(state.pathParameters['taskId']!);
return TaskFormScreen(taskId: taskId);
},
),
```
</interfaces>
</context>
<tasks>
<task type="auto" tdd="true">
<name>Task 1: Add DAO query, provider, localization, and tests for completion history</name>
<files>
lib/features/tasks/data/tasks_dao.dart,
lib/features/tasks/data/tasks_dao.g.dart,
lib/l10n/app_de.arb,
lib/l10n/app_localizations.dart,
lib/l10n/app_localizations_de.dart,
test/features/tasks/data/task_history_dao_test.dart
</files>
<behavior>
- watchCompletionsForTask(taskId) returns Stream of TaskCompletion list ordered by completedAt DESC (newest first)
- Empty list returned when no completions exist for a given taskId
- After completeTask(taskId) is called, watchCompletionsForTask(taskId) emits a list containing the new completion with correct timestamp
- Completions for different tasks are isolated (taskId=1 completions do not appear in taskId=2 stream)
- Multiple completions for the same task are all returned in reverse-chronological order
</behavior>
<action>
RED phase:
Create test/features/tasks/data/task_history_dao_test.dart with tests for the behaviors above.
Use the existing in-memory database test pattern: AppDatabase(NativeDatabase.memory()), get TasksDao, insert a room and tasks, then test.
Run tests -- they MUST fail (watchCompletionsForTask does not exist yet).
GREEN phase:
1. In lib/features/tasks/data/tasks_dao.dart, add:
```dart
/// Watch all completions for a task, newest first.
Stream<List<TaskCompletion>> watchCompletionsForTask(int taskId) {
return (select(taskCompletions)
..where((c) => c.taskId.equals(taskId))
..orderBy([(c) => OrderingTerm.desc(c.completedAt)]))
.watch();
}
```
2. Run `dart run build_runner build --delete-conflicting-outputs` to regenerate tasks_dao.g.dart.
3. Run tests -- they MUST pass.
Then add localization strings to lib/l10n/app_de.arb:
- "taskHistoryTitle": "Verlauf"
- "taskHistoryEmpty": "Noch nie erledigt"
- "taskHistoryCount": "{count} Mal erledigt" with @taskHistoryCount placeholder for count (int)
Run `flutter gen-l10n` to regenerate app_localizations.dart and app_localizations_de.dart.
NOTE: No separate Riverpod provider is needed -- the bottom sheet will access the DAO directly via appDatabaseProvider (same pattern as _loadExistingTask in TaskFormScreen). This keeps it simple since the sheet is a one-shot modal, not a long-lived screen.
</action>
<verify>
<automated>cd /home/jlmak/Projects/jlmak/HouseHoldKeaper && flutter test test/features/tasks/data/task_history_dao_test.dart -r expanded && flutter analyze --no-fatal-infos</automated>
</verify>
<done>
watchCompletionsForTask method exists on TasksDao, returns Stream of completions sorted newest-first.
All new DAO tests pass. All 101+ existing tests still pass.
Three German localization strings (taskHistoryTitle, taskHistoryEmpty, taskHistoryCount) are available via AppLocalizations.
</done>
</task>
<task type="auto">
<name>Task 2: Build history bottom sheet, wire into TaskFormScreen, add CalendarTaskRow navigation</name>
<files>
lib/features/tasks/presentation/task_history_sheet.dart,
lib/features/tasks/presentation/task_form_screen.dart,
lib/features/home/presentation/calendar_task_row.dart
</files>
<action>
1. Create lib/features/tasks/presentation/task_history_sheet.dart:
- Export a top-level function: `Future&lt;void&gt; showTaskHistorySheet({required BuildContext context, required int taskId})`
- Uses `showModalBottomSheet` with `isScrollControlled: true` following icon_picker_sheet.dart pattern
- The sheet widget is a ConsumerWidget (needs ref to access DAO)
- Uses `ref.read(appDatabaseProvider).tasksDao.watchCompletionsForTask(taskId)` wrapped in a StreamBuilder
- Layout: SafeArea > Padding(16) > Column(mainAxisSize: min):
a. Drag handle (same as icon_picker_sheet: Container 32x4, onSurfaceVariant 0.4 alpha, rounded)
b. Title: AppLocalizations.of(context).taskHistoryTitle (i.e. "Verlauf"), titleMedium style
c. Optional: completion count summary below title using taskHistoryCount string -- show only when count > 0
d. SizedBox(height: 16)
e. StreamBuilder on watchCompletionsForTask:
- Loading: Center(CircularProgressIndicator())
- Empty data: centered Column with Icon(Icons.history, size: 48, color: onSurfaceVariant) + SizedBox(8) + Text(taskHistoryEmpty), style: bodyLarge, color: onSurfaceVariant
- Has data: ConstrainedBox(maxHeight: MediaQuery.of(context).size.height * 0.4) > ListView.builder:
Each item: ListTile with leading Icon(Icons.check_circle_outline, color: primary), title: DateFormat('dd.MM.yyyy', 'de').format(completion.completedAt), subtitle: DateFormat('HH:mm', 'de').format(completion.completedAt)
f. SizedBox(height: 8) at bottom
2. Modify lib/features/tasks/presentation/task_form_screen.dart:
- Import task_history_sheet.dart
- In the build() method's ListView children, AFTER the due date picker section and ONLY when `widget.isEditing` is true, add:
```
const SizedBox(height: 24),
const Divider(),
ListTile(
leading: const Icon(Icons.history),
title: Text(l10n.taskHistoryTitle),
trailing: const Icon(Icons.chevron_right),
onTap: () => showTaskHistorySheet(context: context, taskId: widget.taskId!),
),
```
- This adds a "Verlauf" row that opens the history bottom sheet
3. Modify lib/features/home/presentation/calendar_task_row.dart:
- Add an onTap callback to the ListTile that navigates to the task edit form
- The CalendarTaskRow already has access to taskWithRoom.task.id and taskWithRoom.roomId
- Add to ListTile: `onTap: () => context.go('/rooms/${taskWithRoom.roomId}/tasks/${taskWithRoom.task.id}')`
- This enables: CalendarTaskRow tap -> TaskFormScreen (edit mode) -> "Verlauf" button -> history sheet
- Keep the existing onCompleted checkbox behavior unchanged
</action>
<verify>
<automated>cd /home/jlmak/Projects/jlmak/HouseHoldKeaper && flutter test && flutter analyze --no-fatal-infos</automated>
</verify>
<done>
History bottom sheet opens from TaskFormScreen in edit mode via "Verlauf" row.
Sheet shows completion dates in dd.MM.yyyy + HH:mm format, reverse-chronological.
Empty state shows Icons.history + "Noch nie erledigt" message.
CalendarTaskRow tapping navigates to TaskFormScreen for that task.
All existing tests still pass. dart analyze clean.
</done>
</task>
</tasks>
<verification>
Phase 6 verification checks:
1. `flutter test` -- all tests pass (101 existing + new DAO tests)
2. `flutter analyze --no-fatal-infos` -- zero issues
3. Manual flow: Open app > tap a task in calendar > task edit form opens > "Verlauf" row visible > tap it > bottom sheet shows history or empty state
4. Manual flow: Complete a task via checkbox > navigate to that task's edit form > tap "Verlauf" > new completion entry appears with timestamp
</verification>
<success_criteria>
- HIST-01: Task completion recording verified via DAO tests (completions already written by completeTask; new query surfaces them)
- HIST-02: History bottom sheet accessible from task edit form, shows all past completions reverse-chronologically with German date/time formatting, shows meaningful empty state
- CalendarTaskRow tapping navigates to task edit form (history one tap away)
- Zero regressions: all existing tests pass, dart analyze clean
</success_criteria>
<output>
After completion, create `.planning/phases/06-task-history/06-01-SUMMARY.md`
</output>

View File

@@ -0,0 +1,81 @@
# Phase 6: Task History - Context
**Gathered:** 2026-03-16
**Status:** Ready for planning
<domain>
## 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).
</domain>
<decisions>
## 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<TaskCompletion>)
- Whether CalendarTaskRow onTap goes to edit form or directly to history
</decisions>
<specifics>
## Specific Ideas
No specific requirements — user chose "You decide." Open to standard approaches that match existing app patterns.
</specifics>
<code_context>
## 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<AppDatabase>` 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
</code_context>
<deferred>
## Deferred Ideas
None — discussion stayed within phase scope
</deferred>
---
*Phase: 06-task-history*
*Context gathered: 2026-03-16*