feat: mark the account own classes in list date
`list date` showed the day but nothing personal, so spotting your own class meant cross-referencing `bookings` by hand. No extra request is needed: each schedule row already carries the account relationship in `Status` -- "Signed In" for a class attended, "Reserved" for one upcoming, empty otherwise (verified live against both cases). class_rows already parsed it; it was simply never displayed. Rows now get a `»` marker and a YOU column with the lowercased status. The compact `classes` renderer gains an equivalent `«you: ...»` suffix. 138 tests, no network required. Co-Authored-By: Claude Opus 5 <[email protected]>
This commit is contained in:
1 parent
8ab4ad4b17
commit
ae3c39b384
3 files changed
+57
-5
No files matched your search
@@ -84,3 +84,42 @@ def test_classes_render_includes_capacity_coach_and_id():
|
||||
assert "coach=Pat Doyle" in out
|
||||
assert "class_id=190917816" in out
|
||||
assert out.count("\n- ") + 1 == 3, "all three classes should be listed"
|
||||
|
||||
|
||||
# --- own-reservation highlighting --------------------------------------------
|
||||
# The schedule row's Status field carries the account's relationship to the
|
||||
# class ("Signed In", "Reserved", "" for none). Verified live 2026-07-25.
|
||||
|
||||
def _day_with_status():
|
||||
day = {"Response": {"ResponseClassList": {"Class": {"List": [
|
||||
_row("1", "CrossFit: 12:00 PM", "12:00:00", "133059", 10, "Chris Nolan"),
|
||||
_row("2", "CrossFit: 5:30 PM", "17:30:00", "133059", 9, "Pat Doyle"),
|
||||
]}}}}
|
||||
day["Response"]["ResponseClassList"]["Class"]["List"][1]["Status"] = "Signed In"
|
||||
return day
|
||||
|
||||
|
||||
def test_class_rows_carry_own_status():
|
||||
rows = render.class_rows(_day_with_status())
|
||||
assert rows[0]["status"] == ""
|
||||
assert rows[1]["status"] == "Signed In"
|
||||
|
||||
|
||||
def test_day_table_marks_own_class():
|
||||
out = render.day_table(render.class_rows(_day_with_status()), "2026-07-24")
|
||||
marked = [l for l in out.splitlines() if l.startswith("»")]
|
||||
assert len(marked) == 1
|
||||
assert "CrossFit: 5:30 PM" in marked[0] and "signed in" in marked[0]
|
||||
|
||||
|
||||
def test_day_table_unrelated_class_not_marked():
|
||||
out = render.day_table(render.class_rows(_day_with_status()), "2026-07-24")
|
||||
noon = next(l for l in out.splitlines() if "12:00 PM" in l)
|
||||
assert not noon.startswith("»")
|
||||
assert "signed in" not in noon
|
||||
|
||||
|
||||
def test_classes_renderer_marks_own_class():
|
||||
out = render.classes(_day_with_status())
|
||||
assert "«you: signed in»" in out
|
||||
assert out.count("«you:") == 1
|
||||
Reference in new issue
Block a user