forked from CGM_Public/pretix_original
Reduced maximum McCabe function complexity by one
This commit is contained in:
@@ -79,6 +79,7 @@ def availability_handler(sender, **kwargs):
|
||||
continue
|
||||
|
||||
# Walk through all restriction objects applied to this item
|
||||
prices = []
|
||||
for restriction in restrictions:
|
||||
applied_to = list(restriction.variations.current.all())
|
||||
|
||||
@@ -91,12 +92,9 @@ def availability_handler(sender, **kwargs):
|
||||
if restriction.timeframe_from <= now() <= restriction.timeframe_to:
|
||||
# Selling this item is currently possible
|
||||
available = True
|
||||
# If multiple time frames are currently active, make sure to
|
||||
# get the cheapest price:
|
||||
if (restriction.price is not None
|
||||
and (price is None or restriction.price < price)):
|
||||
price = restriction.price
|
||||
prices.append(restriction.price)
|
||||
|
||||
price = min([p for p in prices if p is not None])
|
||||
v['available'] = available
|
||||
v['price'] = price
|
||||
cache.set(
|
||||
|
||||
Reference in New Issue
Block a user