diff --git a/Controls/Components/NextClassDisplayComponent.axaml.cs b/Controls/Components/NextClassDisplayComponent.axaml.cs index 498106e..6f8388a 100644 --- a/Controls/Components/NextClassDisplayComponent.axaml.cs +++ b/Controls/Components/NextClassDisplayComponent.axaml.cs @@ -1,6 +1,5 @@ using System; using System.ComponentModel; -using System.Linq; using ClassIsland.Shared.ComponentModels; using Avalonia.Interactivity; using ClassIsland.Core.Abstractions.Controls; @@ -22,8 +21,6 @@ public partial class NextClassDisplayComponent : ComponentBase x.TimeType == 0) - .ToList(); - - foreach (var candidateTime in validLessonSlots) - { - if (candidateTime.StartTime <= now) - { - continue; - } - - var candidateClassInfo = classPlan.Classes.FirstOrDefault(x => ReferenceEquals(x.CurrentTimeLayoutItem, candidateTime)); - if (candidateClassInfo == null) - { - continue; - } - - if (!candidateClassInfo.IsEnabled) - { - continue; - } - - if (!_profileService.Profile.Subjects.TryGetValue(candidateClassInfo.SubjectId, out var subject)) - { - continue; - } - - HasNextClass = true; - SubjectName = subject.Name; - TimeRangeText = $"{candidateTime.StartTime:hh\\:mm}-{candidateTime.EndTime:hh\\:mm}"; - TeacherName = string.IsNullOrWhiteSpace(subject.TeacherName) ? string.Empty : subject.TeacherName; - return; - } - - ApplyNoMoreClasses(); + HasNextClass = true; + SubjectName = nextSubject.Name; + TimeRangeText = $"{nextTimeLayoutItem.StartTime:hh\\:mm}-{nextTimeLayoutItem.EndTime:hh\\:mm}"; + TeacherName = string.IsNullOrWhiteSpace(nextSubject.TeacherName) ? string.Empty : nextSubject.TeacherName; } private void ApplyNoMoreClasses()