Commit 891465d1 by Julia Hansbrough

Fixed 500ing CSV reports

parent 0f8919a6
...@@ -602,7 +602,7 @@ class CertificateItem(OrderItem): ...@@ -602,7 +602,7 @@ class CertificateItem(OrderItem):
etc etc
""" """
query = use_read_replica_if_available( query = use_read_replica_if_available(
CertificateItem.objects.filter(course_id=course_id, mode='verified', status=status).aggregate(Sum(field_to_aggregate)))[field_to_aggregate + '__sum'] CertificateItem.objects.filter(course_id=course_id, mode='verified', status=status)).aggregate(Sum(field_to_aggregate))[field_to_aggregate + '__sum']
if query is None: if query is None:
return Decimal(0.00) return Decimal(0.00)
else: else:
...@@ -615,4 +615,4 @@ class CertificateItem(OrderItem): ...@@ -615,4 +615,4 @@ class CertificateItem(OrderItem):
course_id=course_id, course_id=course_id,
mode='verified', mode='verified',
status='purchased', status='purchased',
unit_cost__gt=(CourseMode.min_course_price_for_verified_for_currency(course_id, 'usd'))).count()) unit_cost__gt=(CourseMode.min_course_price_for_verified_for_currency(course_id, 'usd')))).count()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment