diff --git a/lib/features/tasks/data/tasks_dao.dart b/lib/features/tasks/data/tasks_dao.dart index 422ac1c..8f8d23d 100644 --- a/lib/features/tasks/data/tasks_dao.dart +++ b/lib/features/tasks/data/tasks_dao.dart @@ -81,6 +81,14 @@ class TasksDao extends DatabaseAccessor with _$TasksDaoMixin { }); } + /// Watch all completions for a task, newest first. + Stream> 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 getOverdueTaskCount(int roomId, {DateTime? today}) async { final now = today ?? DateTime.now(); diff --git a/lib/l10n/app_de.arb b/lib/l10n/app_de.arb index 31a6690..4a96638 100644 --- a/lib/l10n/app_de.arb +++ b/lib/l10n/app_de.arb @@ -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" } + } + } } diff --git a/lib/l10n/app_localizations.dart b/lib/l10n/app_localizations.dart index 7f218ff..85648b6 100644 --- a/lib/l10n/app_localizations.dart +++ b/lib/l10n/app_localizations.dart @@ -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 diff --git a/lib/l10n/app_localizations_de.dart b/lib/l10n/app_localizations_de.dart index 3fdfbae..afceaba 100644 --- a/lib/l10n/app_localizations_de.dart +++ b/lib/l10n/app_localizations_de.dart @@ -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'; + } } diff --git a/test/features/tasks/data/task_history_dao_test.dart b/test/features/tasks/data/task_history_dao_test.dart index 0f05abf..c2dee0d 100644 --- a/test/features/tasks/data/task_history_dao_test.dart +++ b/test/features/tasks/data/task_history_dao_test.dart @@ -1,6 +1,5 @@ import 'package:drift/native.dart'; import 'package:flutter_test/flutter_test.dart'; -import 'package:drift/drift.dart'; import 'package:household_keeper/core/database/database.dart'; import 'package:household_keeper/features/tasks/domain/effort_level.dart'; import 'package:household_keeper/features/tasks/domain/frequency.dart';