mirror of
https://github.com/pretix/pretix.git
synced 2026-05-15 16:54:00 +00:00
Performance: Move _get_all_payment_methods out of loop
This commit is contained in:
@@ -330,6 +330,7 @@ class OrderListExporter(MultiSheetListExporter):
|
|||||||
taxsum=Sum('tax_value'), grosssum=Sum('value')
|
taxsum=Sum('tax_value'), grosssum=Sum('value')
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
payment_methods = None
|
||||||
if form_data.get('include_payment_amounts'):
|
if form_data.get('include_payment_amounts'):
|
||||||
payment_sum_cache = {
|
payment_sum_cache = {
|
||||||
(o['order__id'], o['provider']): o['grosssum'] for o in
|
(o['order__id'], o['provider']): o['grosssum'] for o in
|
||||||
@@ -347,6 +348,7 @@ class OrderListExporter(MultiSheetListExporter):
|
|||||||
grosssum=Sum('amount')
|
grosssum=Sum('amount')
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
payment_methods = self._get_all_payment_methods(qs)
|
||||||
sum_cache = {
|
sum_cache = {
|
||||||
(o['order__id'], o['tax_rate']): o for o in
|
(o['order__id'], o['tax_rate']): o for o in
|
||||||
OrderPosition.objects.values('tax_rate', 'order__id').order_by().annotate(
|
OrderPosition.objects.values('tax_rate', 'order__id').order_by().annotate(
|
||||||
@@ -434,7 +436,6 @@ class OrderListExporter(MultiSheetListExporter):
|
|||||||
)
|
)
|
||||||
|
|
||||||
if form_data.get('include_payment_amounts'):
|
if form_data.get('include_payment_amounts'):
|
||||||
payment_methods = self._get_all_payment_methods(qs)
|
|
||||||
for id, vn in payment_methods:
|
for id, vn in payment_methods:
|
||||||
row.append(
|
row.append(
|
||||||
payment_sum_cache.get((order.id, id), Decimal('0.00')) -
|
payment_sum_cache.get((order.id, id), Decimal('0.00')) -
|
||||||
|
|||||||
Reference in New Issue
Block a user