Refactor overlap and unscheduled student calculations in MeetingSchedule component
This commit updates the Index.razor component of the MeetingSchedule feature to improve the calculation of student overlaps and unscheduled students. The logic now filters out excluded students when determining overlaps and ensures that students excluded from all teams are correctly identified as unscheduled. These changes enhance the accuracy of the scheduling process and improve the overall user experience.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user