Refactor TeamScheduler, easier to read and maintain

This commit is contained in:
2025-12-01 06:58:56 -05:00
parent 69dd517d73
commit 3461f94854
7 changed files with 160 additions and 49 deletions
+27 -4
View File
@@ -2,15 +2,38 @@
namespace Core.Calculation;
/// <summary>
/// Represents a single time slot in the team meeting schedule.
/// </summary>
public class TeamScheduleTimeSlot
{
/// <summary>
/// Gets or sets the name of this time slot.
/// </summary>
public string Name { get; set; }
public Team[] Teams;
public Student[] UnscheduledStudents;
public IEnumerable<Tuple<Student, IEnumerable<Team>>> StudentOverlaps;
/// <summary>
/// Gets or sets the teams scheduled in this time slot.
/// </summary>
public Team[] Teams;
/// <summary>
/// Gets or sets the students who are not scheduled in any team during this time slot.
/// </summary>
public Student[] UnscheduledStudents;
/// <summary>
/// Gets or sets the students who have overlapping team meetings in this time slot.
/// </summary>
public IEnumerable<(Student student, IEnumerable<Team> teams)> StudentOverlaps;
/// <summary>
/// Checks if a student has overlapping team meetings in this time slot.
/// </summary>
/// <param name="student">The student to check</param>
/// <returns>True if the student has overlaps, otherwise false</returns>
public bool StudentHasOverlaps(Student student)
{
return StudentOverlaps.FirstOrDefault(o => o.Item1.Equals(student)) != null;
return StudentOverlaps.Any(o => o.student.Equals(student));
}
}