Add intelligent random student picker
CI / build-and-test (push) Canceled after 0s

This commit is contained in:
admin committed 2026-09-29 14:02:48 +02:00
1 parent 770a1833c8
commit c79d96c5ec
7 files changed
+426

No files matched your search

@@ -22,6 +22,7 @@ public partial class MainWindow : Window
private SyncEngine? _syncEngine;
private bool _finalSyncStarted;
private bool _closeAfterFinalSync;
private RandomStudentPickerWindow? _randomStudentPickerWindow;
public MainWindow()
{
@@ -71,6 +72,27 @@ public partial class MainWindow : Window
await new PersonalizeWorksheetDialog { DataContext = dialogVm }.ShowDialog(this);
}
private void OnOpenRandomStudentPicker(object? sender, Avalonia.Interactivity.RoutedEventArgs e)
{
if (_randomStudentPickerWindow is not null)
{
_randomStudentPickerWindow.Activate();
return;
}
var currentGroupId = (DataContext as MainWindowViewModel)?.CurrentGroupDetail?.Group?.Id;
var vm = new RandomStudentPickerViewModel(
App.Services.GetRequiredService<IStudentRepository>(),
App.Services.GetRequiredService<IGroupRepository>(),
App.Services.GetRequiredService<IGroupMembershipRepository>(),
App.Services.GetRequiredService<IParticipationSessionRepository>(),
App.Services.GetRequiredService<IParticipationRepository>(),
currentGroupId);
_randomStudentPickerWindow = new RandomStudentPickerWindow { DataContext = vm };
_randomStudentPickerWindow.Closed += (_, _) => _randomStudentPickerWindow = null;
_randomStudentPickerWindow.Show();
}
private void OnWindowKeyDown(object? sender, KeyEventArgs e)
{
if (DataContext is not MainWindowViewModel vm) return;