Pauschale 8,60 nur bei Ist-Stunden >= geplanter Anwesenheit (6h)

This commit is contained in:
Rob committed 2026-03-27 15:03:56 +01:00
1 parent a1f229a502
commit ebd67c7be1
2 files changed
+14 -1

No files matched your search

+6 -1
View File
@@ -45,6 +45,7 @@ def build_field_dict(
creation_date = date.today()
plan_value: str = config["plan_hours_value"]
plan_threshold: float = float(plan_value)
pauschale_prefix: str = config["pdf_pauschale_prefix"]
pauschale_present_value: str = config["pauschale_present_value"]
ort_field: str = config["pdf_field_ort"]
@@ -65,7 +66,11 @@ def build_field_dict(
if entry.is_present:
fields[f"ist.{idx}"] = entry.hours_german()
fields[f"plan.{idx}"] = plan_value
fields[f"{pauschale_prefix}.{idx}"] = pauschale_present_value
# Pauschale only if actual hours >= planned threshold
if entry.hours is not None and entry.hours >= plan_threshold:
fields[f"{pauschale_prefix}.{idx}"] = pauschale_present_value
else:
fields[f"{pauschale_prefix}.{idx}"] = "0"
else:
fields[f"ist.{idx}"] = ""
fields[f"plan.{idx}"] = ""
+8
View File
@@ -109,6 +109,14 @@ class TestPresentDay:
fields = build_field_dict(_make_attendance(_present(3, 6.0)), cfg, date(2026, 2, 1))
assert fields["pauschale_5.0"] == "1"
def test_pauschale_above_threshold(self, cfg):
fields = build_field_dict(_make_attendance(_present(3, 7.5)), cfg, date(2026, 2, 1))
assert fields["pauschale_5.0"] == "1"
def test_pauschale_below_threshold(self, cfg):
fields = build_field_dict(_make_attendance(_present(3, 5.0)), cfg, date(2026, 2, 1))
assert fields["pauschale_5.0"] == "0"
# ---------------------------------------------------------------------------
# Absent days (K, KK, E, F, P, U)