Notentendenzen (3+/2-) korrekt in Notenschnitt einrechnen, Abschnittsende-Vorschlag aus Einheit
CI / build-and-test (push) Canceled after 0s

Bisher liess int.TryParse jede Note mit Tendenz durchfallen und WeightedAverage rechnete den
betroffenen Bereich mit 0 statt sie auszulassen - faelschte Notenuebersicht, Zielnoten- und
Was-waere-wenn-Rechner. Ausserdem schlaegt der Mitarbeits-Assistent beim Abschnitt-Abschliessen
jetzt das Ende der zuletzt abgeschlossenen Unterrichtseinheit statt immer "heute" vor.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-30 13:24:16 +02:00
co-authored by Claude Sonnet 5
parent 1215d4ac22
commit a088823b30
5 changed files with 75 additions and 3 deletions
@@ -20,6 +20,7 @@ public partial class ParticipationWizardDialogViewModel : ObservableObject
private readonly IExamRepository _exams;
private readonly IExamResultRepository _results;
private readonly IGradeRepository _grades;
private readonly IUnitRepository _units;
private readonly Dictionary<Guid, GroupMembership> _membershipsByStudent;
private readonly GradingService _grading;
private readonly Guid _groupId;
@@ -75,11 +76,11 @@ public partial class ParticipationWizardDialogViewModel : ObservableObject
IParticipationAspectRepository aspects, IParticipationSectionRepository sectionRepo,
IStudentRepository students, IGroupMembershipRepository memberships,
IExamRepository exams, IExamResultRepository results,
IGradeRepository grades, GradingService grading,
IGradeRepository grades, IUnitRepository units, GradingService grading,
Guid groupId, string schoolYear, GradingSystem gradingSystem, string groupLabel)
{
_sessions = sessions; _entries = entries; _sectionRepo = sectionRepo;
_exams = exams; _results = results; _grades = grades; _grading = grading;
_exams = exams; _results = results; _grades = grades; _units = units; _grading = grading;
_groupId = groupId; _schoolYear = schoolYear; _gradingSystem = gradingSystem;
GroupLabel = groupLabel;
_membershipsByStudent = memberships.GetByGroup(groupId).ToDictionary(m => m.StudentId);
@@ -98,6 +99,7 @@ public partial class ParticipationWizardDialogViewModel : ObservableObject
_rollupPeriod = RollupPeriodOptions[0];
NewSectionLabel = $"Abschnitt {_sectionList.Count + 1}";
NewSectionEndDateText = SuggestSectionEndDate().ToString("dd.MM.yyyy");
if (_students.Count > 0) ShowStudent(0);
}
@@ -277,6 +279,23 @@ public partial class ParticipationWizardDialogViewModel : ObservableObject
_sectionList.Count > 0 ? _sectionList.Max(s => s.EndDate).AddDays(1)
: (_allSessions.Count > 0 ? _allSessions.Min(s => s.Date) : DateOnly.FromDateTime(DateTime.Today));
/// Schlägt als Abschnittsende bewusst nicht immer "heute" vor: Wenn seit Abschnittsbeginn
/// eine Unterrichtseinheit (4.2) abgeschlossen wurde, ist deren Ende meist die fachlich
/// sinnvollere Zäsur für eine Mitarbeit-Teilnote als das Bearbeitungsdatum im Wizard.
private DateOnly SuggestSectionEndDate()
{
var openStart = ComputeOpenStart();
var today = DateOnly.FromDateTime(DateTime.Today);
var completedUnitEnd = _units.GetByGroup(_groupId)
.Where(u => u.Status == UnitStatus.Completed && u.EndDate.HasValue)
.Select(u => u.EndDate!.Value)
.Where(d => d >= openStart && d <= today)
.OrderByDescending(d => d)
.Cast<DateOnly?>()
.FirstOrDefault();
return completedUnitEnd ?? today;
}
private void BuildSections(Guid studentId)
{
Sections.Clear();
@@ -378,6 +397,7 @@ public partial class ParticipationWizardDialogViewModel : ObservableObject
}
NewSectionLabel = $"Abschnitt {_sectionList.Count + 1}";
NewSectionEndDateText = SuggestSectionEndDate().ToString("dd.MM.yyyy");
BuildTimeline(CurrentStudentId);
BuildSections(CurrentStudentId);
}
@@ -350,6 +350,7 @@ public partial class ParticipationTabView : UserControl
App.Services.GetRequiredService<IExamRepository>(),
App.Services.GetRequiredService<IExamResultRepository>(),
App.Services.GetRequiredService<IGradeRepository>(),
App.Services.GetRequiredService<IUnitRepository>(),
App.Services.GetRequiredService<GradingService>(),
tabVm.GroupId, tabVm.SchoolYear, tabVm.GradingSystem, tabVm.GroupLabel);