diff --git a/WebApp/Components/Features/MeetingSchedule/Index.razor b/WebApp/Components/Features/MeetingSchedule/Index.razor index 1838376..d1e83c5 100644 --- a/WebApp/Components/Features/MeetingSchedule/Index.razor +++ b/WebApp/Components/Features/MeetingSchedule/Index.razor @@ -426,23 +426,26 @@ } /// - /// Creates teams with excluded students filtered out for overlap calculation. + /// Creates teams with excluded students and absent students filtered out for overlap calculation. /// private Team[] GetTeamsWithoutExcludedStudents(Team[] teams, int timeSlotIndex) { + var absentStudentIds = _absentStudents.Select(s => s.Id).ToHashSet(); + return teams.Select(team => { // Find excluded students for this team in this time slot + // Also exclude absent students from overlap calculations // More efficient: iterate through team students and check exclusions var includedStudents = team.Students - .Where(s => !IsStudentExcluded(team.Id, timeSlotIndex, s.Id)) + .Where(s => !IsStudentExcluded(team.Id, timeSlotIndex, s.Id) && !absentStudentIds.Contains(s.Id)) .ToList(); // If no students are excluded, return original team if (includedStudents.Count == team.Students.Count) return team; - // Create a temporary team with excluded students removed + // Create a temporary team with excluded and absent students removed return new Team { Id = team.Id,