Revert "Add debug logging for product availability checks"
This reverts commit e723ec937b
.
This wasn't meant to be added to the dev branch yet.
This commit is contained in:
parent
e723ec937b
commit
33179794ee
1 changed files with 0 additions and 10 deletions
|
@ -1,5 +1,4 @@
|
||||||
import itertools
|
import itertools
|
||||||
import logging
|
|
||||||
|
|
||||||
from django.db.models import Case
|
from django.db.models import Case
|
||||||
from django.db.models import F, Q
|
from django.db.models import F, Q
|
||||||
|
@ -24,9 +23,6 @@ class ProductController(object):
|
||||||
def available_products(cls, user, category=None, products=None):
|
def available_products(cls, user, category=None, products=None):
|
||||||
''' Returns a list of all of the products that are available per
|
''' Returns a list of all of the products that are available per
|
||||||
flag conditions from the given categories. '''
|
flag conditions from the given categories. '''
|
||||||
logging.debug("Checking available products for user %(user)s: "
|
|
||||||
"category %(category)s or products %(product)s",
|
|
||||||
{'user': user, 'category': category, 'products': products})
|
|
||||||
if category is None and products is None:
|
if category is None and products is None:
|
||||||
raise ValueError("You must provide products or a category")
|
raise ValueError("You must provide products or a category")
|
||||||
|
|
||||||
|
@ -49,20 +45,14 @@ class ProductController(object):
|
||||||
if product_remainders[product.id] > 0
|
if product_remainders[product.id] > 0
|
||||||
)
|
)
|
||||||
|
|
||||||
logging.debug("Passed limits: %s", passed_limits)
|
|
||||||
|
|
||||||
failed_and_messages = FlagController.test_flags(
|
failed_and_messages = FlagController.test_flags(
|
||||||
user, products=passed_limits
|
user, products=passed_limits
|
||||||
)
|
)
|
||||||
failed_conditions = set(i[0] for i in failed_and_messages)
|
failed_conditions = set(i[0] for i in failed_and_messages)
|
||||||
|
|
||||||
logging.debug("Failed conditions: %s", failed_conditions)
|
|
||||||
|
|
||||||
out = list(passed_limits - failed_conditions)
|
out = list(passed_limits - failed_conditions)
|
||||||
out.sort(key=lambda product: product.order)
|
out.sort(key=lambda product: product.order)
|
||||||
|
|
||||||
logging.debug("Returning: %s", out)
|
|
||||||
|
|
||||||
return out
|
return out
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|
Loading…
Reference in a new issue