Arbeitszeit: Auswertung nach Kategorie/Gruppe + Pflichtstunden-Abgleich (Kapitel 6.3)

Dritter Tab "Auswertung": Zeitraum wahlweise Monat oder Schuljahr, Balken je Kategorie
und Gruppe. Neuer WorkloadSettingsService (gleiches JSON-Muster wie PeriodScheduleService)
für die Pflichtstundenzahl pro Woche, bewusst direkt im Auswertungs-Tab editierbar statt
in den Einstellungen, da das Feld nur dort gebraucht wird. Export (6.3.3) bleibt offen,
da er an das noch fehlende Kapitel 11 (Export-Infrastruktur) hängt.
This commit is contained in:
2026-08-15 23:26:06 +02:00
parent d8b05702bc
commit 52bb9c2c2f
10 changed files with 405 additions and 13 deletions
@@ -0,0 +1,41 @@
using System.Text.Json;
namespace LehrerApp.Core.Services;
internal class WorkloadSettingsConfig
{
public double RequiredWeeklyHours { get; set; }
}
/// <summary>Pflichtstundenzahl pro Woche für den Ist-Soll-Abgleich in der Arbeitszeitauswertung (6.3.2).</summary>
public class WorkloadSettingsService
{
private readonly string _configPath;
private WorkloadSettingsConfig _config;
public double RequiredWeeklyHours => _config.RequiredWeeklyHours;
public WorkloadSettingsService(string appDataPath)
{
_configPath = Path.Combine(appDataPath, "workloadsettings.json");
_config = Load();
}
public void SetRequiredWeeklyHours(double hours)
{
_config.RequiredWeeklyHours = hours;
File.WriteAllText(_configPath, JsonSerializer.Serialize(_config));
}
private WorkloadSettingsConfig Load()
{
try
{
if (File.Exists(_configPath))
return JsonSerializer.Deserialize<WorkloadSettingsConfig>(File.ReadAllText(_configPath))
?? new WorkloadSettingsConfig();
}
catch { /* beschädigte Konfiguration -> Standardwert */ }
return new WorkloadSettingsConfig();
}
}