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
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:
@@ -286,6 +286,13 @@ def register() -> Blueprint:
|
|||||||
ticket_type_id=tt.id,
|
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(
|
html = await render_template(
|
||||||
"_types/tickets/_adjust_response.html",
|
"_types/tickets/_adjust_response.html",
|
||||||
entry=entry,
|
entry=entry,
|
||||||
@@ -293,6 +300,7 @@ def register() -> Blueprint:
|
|||||||
ticket_sold_count=ticket_sold_count,
|
ticket_sold_count=ticket_sold_count,
|
||||||
user_ticket_count=user_ticket_count,
|
user_ticket_count=user_ticket_count,
|
||||||
user_ticket_counts_by_type=user_ticket_counts_by_type,
|
user_ticket_counts_by_type=user_ticket_counts_by_type,
|
||||||
|
cart_count=cart_count,
|
||||||
)
|
)
|
||||||
|
|
||||||
return await make_response(html, 200)
|
return await make_response(html, 200)
|
||||||
|
|||||||
@@ -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' %}
|
{% include '_types/tickets/_buy_form.html' %}
|
||||||
|
|||||||
Reference in New Issue
Block a user