Fix cart badge: include calendar entries + OOB update on add
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 50s

- Context processor now sums product + calendar counts from cart API
- add_entry route returns OOB cart-mini swap with correct count,
  querying pending entries from local session (sees uncommitted entry)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
giles
2026-02-18 21:49:45 +00:00
parent b153203fc0
commit d2195c0969
3 changed files with 32 additions and 7 deletions

6
app.py
View File

@@ -27,11 +27,11 @@ async def events_context() -> dict:
ctx["menu_items"] = await get_navigation_tree(g.s)
# Cart data from cart API
# Cart data from cart API (includes both product + calendar counts)
cart_data = await api_get("cart", "/internal/cart/summary", forward_session=True)
if cart_data:
ctx["cart_count"] = cart_data.get("count", 0)
ctx["cart_total"] = cart_data.get("total", 0)
ctx["cart_count"] = cart_data.get("count", 0) + cart_data.get("calendar_count", 0)
ctx["cart_total"] = cart_data.get("total", 0) + cart_data.get("calendar_total", 0)
else:
ctx["cart_count"] = 0
ctx["cart_total"] = 0