feat(11-02): add DAO queries, update CalendarDayState, implement pre-population provider
- Add watchAllActiveRecurringTasks() and watchAllActiveRecurringTasksInRoom() to CalendarDao - Add watchCompletionsInRange() for period-completion filtering - Extend CalendarDayState with prePopulatedTasks field (default empty, backward compat) - Update isEmpty getter to include prePopulatedTasks.isEmpty - Add _isInCurrentIntervalWindow() and _calculatePreviousDueDate() helpers - Rewrite calendarDayProvider and roomCalendarDayProvider with pre-population logic - Fix _subtractMonths() year-boundary bug using total-month arithmetic - Add 9 new DAO tests for watchAllActiveRecurringTasks, watchAllActiveRecurringTasksInRoom, watchCompletionsInRange
This commit is contained in:
@@ -1,11 +1,17 @@
|
||||
import 'package:household_keeper/features/home/domain/daily_plan_models.dart';
|
||||
|
||||
/// State for the calendar day view: tasks for the selected date + overdue tasks.
|
||||
/// State for the calendar day view: tasks for the selected date + overdue tasks
|
||||
/// + pre-populated tasks within the current interval window.
|
||||
class CalendarDayState {
|
||||
final DateTime selectedDate;
|
||||
final List<TaskWithRoom> dayTasks;
|
||||
final List<TaskWithRoom> overdueTasks;
|
||||
|
||||
/// Tasks visible via pre-population: recurring tasks whose nextDueDate is in
|
||||
/// the future but whose current interval window includes [selectedDate].
|
||||
/// These are shown with muted styling to distinguish them from due-today tasks.
|
||||
final List<TaskWithRoom> prePopulatedTasks;
|
||||
|
||||
/// Total number of tasks in the database (across all days/rooms).
|
||||
/// Used by the UI to distinguish first-run empty state (no tasks exist at all)
|
||||
/// from celebration state (tasks exist but today's are all done).
|
||||
@@ -15,11 +21,11 @@ class CalendarDayState {
|
||||
required this.selectedDate,
|
||||
required this.dayTasks,
|
||||
required this.overdueTasks,
|
||||
this.prePopulatedTasks = const [],
|
||||
required this.totalTaskCount,
|
||||
});
|
||||
|
||||
/// True when both day tasks and overdue tasks are empty.
|
||||
/// Determined by the UI layer (completion state vs. no tasks at all
|
||||
/// is handled in the widget based on this flag and history context).
|
||||
bool get isEmpty => dayTasks.isEmpty && overdueTasks.isEmpty;
|
||||
/// True when day tasks, overdue tasks, and pre-populated tasks are all empty.
|
||||
bool get isEmpty =>
|
||||
dayTasks.isEmpty && overdueTasks.isEmpty && prePopulatedTasks.isEmpty;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user