fix(A1): Übungen an Stufen binden, Gates entkoppeln, Tages-Abschluss
Deploy Development / deploy (push) Successful in 49s
Test Suite / pytest-backend (push) Failing after 4m46s
Test Suite / k6 /api/health Baseline (push) Has been skipped
Test Suite / playwright-smoke (push) Has been skipped
Test Suite / lint-backend (push) Successful in 2s
Test Suite / compose-smoke (push) Has been skipped
Deploy Development / deploy (push) Successful in 49s
Test Suite / pytest-backend (push) Failing after 4m46s
Test Suite / k6 /api/health Baseline (push) Has been skipped
Test Suite / playwright-smoke (push) Has been skipped
Test Suite / lint-backend (push) Successful in 2s
Test Suite / compose-smoke (push) Has been skipped
Activity Set pro Stufe statt Gate-Titel-Recurring; Single-Active-Stufe bei Reopen; Complete heute schliesst Next Action; Heute-Panel fuer alle Uebungen der aktiven Stufe. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
b7d88ce24a
commit
19e962d8ec
17 files changed
+620
-209
No files matched your search
@@ -37,14 +37,15 @@ def test_complete_daily_practice_advances_cadence(client):
|
||||
body = completed.json()
|
||||
assert body["completed_instance"]["status"] == "completed"
|
||||
assert body["completed_instance"]["measurement_note"] == "45° Spagat gehalten"
|
||||
assert body["next_instance"]["status"] == "open"
|
||||
assert body["next_due_at"]
|
||||
assert body["recurring"]["next_due_at"]
|
||||
|
||||
refreshed = client.get(
|
||||
f"/api/initiatives/{initiative_id}/recurring",
|
||||
headers=_auth(token),
|
||||
).json()
|
||||
assert refreshed[0]["open_cadence_instance"]["id"] == body["next_instance"]["id"]
|
||||
assert refreshed[0]["today_completed"] is True
|
||||
assert refreshed[0]["today_measurement_note"] == "45° Spagat gehalten"
|
||||
|
||||
|
||||
def test_steering_next_action_includes_recurring_id(client):
|
||||
@@ -68,3 +69,40 @@ def test_steering_next_action_includes_recurring_id(client):
|
||||
recurring_items = [a for a in next_actions if a.get("kind") == "recurring_due"]
|
||||
assert recurring_items
|
||||
assert recurring_items[0].get("recurring_id")
|
||||
|
||||
|
||||
def test_steering_next_action_excludes_completed_today(client):
|
||||
user = provision_user_in_tenant(tenant_role="admin")
|
||||
token = _login(client, user)
|
||||
|
||||
created = _create_initiative(
|
||||
client,
|
||||
token,
|
||||
title="Spagat Complete Today",
|
||||
archetype_key="initiative.maturity_journey",
|
||||
)
|
||||
initiative_id = created.json()["id"]
|
||||
|
||||
recurring = client.get(
|
||||
f"/api/initiatives/{initiative_id}/recurring",
|
||||
headers=_auth(token),
|
||||
).json()
|
||||
recurring_id = recurring[0]["id"]
|
||||
|
||||
completed = client.post(
|
||||
f"/api/recurring/{recurring_id}/complete",
|
||||
json={"measurement_note": "done"},
|
||||
headers=_auth(token),
|
||||
)
|
||||
assert completed.status_code == 200
|
||||
|
||||
snap = client.get(
|
||||
f"/api/initiatives/{initiative_id}/steering-snapshot",
|
||||
headers=_auth(token),
|
||||
)
|
||||
assert snap.status_code == 200
|
||||
next_actions = snap.json().get("next_actions") or []
|
||||
completed_again = [
|
||||
a for a in next_actions if a.get("recurring_id") == recurring_id
|
||||
]
|
||||
assert not completed_again
|
||||
@@ -51,7 +51,8 @@ def test_create_initiative_a1_applies_starter_kit(client):
|
||||
headers=_auth(token),
|
||||
)
|
||||
assert recurring.status_code == 200
|
||||
assert any(r["title"] == "Tägliche Übung" for r in recurring.json())
|
||||
assert any(r["title"] == "Vorbeuge-Dehnung" for r in recurring.json())
|
||||
assert any(r["roadmap_item_id"] for r in recurring.json())
|
||||
|
||||
|
||||
def test_create_initiative_b2b_starter_kit(client):
|
||||
|
||||
@@ -6,7 +6,7 @@ from tests.factories import provision_user_in_tenant
|
||||
from tests.test_initiatives_actions import _auth, _create_initiative, _login
|
||||
|
||||
_STAGE1 = "Stufe 1 — Basis"
|
||||
_STARTER_RECURRING = "Tägliche Übung"
|
||||
_STAGE1_EXERCISES = ("Vorbeuge-Dehnung", "Hüftöffner (Schmetterling)")
|
||||
|
||||
|
||||
def _create_spagat(client, token):
|
||||
@@ -54,7 +54,8 @@ def test_a1_starter_kit_spagat_structure(client):
|
||||
headers=_auth(token),
|
||||
)
|
||||
assert recurring.status_code == 200
|
||||
assert any(r["title"] == _STARTER_RECURRING and r["status"] == "active" for r in recurring.json())
|
||||
assert any(r["title"] == _STAGE1_EXERCISES[0] and r["status"] == "active" for r in recurring.json())
|
||||
assert any(r["title"] == _STAGE1_EXERCISES[1] and r["status"] == "active" for r in recurring.json())
|
||||
|
||||
projects = client.get(
|
||||
f"/api/initiatives/{initiative_id}/projects",
|
||||
@@ -122,8 +123,11 @@ def test_a1_stage_verify_rotates_recurring_and_next_action(client):
|
||||
headers=_auth(token),
|
||||
).json()
|
||||
titles = {r["title"]: r["status"] for r in recurring}
|
||||
assert titles.get(_STARTER_RECURRING) == "paused"
|
||||
assert any(t.startswith("Übung — Stufe 2") and titles[t] == "active" for t in titles)
|
||||
for title in _STAGE1_EXERCISES:
|
||||
assert titles.get(title) == "paused"
|
||||
assert any(
|
||||
t.startswith("Seitlicher Spagat") and titles[t] == "active" for t in titles
|
||||
)
|
||||
|
||||
items_after = client.get(
|
||||
f"/api/initiatives/{initiative_id}/roadmap/items",
|
||||
@@ -139,8 +143,10 @@ def test_a1_stage_verify_rotates_recurring_and_next_action(client):
|
||||
assert snap_after.status_code == 200
|
||||
next_after = snap_after.json().get("next_actions") or []
|
||||
assert next_after
|
||||
assert next_after[0].get("kind") == "recurring_due" or next_after[0].get("title", "").startswith(
|
||||
"Übung —"
|
||||
assert next_after[0].get("kind") == "recurring_due" or next_after[0].get("title") in (
|
||||
"Seitlicher Spagat — links",
|
||||
"Seitlicher Spagat — rechts",
|
||||
"Aktive Vorbeuge",
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user