Less requests to get Data faster

Load settings with `GetEntryWithSettingsAsync`, update `Hours` and `ViewModels`.
This commit is contained in:
2025-12-25 11:39:44 +01:00
parent 15856d0dd0
commit 656d39f43e
6 changed files with 69 additions and 28 deletions

View File

@@ -1,4 +1,5 @@
using Jugenddienst_Stunden.Models;
using Jugenddienst_Stunden.Types;
namespace Jugenddienst_Stunden.Types;
@@ -8,12 +9,12 @@ internal class BaseResponse {
/// <summary>
/// Monatsübersicht
/// </summary>
public Hours hour { get; set; }
public Types.Hours hour { get; set; }
/// <summary>
/// Stundenliste ... für die Katz?
/// </summary>
public List<Hours> hours { get; set; }
public List<Types.Hours> hours { get; set; }
/// <summary>
/// Liste der Stundeneinträge

View File

@@ -4,24 +4,45 @@ using System.Collections.ObjectModel;
namespace Jugenddienst_Stunden.Types;
public partial class Hours : ObservableObject {
public double? Zeit;
/// <summary>
/// Total time in seconds for the current context.
/// "zeit" is used by the API to represent the current recorded time value.
/// </summary>
public int zeit;
public double? Nominal;
/// <summary>
/// Nominal working time expectation (e.g. seconds per day or month depending on API semantics).
/// Represents the expected amount of time to be worked.
/// </summary>
public int nominal;
//public Dictionary<DateOnly,NominalDay> nominal_day_api;
/// <summary>
/// List of nominal day records returned by the API.
/// May be null when the API does not provide per-day nominal data.
/// </summary>
public List<NominalDay>? Nominal_day_api;
//public Dictionary<int,NominalWeek> nominal_week_api;
/// <summary>
/// List of nominal week records returned by the API.
/// May be null when the API does not provide per-week nominal data.
/// </summary>
public List<NominalWeek>? Nominal_week_api;
//public List<string> time_line;
public double? Zeit_total;
//https://stackoverflow.com/questions/29449641/deserialize-json-when-a-value-can-be-an-object-or-an-empty-array/29450279#29450279
//[JsonConverter(typeof(JsonSingleOrEmptyArrayConverter<Hours>))]
//public Dictionary<int,decimal> zeit_total_daily;
/// <summary>
/// Total time in seconds reported by the API for the current period. Nullable if not provided.
/// </summary>
public double? zeit_total;
/// <summary>
/// Daily total time values returned by the API.
/// Each entry represents a day with its associated time value.
/// </summary>
public List<TimeDay> zeit_total_daily_api;
/// <summary>
/// Collection of daytime entries representing individual recorded time slots or events.
/// Nullable when the API returns no detailed daytime information.
/// </summary>
public List<DayTime>? daytime;
//public List<string> wochensumme;