From c00f82adab37c5b929a110cbf7a4dd96bd727081 Mon Sep 17 00:00:00 2001 From: Chris Dodge Date: Wed, 21 Oct 2015 19:14:51 -0400 Subject: [PATCH] be sure to add a all() to the ORM statement otherwise the select_subclasses() will cause a full table scan/join --- lms/djangoapps/instructor_analytics/basic.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lms/djangoapps/instructor_analytics/basic.py b/lms/djangoapps/instructor_analytics/basic.py index 10f22fff68..3e9ebfe044 100644 --- a/lms/djangoapps/instructor_analytics/basic.py +++ b/lms/djangoapps/instructor_analytics/basic.py @@ -337,7 +337,7 @@ def coupon_codes_features(features, coupons_list, course_id): seats_purchased_using_coupon = 0 total_discounted_amount = 0 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 = [] for item in cart_items: if getattr(item, 'course_id', None):