forked from CGM_Public/pretix_original
Apply suggestions from code review
Co-authored-by: Raphael Michel <michel@rami.io>
This commit is contained in:
@@ -169,9 +169,9 @@ def apply_discounts(event: Event, sales_channel: Union[str, SalesChannel],
|
||||
:param collect_potential_discounts: If a `defaultdict(list)` is supplied, all discounts that could be applied to the cart
|
||||
based on the "consumed" items, but lack matching "benefitting" items will be collected therein.
|
||||
The dict will contain a mapping from index in the `positions` list of the item that could be consumed, to a list
|
||||
of tuples describing the discounts that could be applied in the form (discount, max_count, grouping_id).
|
||||
max_count is either the maximum number of benefitting items that the discount would apply to, or `inf` if that number
|
||||
is not limited. The grouping_id can be used to distinguish several occurrences of the same discount.
|
||||
of tuples describing the discounts that could be applied in the form `(discount, max_count, grouping_id)`.
|
||||
`max_count` is either the maximum number of benefitting items that the discount would apply to, or `inf` if that number
|
||||
is not limited. The `grouping_id` can be used to distinguish several occurrences of the same discount.
|
||||
|
||||
:return: A list of ``(new_gross_price, discount)`` tuples in the same order as the input
|
||||
"""
|
||||
|
||||
@@ -250,9 +250,9 @@ def check_cart_behaviour(event, cart_contents, recommendations, expect_num_queri
|
||||
]
|
||||
expected_recommendations = split_table(recommendations)
|
||||
|
||||
event.organizer.get_cache().clear()
|
||||
event.get_cache().clear()
|
||||
event = Event.objects.get(pk=event.pk)
|
||||
event.organizer.cache.clear()
|
||||
event.cache.clear()
|
||||
event.refresh_from_db()
|
||||
service = CrossSellingService(event, event.organizer.sales_channels.get(identifier='web'), positions, None)
|
||||
if expect_num_queries:
|
||||
with assert_num_queries(expect_num_queries):
|
||||
@@ -339,7 +339,6 @@ def test_2f1r_discount_cross_selling(event):
|
||||
Tickets Reduced Ticket 23.00 11.50 1
|
||||
'''
|
||||
)
|
||||
print("The interesting part:")
|
||||
check_cart_behaviour(
|
||||
event,
|
||||
cart_contents=''' Price Discounted
|
||||
|
||||
Reference in New Issue
Block a user