Commit c00f82ad by Chris Dodge

be sure to add a all() to the ORM statement otherwise the select_subclasses()…

be sure to add a all() to the ORM statement otherwise the select_subclasses() will cause a full table scan/join
parent d414d74f
...@@ -337,7 +337,7 @@ def coupon_codes_features(features, coupons_list, course_id): ...@@ -337,7 +337,7 @@ def coupon_codes_features(features, coupons_list, course_id):
seats_purchased_using_coupon = 0 seats_purchased_using_coupon = 0
total_discounted_amount = 0 total_discounted_amount = 0
for coupon_redemption in coupon_redemptions: for coupon_redemption in coupon_redemptions:
cart_items = coupon_redemption.order.orderitem_set.select_subclasses() cart_items = coupon_redemption.order.orderitem_set.all().select_subclasses()
found_items = [] found_items = []
for item in cart_items: for item in cart_items:
if getattr(item, 'course_id', None): if getattr(item, 'course_id', None):
......
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