Add student-level Vorgänge tab and homework/lateness dashboard warnings
CI / build-and-test (push) Canceled after 0s
CI / build-and-test (push) Canceled after 0s
Dashboard warnings (attendance, and now homework backlog and lateness) apply across all classes, but the existing Vorgänge case-file tab only works for the teacher's own class since it resolves the WebUntis classbook roster. Instead of loosening that coupling, students get their own narrower Vorgänge tab, and all three cross-class warnings now jump straight there, offering to open a matching case or create a new one. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4b73d2bea2
commit
3270b48850
16 files changed
+963
-21
No files matched your search
@@ -4,6 +4,7 @@ using LehrerApp.Core.Interfaces;
|
||||
using LehrerApp.Core.Models;
|
||||
using LehrerApp.Core.Services;
|
||||
using LehrerApp.Desktop.Services;
|
||||
using LehrerApp.Desktop.ViewModels.Groups;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Globalization;
|
||||
|
||||
@@ -54,6 +55,13 @@ public partial class DashboardViewModel : ObservableObject
|
||||
/// hat rein rechnerisch schon 100 %, das ist noch kein auffälliges Muster, nur eine zu kleine
|
||||
/// Stichprobe. Dieselbe Konstante wie GroupOverviewViewModel.AttendanceMinSampleSize.
|
||||
private const int AttendanceMinSampleSize = 8;
|
||||
/// Nutzer-Entscheidung: ab 3 offenen/überfälligen Hausaufgaben im laufenden Schuljahr (alle
|
||||
/// Gruppen) wird gewarnt. Keine Mindeststichprobe wie bei der Fehlzeitenquote nötig — das ist
|
||||
/// hier ein absoluter Zähler, kein Anteil, der bei wenigen Terminen künstlich hoch ausfallen kann.
|
||||
private const int MissingHomeworkWarningThreshold = 3;
|
||||
/// Nutzer-Entscheidung: ab 8 Verspätungen (Late/SignificantlyLate) im laufenden Schuljahr
|
||||
/// (alle Gruppen) wird gewarnt.
|
||||
private const int LatenessWarningThreshold = 8;
|
||||
/// Nutzer-Feedback: "ich vergesse es, und fasse die App auch außerhalb der Schule manchmal
|
||||
/// nicht mehr an" — die Erinnerung an fehlende Unterrichtszeit-Erfassung schaut deshalb nicht
|
||||
/// nur auf heute zurück, sondern auf ein paar Tage, damit ein vergessener Tag nicht verloren
|
||||
@@ -107,6 +115,8 @@ public partial class DashboardViewModel : ObservableObject
|
||||
|
||||
private readonly List<OpenExcuseItem> _excuses = [];
|
||||
private readonly List<AttentionItem> _attendanceItems = [];
|
||||
private readonly List<AttentionItem> _missingHomeworkItems = [];
|
||||
private readonly List<AttentionItem> _latenessItems = [];
|
||||
private readonly List<AttentionItem> _supportItems = [];
|
||||
private readonly List<AttentionItem> _correctionItems = [];
|
||||
private readonly List<AttentionItem> _unplannedItems = [];
|
||||
@@ -119,10 +129,13 @@ public partial class DashboardViewModel : ObservableObject
|
||||
private static readonly (AttentionKind Kind, string Header)[] AttentionGroupOrder =
|
||||
[
|
||||
(AttentionKind.MissingTeachingTime, "Unterrichtszeit nacherfassen"),
|
||||
// Die Fehlzeitenquote ist auch in fremden Klassen unmittelbar relevant, waehrend offene
|
||||
// Entschuldigungen nur fuer die eigene Klasse bearbeitet werden koennen. Deshalb steht sie
|
||||
// im Dashboard vor den Entschuldigungen statt weiter unten zwischen den sonstigen Hinweisen.
|
||||
// Die Fehlzeitenquote, Hausaufgaben- und Verspätungs-Warnungen sind auch in fremden Klassen
|
||||
// unmittelbar relevant, waehrend offene Entschuldigungen nur fuer die eigene Klasse bearbeitet
|
||||
// werden koennen. Deshalb stehen alle drei im Dashboard vor den Entschuldigungen statt weiter
|
||||
// unten zwischen den sonstigen Hinweisen.
|
||||
(AttentionKind.Attendance, "Fehlzeiten-Warnung"),
|
||||
(AttentionKind.Lateness, "Verspätungen-Warnung"),
|
||||
(AttentionKind.MissingHomework, "Hausaufgaben-Warnung"),
|
||||
(AttentionKind.Excuse, "Offene Entschuldigungen"),
|
||||
(AttentionKind.Correction, "Offene Korrekturen"),
|
||||
(AttentionKind.Unplanned, "Ungeplante Stunden"),
|
||||
@@ -133,6 +146,11 @@ public partial class DashboardViewModel : ObservableObject
|
||||
// Navigation-Callback – wird von App.axaml.cs verdrahtet
|
||||
public Action<Guid>? OnNavigateToGroup { get; set; }
|
||||
public Action<Guid>? OnNavigateToStudent { get; set; }
|
||||
// Sprungziel für die drei klassenübergreifenden Warnungen (Fehlzeiten/Hausaufgaben/Verspätungen)
|
||||
// direkt auf den "Vorgänge"-Tab des Schülerdetails (Guid Schüler, string vorgeschlagenes Tag,
|
||||
// string vorgeschlagener Titel) — eigenes Delegate statt OnNavigateToStudent zu erweitern, damit
|
||||
// dessen übrige Aufrufer (Förderplan, Auffälligkeiten, Termine) unverändert bleiben.
|
||||
public Action<Guid, string, string>? OnNavigateToStudentCase { get; set; }
|
||||
// Sprungziel eigens für eine Stunde in TodaysLessons (9.2) — bewusst getrennt von
|
||||
// OnNavigateToGroup (Lerngruppen-Kacheln, Tab "Übersicht"), da der Sprung von einer konkreten
|
||||
// Stunde aus sinnvollerweise direkt in die Mitarbeitserfassung führt.
|
||||
@@ -160,7 +178,8 @@ public partial class DashboardViewModel : ObservableObject
|
||||
public int OpenTaskCount => OpenTasks.Count;
|
||||
public int UpcomingCount => UpcomingDates.Count;
|
||||
public int AttentionCount => _excuses.Count + _attendanceItems.Count + _supportItems.Count
|
||||
+ _correctionItems.Count + _unplannedItems.Count + _alertItems.Count + _missingTimeItems.Count;
|
||||
+ _correctionItems.Count + _unplannedItems.Count + _alertItems.Count + _missingTimeItems.Count
|
||||
+ _missingHomeworkItems.Count + _latenessItems.Count;
|
||||
public string TodayLessonSummary => TodayLessonCount == 1 ? "1 Stunde" : $"{TodayLessonCount} Stunden";
|
||||
public string OpenTaskSummary => OpenTaskCount == 1 ? "1 Aufgabe" : $"{OpenTaskCount} Aufgaben";
|
||||
public string AttentionSummary => AttentionCount == 1 ? "1 offener Punkt" : $"{AttentionCount} offene Punkte";
|
||||
@@ -286,6 +305,8 @@ public partial class DashboardViewModel : ObservableObject
|
||||
LoadCalendar();
|
||||
LoadOpenExcuses(groups.Values.ToList(), today);
|
||||
LoadAttendanceWarnings(today);
|
||||
LoadMissingHomeworkWarnings(today);
|
||||
LoadLatenessWarnings(today);
|
||||
LoadExamWeekLoads(groups, today);
|
||||
LoadMissingTeachingTime(today);
|
||||
LoadSupportPlanReviews(today);
|
||||
@@ -374,16 +395,19 @@ public partial class DashboardViewModel : ObservableObject
|
||||
|
||||
// ── Fehlzeiten-Warnung (5.2.3) ────────────────────────────────────────────
|
||||
|
||||
/// Ein Bulk-Laden aller Sitzungen vermeidet, für jeden Mitarbeits-Eintrag jedes Schülers einzeln
|
||||
/// GetById aufzurufen (N+1 bei vielen Schülern/Einträgen) — von allen drei klassenübergreifenden
|
||||
/// Warnungen (Fehlzeiten/Hausaufgaben/Verspätungen) genutzt.
|
||||
private Dictionary<Guid, DateOnly> BuildSessionDateLookup() =>
|
||||
_participationSessions.GetAll().ToDictionary(s => s.Id, s => s.Date);
|
||||
|
||||
private void LoadAttendanceWarnings(DateOnly today)
|
||||
{
|
||||
_attendanceItems.Clear();
|
||||
var schoolYear = _sy.CurrentSchoolYear();
|
||||
var from = _sy.SchoolYearStart(schoolYear);
|
||||
var to = _sy.SchoolYearEnd(schoolYear);
|
||||
|
||||
// Ein Bulk-Laden aller Sitzungen vermeidet, für jeden Mitarbeits-Eintrag jedes Schülers
|
||||
// einzeln GetById aufzurufen (N+1 bei vielen Schülern/Einträgen).
|
||||
var sessionDates = _participationSessions.GetAll().ToDictionary(s => s.Id, s => s.Date);
|
||||
var sessionDates = BuildSessionDateLookup();
|
||||
|
||||
var items = new List<AttendanceWarningItem>();
|
||||
foreach (var student in _students.GetAll())
|
||||
@@ -404,7 +428,68 @@ public partial class DashboardViewModel : ObservableObject
|
||||
|
||||
private AttentionItem ToAttentionItem(AttendanceWarningItem w) => new(
|
||||
AttentionKind.Attendance, w.StudentName, trailingText: $"{w.AbsenceRatePercent:0.#} %",
|
||||
isWarningTrailing: true, navigate: () => OnNavigateToStudent?.Invoke(w.StudentId));
|
||||
isWarningTrailing: true,
|
||||
navigate: () => OnNavigateToStudentCase?.Invoke(w.StudentId, "Absentismus", "Fehlzeiten"));
|
||||
|
||||
// ── Hausaufgaben-Warnung (Nutzer-Feedback: analog zur Fehlzeiten-Warnung, klassenübergreifend) ──
|
||||
|
||||
private void LoadMissingHomeworkWarnings(DateOnly today)
|
||||
{
|
||||
_missingHomeworkItems.Clear();
|
||||
var schoolYear = _sy.CurrentSchoolYear();
|
||||
var from = _sy.SchoolYearStart(schoolYear);
|
||||
var to = _sy.SchoolYearEnd(schoolYear);
|
||||
var sessionDates = BuildSessionDateLookup();
|
||||
|
||||
var items = new List<MissingHomeworkWarningItem>();
|
||||
foreach (var student in _students.GetAll())
|
||||
{
|
||||
var count = _participationEntries.GetByStudent(student.Id)
|
||||
.Count(e => sessionDates.TryGetValue(e.SessionId, out var date) && date >= from && date <= to
|
||||
&& HomeworkDisplay.CountsAsMissing(HomeworkDisplay.Effective(e)));
|
||||
if (count >= MissingHomeworkWarningThreshold)
|
||||
items.Add(new MissingHomeworkWarningItem(student.Id, student.FullName, count));
|
||||
}
|
||||
foreach (var item in items.OrderByDescending(i => i.MissingCount))
|
||||
_missingHomeworkItems.Add(ToAttentionItem(item));
|
||||
}
|
||||
|
||||
private AttentionItem ToAttentionItem(MissingHomeworkWarningItem w) => new(
|
||||
AttentionKind.MissingHomework, w.StudentName, trailingText: $"{w.MissingCount} offen",
|
||||
isWarningTrailing: true,
|
||||
navigate: () => OnNavigateToStudentCase?.Invoke(w.StudentId, "Hausaufgaben", "Hausaufgaben"));
|
||||
|
||||
// ── Verspätungs-Warnung (Nutzer-Feedback: analog zur Fehlzeiten-Warnung, klassenübergreifend) ──
|
||||
//
|
||||
// Late/SignificantlyLate zählen bewusst NICHT in AttendanceBalanceService.Calculate hinein (dort
|
||||
// gelten sie als Present für die Fehlzeitenquote, siehe Klassenkommentar dort) — diese Zählung
|
||||
// läuft deshalb unabhängig davon direkt über die rohen ParticipationEntry-Einträge.
|
||||
|
||||
private void LoadLatenessWarnings(DateOnly today)
|
||||
{
|
||||
_latenessItems.Clear();
|
||||
var schoolYear = _sy.CurrentSchoolYear();
|
||||
var from = _sy.SchoolYearStart(schoolYear);
|
||||
var to = _sy.SchoolYearEnd(schoolYear);
|
||||
var sessionDates = BuildSessionDateLookup();
|
||||
|
||||
var items = new List<LatenessWarningItem>();
|
||||
foreach (var student in _students.GetAll())
|
||||
{
|
||||
var count = _participationEntries.GetByStudent(student.Id)
|
||||
.Count(e => sessionDates.TryGetValue(e.SessionId, out var date) && date >= from && date <= to
|
||||
&& e.Attendance is AttendanceStatus.Late or AttendanceStatus.SignificantlyLate);
|
||||
if (count >= LatenessWarningThreshold)
|
||||
items.Add(new LatenessWarningItem(student.Id, student.FullName, count));
|
||||
}
|
||||
foreach (var item in items.OrderByDescending(i => i.LateCount))
|
||||
_latenessItems.Add(ToAttentionItem(item));
|
||||
}
|
||||
|
||||
private AttentionItem ToAttentionItem(LatenessWarningItem w) => new(
|
||||
AttentionKind.Lateness, w.StudentName, trailingText: $"{w.LateCount}× verspätet",
|
||||
isWarningTrailing: true,
|
||||
navigate: () => OnNavigateToStudentCase?.Invoke(w.StudentId, "Verspätungen", "Verspätungen"));
|
||||
|
||||
// ── Klausurwochen (Nutzer-Feedback) ───────────────────────────────────────
|
||||
//
|
||||
@@ -757,6 +842,8 @@ public partial class DashboardViewModel : ObservableObject
|
||||
[AttentionKind.Unplanned] = _unplannedItems,
|
||||
[AttentionKind.Alert] = _alertItems,
|
||||
[AttentionKind.Attendance] = _attendanceItems,
|
||||
[AttentionKind.MissingHomework] = _missingHomeworkItems,
|
||||
[AttentionKind.Lateness] = _latenessItems,
|
||||
[AttentionKind.SupportPlan] = _supportItems,
|
||||
};
|
||||
|
||||
@@ -1200,6 +1287,20 @@ public class AttendanceWarningItem(Guid studentId, string studentName, double ab
|
||||
public double AbsenceRatePercent { get; } = absenceRatePercent;
|
||||
}
|
||||
|
||||
public class MissingHomeworkWarningItem(Guid studentId, string studentName, int missingCount)
|
||||
{
|
||||
public Guid StudentId { get; } = studentId;
|
||||
public string StudentName { get; } = studentName;
|
||||
public int MissingCount { get; } = missingCount;
|
||||
}
|
||||
|
||||
public class LatenessWarningItem(Guid studentId, string studentName, int lateCount)
|
||||
{
|
||||
public Guid StudentId { get; } = studentId;
|
||||
public string StudentName { get; } = studentName;
|
||||
public int LateCount { get; } = lateCount;
|
||||
}
|
||||
|
||||
public class ExamWeekLoadItem(int isoWeek, DateOnly weekStart, DateOnly weekEnd, int examCount)
|
||||
{
|
||||
public int ExamCount { get; } = examCount;
|
||||
|
||||
Reference in new issue
Block a user