From 9f4cbabd300b99b7d01f1f21e69962e7f168a734 Mon Sep 17 00:00:00 2001 From: Kian Cross Date: Fri, 16 Jan 2026 13:24:03 +0000 Subject: [PATCH] Include fee-cancelled positions in placed orders by product graph (#5791) The 'placed orders by product' graph already includes orders that are pending, expired, or fully cancelled without a fee. However, items cancelled with a fee were omitted. This change ensures all placed orders are included in the graph, including those cancelled with a fee. --- .../templates/pretixplugins/statistics/index.html | 8 ++++++++ src/pretix/plugins/statistics/views.py | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/pretix/plugins/statistics/templates/pretixplugins/statistics/index.html b/src/pretix/plugins/statistics/templates/pretixplugins/statistics/index.html index 0af5cbe97b..c6d1cac32b 100644 --- a/src/pretix/plugins/statistics/templates/pretixplugins/statistics/index.html +++ b/src/pretix/plugins/statistics/templates/pretixplugins/statistics/index.html @@ -59,6 +59,14 @@
+

+ + {% blocktrans trimmed %} + Placed orders include all orders (pending, paid, cancelled, and expired); + paid orders include only paid orders and exclude all cancelled orders. + {% endblocktrans %} + +

{% if seats %} diff --git a/src/pretix/plugins/statistics/views.py b/src/pretix/plugins/statistics/views.py index 5181208542..43302d0d11 100644 --- a/src/pretix/plugins/statistics/views.py +++ b/src/pretix/plugins/statistics/views.py @@ -128,7 +128,7 @@ class IndexView(EventPermissionRequiredMixin, ChartContainingView, TemplateView) # Orders by product ctx['obp_data'] = cache.get('statistics_obp_data' + ckey) if not ctx['obp_data']: - opqs = OrderPosition.objects + opqs = OrderPosition.all if subevent: opqs = opqs.filter(subevent=subevent) num_ordered = { @@ -141,7 +141,7 @@ class IndexView(EventPermissionRequiredMixin, ChartContainingView, TemplateView) num_paid = { p['item']: p['cnt'] for p in (opqs - .filter(order__event=self.request.event, order__status=Order.STATUS_PAID) + .filter(order__event=self.request.event, order__status=Order.STATUS_PAID, canceled=False) .values('item') .annotate(cnt=Count('id')).order_by()) }