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:
@@ -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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user