Commits

Kai Diefenbach  committed ebf3b5f Merge

Merged 0.6 branch.

  • Participants
  • Parent commits 0596501, b3b4871

Comments (0)

Files changed (2)

File lfs/marketing/tests.py

 
         calculate_product_sales()
 
+    def test_calculate_product_sales(self):
+        calculate_product_sales()
+
+        # This should not break calculate_product_sales()
+        self.oi1.product = None
+        self.oi1.save()
+
+        calculate_product_sales()
+
     def test_topseller_1(self):
         """Tests general topsellers.
         """

File lfs/marketing/utils.py

     ProductSales.objects.all().delete()
 
     products = {}
-    for order_item in OrderItem.objects.all():
+    for order_item in OrderItem.objects.filter(product__isnull=False):
         if order_item.product.is_variant():
             product = order_item.product.parent
             if product is None: