feat: expand teaching mode with live timeline and seating quick checks
CI / build-and-test (push) Canceled after 0s
CI / build-and-test (push) Canceled after 0s
This commit is contained in:
@@ -44,6 +44,15 @@ public partial class GroupOverviewViewModel : ObservableObject
|
||||
private readonly GradingService _grading;
|
||||
private readonly SchoolYearService _schoolYear;
|
||||
|
||||
public ObservableCollection<Lesson> TodayLessons { get; } = [];
|
||||
[ObservableProperty] private Lesson? _selectedTeachingLesson;
|
||||
public bool HasTodayLessons => TodayLessons.Count > 0;
|
||||
public Action<Lesson>? OnOpenTeachingMode { get; set; }
|
||||
[RelayCommand] private void StartTeachingMode()
|
||||
{
|
||||
if (SelectedTeachingLesson is { } lesson) OnOpenTeachingMode?.Invoke(lesson);
|
||||
}
|
||||
|
||||
private Guid _groupId;
|
||||
private string _groupName = "";
|
||||
|
||||
@@ -130,6 +139,16 @@ public partial class GroupOverviewViewModel : ObservableObject
|
||||
public void Refresh()
|
||||
{
|
||||
var today = DateOnly.FromDateTime(DateTime.Today);
|
||||
TodayLessons.Clear();
|
||||
if (_groups.GetById(_groupId)?.IsActive == true)
|
||||
foreach (var lesson in _lessons.GetByGroupAndRange(_groupId, today, today)
|
||||
.Where(l => l.Status != LessonStatus.Cancelled)
|
||||
.OrderBy(l => l.StartTime).ThenBy(l => l.LessonNumber))
|
||||
TodayLessons.Add(lesson);
|
||||
var now = TimeOnly.FromDateTime(DateTime.Now);
|
||||
SelectedTeachingLesson = TodayLessons.LastOrDefault(l => l.StartTime <= now)
|
||||
?? TodayLessons.FirstOrDefault();
|
||||
OnPropertyChanged(nameof(HasTodayLessons));
|
||||
LoadNextLesson(today);
|
||||
LoadNextExam(today);
|
||||
LoadYearComparison();
|
||||
|
||||
Reference in New Issue
Block a user