Excluded cancelled tasks in dashboards
This commit is contained in:
parent
70cdbec5d4
commit
d859524a9e
|
|
@ -210,11 +210,19 @@ final dashboardMetricsProvider = Provider<AsyncValue<DashboardMetrics>>((ref) {
|
|||
(a, b) => a.inSeconds >= b.inSeconds ? a : b,
|
||||
);
|
||||
|
||||
final tasksCreatedToday = tasks.where((task) => isToday(task.createdAt));
|
||||
final tasksCompletedToday = tasks.where(
|
||||
(task) => task.completedAt != null && isToday(task.completedAt!),
|
||||
// Exclude cancelled tasks from dashboard metrics
|
||||
final tasksCreatedToday = tasks.where(
|
||||
(task) => isToday(task.createdAt) && task.status != 'cancelled',
|
||||
);
|
||||
final tasksCompletedToday = tasks.where(
|
||||
(task) =>
|
||||
task.completedAt != null &&
|
||||
isToday(task.completedAt!) &&
|
||||
task.status != 'cancelled',
|
||||
);
|
||||
final openTasks = tasks.where(
|
||||
(task) => task.status != 'completed' && task.status != 'cancelled',
|
||||
);
|
||||
final openTasks = tasks.where((task) => task.status != 'completed');
|
||||
|
||||
final taskById = {for (final task in tasks) task.id: task};
|
||||
final staffOnTask = <String>{};
|
||||
|
|
|
|||
|
|
@ -870,6 +870,8 @@ List<Task> _applyTaskFilters(
|
|||
Map<String, int> _taskStatusCounts(List<Task> tasks) {
|
||||
final counts = <String, int>{};
|
||||
for (final task in tasks) {
|
||||
// Do not include cancelled tasks in dashboard summaries
|
||||
if (task.status == 'cancelled') continue;
|
||||
counts.update(task.status, (value) => value + 1, ifAbsent: () => 1);
|
||||
}
|
||||
return counts;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user