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.
42 lines
1.2 KiB
C#
42 lines
1.2 KiB
C#
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();
|
|
}
|
|
}
|