Fix cart-mini OOB: compute cart_count explicitly in adjust route
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 52s

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 <noreply@anthropic.com>
This commit is contained in:
giles
2026-02-21 09:12:59 +00:00
parent 4aaaf2c7f1
commit f445d39d22
2 changed files with 11 additions and 1 deletions

View File

@@ -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)

View File

@@ -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' %}