forked from CGM_Public/pretix_original
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:
@@ -24,6 +24,8 @@
|
|||||||
<small>
|
<small>
|
||||||
{% blocktrans trimmed %}
|
{% blocktrans trimmed %}
|
||||||
Orders paid in multiple payments are shown with the date of their last payment.
|
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 %}
|
{% endblocktrans %}
|
||||||
</small>
|
</small>
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
@@ -103,7 +103,10 @@ class IndexView(EventPermissionRequiredMixin, ChartContainingView, TemplateView)
|
|||||||
day = o['datetime'].astimezone(tz).date()
|
day = o['datetime'].astimezone(tz).date()
|
||||||
ordered_by_day[day] = ordered_by_day.get(day, 0) + 1
|
ordered_by_day[day] = ordered_by_day.get(day, 0) + 1
|
||||||
paid_by_day = {}
|
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()
|
day = o['payment_date'].astimezone(tz).date()
|
||||||
paid_by_day[day] = paid_by_day.get(day, 0) + 1
|
paid_by_day[day] = paid_by_day.get(day, 0) + 1
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user