feat(06-01): add watchCompletionsForTask DAO method and history localization strings

- Add watchCompletionsForTask(taskId) to TasksDao: Stream<List<TaskCompletion>> sorted newest first
- Regenerate tasks_dao.g.dart with build_runner
- Add taskHistoryTitle, taskHistoryEmpty, taskHistoryCount to app_de.arb
- Regenerate app_localizations.dart and app_localizations_de.dart
- All 5 new DAO tests pass, zero analyze issues
This commit is contained in:
2026-03-16 21:55:44 +01:00
parent 2687f5e31e
commit ceae7d7d61
5 changed files with 46 additions and 2 deletions

View File

@@ -81,6 +81,14 @@ class TasksDao extends DatabaseAccessor<AppDatabase> with _$TasksDaoMixin {
});
}
/// 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();
}
/// Count overdue tasks in a room (nextDueDate before today).
Future<int> getOverdueTaskCount(int roomId, {DateTime? today}) async {
final now = today ?? DateTime.now();

View File

@@ -107,5 +107,13 @@
"overdue": { "type": "int" }
}
},
"calendarTodayButton": "Heute"
"calendarTodayButton": "Heute",
"taskHistoryTitle": "Verlauf",
"taskHistoryEmpty": "Noch nie erledigt",
"taskHistoryCount": "{count} Mal erledigt",
"@taskHistoryCount": {
"placeholders": {
"count": { "type": "int" }
}
}
}

View File

@@ -519,6 +519,24 @@ abstract class AppLocalizations {
/// In de, this message translates to:
/// **'Heute'**
String get calendarTodayButton;
/// No description provided for @taskHistoryTitle.
///
/// In de, this message translates to:
/// **'Verlauf'**
String get taskHistoryTitle;
/// No description provided for @taskHistoryEmpty.
///
/// In de, this message translates to:
/// **'Noch nie erledigt'**
String get taskHistoryEmpty;
/// No description provided for @taskHistoryCount.
///
/// In de, this message translates to:
/// **'{count} Mal erledigt'**
String taskHistoryCount(int count);
}
class _AppLocalizationsDelegate

View File

@@ -239,4 +239,15 @@ class AppLocalizationsDe extends AppLocalizations {
@override
String get calendarTodayButton => 'Heute';
@override
String get taskHistoryTitle => 'Verlauf';
@override
String get taskHistoryEmpty => 'Noch nie erledigt';
@override
String taskHistoryCount(int count) {
return '$count Mal erledigt';
}
}