Commit 0bc2c42e by chrisndodge

Merge pull request #8682 from edx/muhhshoaib/PHX-40-sorting-of-popular-coupon-codes

PHX-40 added the sorting of the most popular coupon codes used.
parents 22a3f862 0442e700
......@@ -1419,7 +1419,7 @@ class CouponRedemption(models.Model):
"""
return cls.objects.filter(order__status='purchased', coupon__course_id=course_id).values(
'coupon__code', 'coupon__percentage_discount'
).annotate(coupon__used_count=Count('coupon__code'))
).annotate(coupon__used_count=Count('coupon__code')).order_by('-coupon__used_count')
@classmethod
def get_total_coupon_code_purchases(cls, course_id):
......
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