Move dangerous order clause

This commit is contained in:
Raphael Michel
2018-08-08 09:00:44 +02:00
parent 9f2ecb67d4
commit 5dc100d900
2 changed files with 6 additions and 6 deletions

View File

@@ -41,20 +41,20 @@ class IndexView(EventPermissionRequiredMixin, ChartContainingView, TemplateView)
order=OuterRef('pk'),
state__in=(OrderPayment.PAYMENT_STATE_CONFIRMED, OrderPayment.PAYMENT_STATE_REFUNDED),
payment_date__isnull=False
).order_by().values('order').annotate(
).values('order').annotate(
m=Max('payment_date')
).values(
'm'
)
).order_by()
op_date = OrderPayment.objects.filter(
order=OuterRef('order'),
state__in=(OrderPayment.PAYMENT_STATE_CONFIRMED, OrderPayment.PAYMENT_STATE_REFUNDED),
payment_date__isnull=False
).order_by().values('order').annotate(
).values('order').annotate(
m=Max('payment_date')
).values(
'm'
)
).order_by()
# Orders by day
ctx['obd_data'] = cache.get('statistics_obd_data' + ckey)