Files
HouseHoldKeaper/lib/features/home/domain/calendar_models.dart
Jean-Luc Makiola 9a67c51568 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
2026-04-03 21:25:44 +02:00

32 lines
1.2 KiB
Dart

import 'package:household_keeper/features/home/domain/daily_plan_models.dart';
/// 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).
final int totalTaskCount;
const CalendarDayState({
required this.selectedDate,
required this.dayTasks,
required this.overdueTasks,
this.prePopulatedTasks = const [],
required this.totalTaskCount,
});
/// True when day tasks, overdue tasks, and pre-populated tasks are all empty.
bool get isEmpty =>
dayTasks.isEmpty && overdueTasks.isEmpty && prePopulatedTasks.isEmpty;
}