mirror of
https://github.com/pretix/pretix.git
synced 2026-05-09 15:54:03 +00:00
Fixed a bug introduced in 1f08dfd
This commit is contained in:
@@ -156,7 +156,6 @@ In our example, the implementation could look like this::
|
|||||||
# Therefore, it is only available inside one of the timeframes, but not
|
# Therefore, it is only available inside one of the timeframes, but not
|
||||||
# without any timeframe
|
# without any timeframe
|
||||||
available = False
|
available = False
|
||||||
price = None
|
|
||||||
|
|
||||||
# Make up some unique key for this variation
|
# Make up some unique key for this variation
|
||||||
cachekey = 'timerestriction:%d:%s' % (
|
cachekey = 'timerestriction:%d:%s' % (
|
||||||
@@ -190,7 +189,9 @@ In our example, the implementation could look like this::
|
|||||||
available = True
|
available = True
|
||||||
prices.append(restriction.price)
|
prices.append(restriction.price)
|
||||||
|
|
||||||
price = min([p for p in prices if p is not None])
|
# Use the lowest of all prices set by restrictions
|
||||||
|
prices = [p for p in prices if p is not None]
|
||||||
|
price = min(prices) if prices else None
|
||||||
|
|
||||||
v['available'] = available
|
v['available'] = available
|
||||||
v['price'] = price
|
v['price'] = price
|
||||||
|
|||||||
@@ -60,7 +60,6 @@ def availability_handler(sender, **kwargs):
|
|||||||
# Therefore, it is only available inside one of the timeframes, but not
|
# Therefore, it is only available inside one of the timeframes, but not
|
||||||
# without any timeframe
|
# without any timeframe
|
||||||
available = False
|
available = False
|
||||||
price = None
|
|
||||||
|
|
||||||
# Make up some unique key for this variation
|
# Make up some unique key for this variation
|
||||||
cachekey = 'timerestriction:%s:%s' % (
|
cachekey = 'timerestriction:%s:%s' % (
|
||||||
@@ -94,7 +93,10 @@ def availability_handler(sender, **kwargs):
|
|||||||
available = True
|
available = True
|
||||||
prices.append(restriction.price)
|
prices.append(restriction.price)
|
||||||
|
|
||||||
price = min([p for p in prices if p is not None])
|
# Use the lowest of all prices set by restrictions
|
||||||
|
prices = [p for p in prices if p is not None]
|
||||||
|
price = min(prices) if prices else None
|
||||||
|
|
||||||
v['available'] = available
|
v['available'] = available
|
||||||
v['price'] = price
|
v['price'] = price
|
||||||
cache.set(
|
cache.set(
|
||||||
|
|||||||
Reference in New Issue
Block a user