Refactor training phase handling in backend and enhance TrainingUnitSectionsEditor
Deploy Development / deploy (push) Successful in 39s
Test Suite / pytest-backend (push) Successful in 40s
Test Suite / lint-backend (push) Successful in 1s
Test Suite / build-frontend (push) Successful in 11s
Test Suite / k6 /health Baseline (push) Successful in 33s
Test Suite / playwright-tests (push) Successful in 1m7s

- Updated the backend logic to ensure strict ordering of phase indices, preventing UNIQUE constraint violations when phases are duplicated.
- Enhanced the TrainingUnitSectionsEditor component with new state management for editing phase titles and stream names, improving user interaction.
- Implemented conditional rendering for input fields to facilitate inline editing of phase titles and stream names, streamlining the editing process.
This commit is contained in:
Lars committed 2026-05-15 08:02:18 +02:00
1 parent 2e761161ef
commit 613fedfaff
2 files changed
+167 -43

No files matched your search

+4 -4
View File
@@ -1261,9 +1261,9 @@ def _replace_unit_phases(
status_code=400,
detail="phase_kind muss whole_group oder parallel sein",
)
p_oix = ph.get("order_index")
if p_oix is None:
p_oix = pi
# Reihenfolge strikt aus der Liste (pi): vermeidet UNIQUE(tu, order_index)-Kollisionen,
# wenn der Client dieselbe phase_order_index mehrfach trägt (z. B. nach Zuordnungswechseln).
p_oix = int(pi)
cur.execute(
"""
INSERT INTO training_unit_phases (training_unit_id, order_index, phase_kind, title, guidance_notes)
@@ -1272,7 +1272,7 @@ def _replace_unit_phases(
""",
(
unit_id,
int(p_oix),
p_oix,
kind,
ph.get("title"),
ph.get("guidance_notes"),