Track all assigned IT Staff for My Tasks Tab

This commit is contained in:
Marc Rejohn Castillano 2026-03-01 17:30:31 +08:00
parent c9479f01f0
commit ed078f24ec

View File

@ -183,6 +183,14 @@ class _TasksListScreenState extends ConsumerState<TasksListScreen>
latestAssigneeByTaskId[entry.key] = entry.value.userId; latestAssigneeByTaskId[entry.key] = entry.value.userId;
} }
// Track ALL assigned users per task (not just latest) for "My Tasks" filtering
final assignedUsersByTaskId = <String, Set<String>>{};
for (final a in assignments) {
assignedUsersByTaskId
.putIfAbsent(a.taskId, () => <String>{})
.add(a.userId);
}
final filteredTasks = _applyTaskFilters( final filteredTasks = _applyTaskFilters(
tasks, tasks,
ticketById: ticketById, ticketById: ticketById,
@ -471,7 +479,10 @@ class _TasksListScreenState extends ConsumerState<TasksListScreen>
: filteredTasks : filteredTasks
.where( .where(
(t) => (t) =>
latestAssigneeByTaskId[t.id] == currentUserId, assignedUsersByTaskId[t.id]?.contains(
currentUserId,
) ??
false,
) )
.toList(); .toList();