fix(A1): enforce_single_active via roadmaps join (pytest)
All checks were successful
Deploy Development / deploy (push) Successful in 1m1s
Test Suite / pytest-backend (push) Successful in 4m43s
Test Suite / lint-backend (push) Successful in 2s
Test Suite / compose-smoke (push) Has been skipped
Test Suite / k6 /api/health Baseline (push) Successful in 18s
Test Suite / playwright-smoke (push) Successful in 16s
All checks were successful
Deploy Development / deploy (push) Successful in 1m1s
Test Suite / pytest-backend (push) Successful in 4m43s
Test Suite / lint-backend (push) Successful in 2s
Test Suite / compose-smoke (push) Has been skipped
Test Suite / k6 /api/health Baseline (push) Successful in 18s
Test Suite / playwright-smoke (push) Successful in 16s
roadmap_items hat kein initiative_id — Single-Active-Update join auf roadmaps. test_ap20e an Uebungssets angepasst. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
19e962d8ec
commit
192a65a798
|
|
@ -56,13 +56,15 @@ def enforce_single_active_maturity_stage(
|
||||||
"""At most one maturity_stage may be active."""
|
"""At most one maturity_stage may be active."""
|
||||||
cur.execute(
|
cur.execute(
|
||||||
"""
|
"""
|
||||||
UPDATE roadmap_items
|
UPDATE roadmap_items ri
|
||||||
SET status = 'planned', updated_at = NOW()
|
SET status = 'planned', updated_at = NOW()
|
||||||
WHERE tenant_id = %s
|
FROM roadmaps r
|
||||||
AND initiative_id = %s
|
WHERE ri.roadmap_id = r.id
|
||||||
AND item_type = 'maturity_stage'
|
AND ri.tenant_id = %s
|
||||||
AND status IN ('active', 'at_risk')
|
AND r.initiative_id = %s
|
||||||
AND id != %s
|
AND ri.item_type = 'maturity_stage'
|
||||||
|
AND ri.status IN ('active', 'at_risk')
|
||||||
|
AND ri.id != %s
|
||||||
""",
|
""",
|
||||||
(tenant_id, initiative_id, keep_active_id),
|
(tenant_id, initiative_id, keep_active_id),
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -51,8 +51,11 @@ def test_maturity_stage_reached_rotates_recurring(client):
|
||||||
headers=_auth(token),
|
headers=_auth(token),
|
||||||
).json()
|
).json()
|
||||||
titles = {r["title"]: r["status"] for r in recurring}
|
titles = {r["title"]: r["status"] for r in recurring}
|
||||||
assert titles.get("Tägliche Übung") == "paused"
|
assert titles.get("Vorbeuge-Dehnung") == "paused"
|
||||||
assert any(t.startswith("Übung — Stufe 2") for t in titles)
|
assert titles.get("Hüftöffner (Schmetterling)") == "paused"
|
||||||
|
assert any(
|
||||||
|
t.startswith("Seitlicher Spagat") and titles[t] == "active" for t in titles
|
||||||
|
)
|
||||||
|
|
||||||
items_after = client.get(
|
items_after = client.get(
|
||||||
f"/api/initiatives/{initiative_id}/roadmap/items",
|
f"/api/initiatives/{initiative_id}/roadmap/items",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user