Refactor TeamScheduler, easier to read and maintain
This commit is contained in:
@@ -207,9 +207,25 @@
|
||||
{
|
||||
_isSolving = true;
|
||||
|
||||
// Check if there are any teams to schedule
|
||||
if (!_scheduledTeams.Any())
|
||||
{
|
||||
_isSolving = false;
|
||||
_solution = new TeamSchedulerSolution([], [], "No teams selected");
|
||||
return new TableData<TeamScheduleTimeSlot> { Items = [] };
|
||||
}
|
||||
|
||||
// Filter out absent students
|
||||
var availableStudents = _students.Where(s => !_absentStudents.Contains(s)).ToArray();
|
||||
|
||||
// Check if there are any available students
|
||||
if (availableStudents.Length == 0)
|
||||
{
|
||||
_isSolving = false;
|
||||
_solution = new TeamSchedulerSolution([], [], "No available students");
|
||||
return new TableData<TeamScheduleTimeSlot> { Items = [] };
|
||||
}
|
||||
|
||||
// Update parameters with absent student names
|
||||
_parameters.AbsentStudents = _absentStudents.Select(s => s.FirstNameLastName).ToArray();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user