From 649a0061cf4a547a22be2541284885b51db4b774 Mon Sep 17 00:00:00 2001 From: James Kolpack Date: Mon, 19 Jan 2026 22:42:44 -0500 Subject: [PATCH] Enhance team overlap calculation by excluding absent students This commit updates the GetTeamsWithoutExcludedStudents method to filter out both excluded and absent students during overlap calculations. A new HashSet is introduced to store absent student IDs, improving the accuracy of team compositions. This change ensures that the team formation logic accounts for student availability, enhancing the overall functionality of the meeting schedule feature. --- WebApp/Components/Features/MeetingSchedule/Index.razor | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) 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,