Fix broken aggregation in orders per product statistics

This commit is contained in:
Raphael Michel
2017-04-17 21:52:17 +02:00
parent dd9c0b3a01
commit d224ae3eb0

View File

@@ -65,14 +65,14 @@ class IndexView(EventPermissionRequiredMixin, ChartContainingView, TemplateView)
for p in (OrderPosition.objects for p in (OrderPosition.objects
.filter(order__event=self.request.event) .filter(order__event=self.request.event)
.values('item') .values('item')
.annotate(cnt=Count('id'))) .annotate(cnt=Count('id')).order_by())
} }
num_paid = { num_paid = {
p['item']: p['cnt'] p['item']: p['cnt']
for p in (OrderPosition.objects for p in (OrderPosition.objects
.filter(order__event=self.request.event, order__status=Order.STATUS_PAID) .filter(order__event=self.request.event, order__status=Order.STATUS_PAID)
.values('item') .values('item')
.annotate(cnt=Count('id'))) .annotate(cnt=Count('id')).order_by())
} }
item_names = { item_names = {
i.id: str(i.name) i.id: str(i.name)