Exclude cancelled orders from paid orders graph (#5786)

The 'paid orders' time series on the statistics page currently counts orders
that were paid and later cancelled.

Filter the paid-by-day queryset to `Order.STATUS_PAID` with at least one
non-cancelled position, leaving the placed orders series unchanged, and update
the help text to clarify this behaviour.

Discussion: https://github.com/pretix/pretix/discussions/5774
This commit is contained in:
Kian Cross
2026-01-16 13:37:11 +00:00
committed by GitHub
parent 4f3d90fc50
commit 2aa27f56f1
2 changed files with 6 additions and 1 deletions

View File

@@ -24,6 +24,8 @@
<small>
{% blocktrans trimmed %}
Orders paid in multiple payments are shown with the date of their last payment.
Placed orders include all orders (pending, paid, cancelled, and expired);
paid orders include only paid orders and exclude all cancelled orders.
{% endblocktrans %}
</small>
</p>

View File

@@ -103,7 +103,10 @@ class IndexView(EventPermissionRequiredMixin, ChartContainingView, TemplateView)
day = o['datetime'].astimezone(tz).date()
ordered_by_day[day] = ordered_by_day.get(day, 0) + 1
paid_by_day = {}
for o in oqs.filter(event=self.request.event, payment_date__isnull=False).values('payment_date'):
for o in oqs.filter(
event=self.request.event, payment_date__isnull=False,
status=Order.STATUS_PAID, all_positions__canceled=False
).distinct().values('payment_date'):
day = o['payment_date'].astimezone(tz).date()
paid_by_day[day] = paid_by_day.get(day, 0) + 1