diff --git a/WebApp/Components/Features/MeetingSchedule/Index.razor b/WebApp/Components/Features/MeetingSchedule/Index.razor index dcf91b9..17de2ad 100644 --- a/WebApp/Components/Features/MeetingSchedule/Index.razor +++ b/WebApp/Components/Features/MeetingSchedule/Index.razor @@ -489,10 +489,11 @@ slot.Teams = restoredTeams; // Recalculate overlaps and unscheduled students with full teams - // Filter out excluded students when calculating overlaps + // Filter out excluded students when calculating overlaps and unscheduled students var teamsForOverlapCalculation = GetTeamsWithoutExcludedStudents(slot.Teams, slotIndex); slot.StudentOverlaps = TeamSchedulerSolution.GetStudentTeamOverlaps(teamsForOverlapCalculation); - slot.UnscheduledStudents = TeamSchedulerSolution.GetStudentsNotInTimSlot(slot.Teams, availableStudents); + // Use teams without excluded students so students excluded from all teams appear as unscheduled + slot.UnscheduledStudents = TeamSchedulerSolution.GetStudentsNotInTimSlot(teamsForOverlapCalculation, availableStudents); } // Post-process: extend teams to next consecutive time slot @@ -565,8 +566,11 @@ } nextSlot.Teams = nextSlotTeamsList.ToArray(); - nextSlot.StudentOverlaps = TeamSchedulerSolution.GetStudentTeamOverlaps(nextSlot.Teams); - nextSlot.UnscheduledStudents = TeamSchedulerSolution.GetStudentsNotInTimSlot(nextSlot.Teams, allStudents); + var nextSlotIndex = slotIndex + 1; + var nextSlotTeamsForOverlap = GetTeamsWithoutExcludedStudents(nextSlot.Teams, nextSlotIndex); + nextSlot.StudentOverlaps = TeamSchedulerSolution.GetStudentTeamOverlaps(nextSlotTeamsForOverlap); + // Use teams without excluded students so students excluded from all teams appear as unscheduled + nextSlot.UnscheduledStudents = TeamSchedulerSolution.GetStudentsNotInTimSlot(nextSlotTeamsForOverlap, allStudents); } // Extend backward: add to previous time slot (if exists) @@ -589,7 +593,8 @@ var previousSlotIndex = slotIndex - 1; var previousSlotTeamsForOverlap = GetTeamsWithoutExcludedStudents(previousSlot.Teams, previousSlotIndex); previousSlot.StudentOverlaps = TeamSchedulerSolution.GetStudentTeamOverlaps(previousSlotTeamsForOverlap); - previousSlot.UnscheduledStudents = TeamSchedulerSolution.GetStudentsNotInTimSlot(previousSlot.Teams, allStudents); + // Use teams without excluded students so students excluded from all teams appear as unscheduled + previousSlot.UnscheduledStudents = TeamSchedulerSolution.GetStudentsNotInTimSlot(previousSlotTeamsForOverlap, allStudents); } } }