From f445d39d227ad8c9c480c60a42a69adc3da0dc9a Mon Sep 17 00:00:00 2001 From: giles Date: Sat, 21 Feb 2026 09:12:59 +0000 Subject: [PATCH] Fix cart-mini OOB: compute cart_count explicitly in adjust route Pass cart_count directly to the template instead of relying on the context processor, which may not resolve correctly for the /tickets/ URL prefix. Co-Authored-By: Claude Opus 4.6 --- bp/tickets/routes.py | 8 ++++++++ templates/_types/tickets/_adjust_response.html | 4 +++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/bp/tickets/routes.py b/bp/tickets/routes.py index 2125126..408eb06 100644 --- a/bp/tickets/routes.py +++ b/bp/tickets/routes.py @@ -286,6 +286,13 @@ def register() -> Blueprint: ticket_type_id=tt.id, ) + # Compute cart count for OOB mini-cart update + from shared.services.registry import services + summary = await services.cart.cart_summary( + g.s, user_id=ident["user_id"], session_id=ident["session_id"], + ) + cart_count = summary.count + summary.calendar_count + summary.ticket_count + html = await render_template( "_types/tickets/_adjust_response.html", entry=entry, @@ -293,6 +300,7 @@ def register() -> Blueprint: ticket_sold_count=ticket_sold_count, user_ticket_count=user_ticket_count, user_ticket_counts_by_type=user_ticket_counts_by_type, + cart_count=cart_count, ) return await make_response(html, 200) diff --git a/templates/_types/tickets/_adjust_response.html b/templates/_types/tickets/_adjust_response.html index 5754575..fdbbe02 100644 --- a/templates/_types/tickets/_adjust_response.html +++ b/templates/_types/tickets/_adjust_response.html @@ -1,2 +1,4 @@ -{# Response for ticket adjust — re-render the buy form #} +{# Response for ticket adjust — buy form + OOB cart-mini update #} +{% from '_types/cart/_mini.html' import mini %} +{{ mini(oob='true') }} {% include '_types/tickets/_buy_form.html' %}