Neue Funktion Schüler austragen statt aus Kurs löschen.

This commit is contained in:
2026-08-15 23:38:42 +02:00
parent 52bb9c2c2f
commit da8d2bb1da
19 changed files with 473 additions and 114 deletions
@@ -2,6 +2,7 @@ using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using LehrerApp.Core.Interfaces;
using LehrerApp.Core.Models;
using LehrerApp.Core.Services;
using System.Collections.ObjectModel;
using System.Collections.Generic;
@@ -140,7 +141,7 @@ public partial class ParticipationTabViewModel : ObservableObject
foreach (var s in students)
{
var membership = memberships.FirstOrDefault(e => e.StudentId == s.Id);
if (membership is not null && !IsMemberAtDate(membership, sessionDate))
if (membership is not null && !GroupMembershipService.IsActiveOn(membership, sessionDate))
continue;
var entry = entries.FirstOrDefault(e => e.StudentId == s.Id)
@@ -157,15 +158,6 @@ public partial class ParticipationTabViewModel : ObservableObject
RebuildColumnsSignal++;
}
private static bool IsMemberAtDate(GroupMembership membership, DateOnly date) => membership.Period switch
{
MembershipPeriod.H1Only => date.Month >= 8 || date.Month <= 1,
MembershipPeriod.H2Only => date.Month >= 2 && date.Month <= 7,
MembershipPeriod.Custom => (membership.JoinedAt is null || date >= membership.JoinedAt.Value)
&& (membership.LeftAt is null || date <= membership.LeftAt.Value),
_ => true,
};
private void SaveRating(Guid sessionId, Guid studentId, string key, int? value)
{
var entry = _entries.GetBySessionAndStudent(sessionId, studentId)