feat: add debriefing functionality and enhance training unit filtering
Deploy Development / deploy (push) Successful in 36s
Test Suite / pytest-backend (push) Successful in 6s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 6s
Test Suite / playwright-tests (push) Successful in 23s

- Introduced a new filter option for listing training units to show only those with pending debriefs.
- Updated the dashboard to reflect changes in training unit statuses, renaming components for clarity.
- Enhanced the Training Planning Page to manage debrief completion status, including UI elements for user interaction.
- Improved API utility to support new filtering criteria for training units, ensuring accurate data retrieval.
This commit is contained in:
Lars committed 2026-05-07 09:01:01 +02:00
1 parent 40a3b4b8e6
commit ff8fd78a31
5 files changed
+127 -15

No files matched your search

@@ -0,0 +1,10 @@
-- Rückschau / Nachbereitung: explizit abschließbar (Dashboard & Filter)
ALTER TABLE training_units
ADD COLUMN IF NOT EXISTS debrief_completed_at TIMESTAMPTZ NULL;
COMMENT ON COLUMN training_units.debrief_completed_at IS
'Zeitpunkt, zu dem die Trainer-Rückschau (Nachbereitung) bewusst abgeschlossen wurde; NULL = offen';
CREATE INDEX IF NOT EXISTS idx_training_units_debrief_open
ON training_units (status, debrief_completed_at)
WHERE status = 'completed' AND debrief_completed_at IS NULL;
+17 -1
View File
@@ -962,6 +962,10 @@ def list_training_units(
end_date: Optional[str] = Query(default=None),
status: Optional[str] = Query(default=None),
assigned_to_me: bool = Query(default=False),
debrief_pending: bool = Query(
default=False,
description="Nur abgeschlossene Einheiten ohne gesetzte Rückschau (debrief_completed_at IS NULL)",
),
sort: str = Query(default="desc"),
limit: Optional[int] = Query(default=None),
tenant: TenantContext = Depends(get_tenant_context),
@@ -1081,7 +1085,11 @@ def list_training_units(
where.append("tu.planned_date <= %s")
params.append(end_date)
if status:
if debrief_pending:
where.append("tu.status = %s")
params.append("completed")
where.append("tu.debrief_completed_at IS NULL")
elif status:
where.append("tu.status = %s")
params.append(status)
@@ -1384,6 +1392,13 @@ def update_training_unit(unit_id: int, data: dict, tenant: TenantContext = Depen
assist_sql = ", assistant_trainer_profile_ids = %s"
assist_params.append(na)
debrief_frag = ""
if "debrief_completed" in data and not is_blueprint:
if data.get("debrief_completed") is True:
debrief_frag = ", debrief_completed_at = NOW()"
else:
debrief_frag = ", debrief_completed_at = NULL"
cur.execute(
f"""
UPDATE training_units SET
@@ -1402,6 +1417,7 @@ def update_training_unit(unit_id: int, data: dict, tenant: TenantContext = Depen
updated_at = NOW()
{lead_sql}
{assist_sql}
{debrief_frag}
WHERE id = %s
""",
(