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:
@@ -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).
|
/// Count overdue tasks in a room (nextDueDate before today).
|
||||||
Future<int> getOverdueTaskCount(int roomId, {DateTime? today}) async {
|
Future<int> getOverdueTaskCount(int roomId, {DateTime? today}) async {
|
||||||
final now = today ?? DateTime.now();
|
final now = today ?? DateTime.now();
|
||||||
|
|||||||
@@ -107,5 +107,13 @@
|
|||||||
"overdue": { "type": "int" }
|
"overdue": { "type": "int" }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"calendarTodayButton": "Heute"
|
"calendarTodayButton": "Heute",
|
||||||
|
"taskHistoryTitle": "Verlauf",
|
||||||
|
"taskHistoryEmpty": "Noch nie erledigt",
|
||||||
|
"taskHistoryCount": "{count} Mal erledigt",
|
||||||
|
"@taskHistoryCount": {
|
||||||
|
"placeholders": {
|
||||||
|
"count": { "type": "int" }
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -519,6 +519,24 @@ abstract class AppLocalizations {
|
|||||||
/// In de, this message translates to:
|
/// In de, this message translates to:
|
||||||
/// **'Heute'**
|
/// **'Heute'**
|
||||||
String get calendarTodayButton;
|
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
|
class _AppLocalizationsDelegate
|
||||||
|
|||||||
@@ -239,4 +239,15 @@ class AppLocalizationsDe extends AppLocalizations {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
String get calendarTodayButton => 'Heute';
|
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';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import 'package:drift/native.dart';
|
import 'package:drift/native.dart';
|
||||||
import 'package:flutter_test/flutter_test.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/core/database/database.dart';
|
||||||
import 'package:household_keeper/features/tasks/domain/effort_level.dart';
|
import 'package:household_keeper/features/tasks/domain/effort_level.dart';
|
||||||
import 'package:household_keeper/features/tasks/domain/frequency.dart';
|
import 'package:household_keeper/features/tasks/domain/frequency.dart';
|
||||||
|
|||||||
Reference in New Issue
Block a user