Refactor TeamScheduler, easier to read and maintain
This commit is contained in:
@@ -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));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user