mirror of
https://github.com/pretix/pretix.git
synced 2026-05-08 15:44:02 +00:00
cleanup
This commit is contained in:
@@ -8,7 +8,7 @@ import pretix.base.models.orders
|
|||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
("pretixbase", "0268_remove_subevent_items_remove_subevent_variations_and_more"),
|
("pretixbase", "0269_order_api_meta"),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
@@ -307,11 +307,9 @@ class Discount(LoggedModel):
|
|||||||
n_groups * self.condition_min_count:
|
n_groups * self.condition_min_count:
|
||||||
possible_applications_cond * self.condition_min_count
|
possible_applications_cond * self.condition_min_count
|
||||||
]):
|
]):
|
||||||
print(i, idx)
|
|
||||||
collect_potential_discounts[idx] += [
|
collect_potential_discounts[idx] += [
|
||||||
(self, self.benefit_only_apply_to_cheapest_n_matches, i // self.condition_min_count)
|
(self, self.benefit_only_apply_to_cheapest_n_matches, i // self.condition_min_count)
|
||||||
]
|
]
|
||||||
print(collect_potential_discounts)
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
consume_idx = condition_idx_group
|
consume_idx = condition_idx_group
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
# <https://www.gnu.org/licenses/>.
|
# <https://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
import re
|
import re
|
||||||
|
from collections import defaultdict
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
from typing import List, Optional, Tuple, Union
|
from typing import List, Optional, Tuple, Union
|
||||||
|
|
||||||
@@ -158,13 +159,16 @@ def get_line_price(price_after_voucher: Decimal, custom_price_input: Decimal, cu
|
|||||||
|
|
||||||
def apply_discounts(event: Event, sales_channel: Union[str, SalesChannel],
|
def apply_discounts(event: Event, sales_channel: Union[str, SalesChannel],
|
||||||
positions: List[Tuple[int, Optional[int], Decimal, bool, bool, Decimal]],
|
positions: List[Tuple[int, Optional[int], Decimal, bool, bool, Decimal]],
|
||||||
collect_potential_discounts=None) -> List[Tuple[Decimal, Optional[Discount]]]:
|
collect_potential_discounts: Optional[defaultdict]=None) -> List[Tuple[Decimal, Optional[Discount]]]:
|
||||||
"""
|
"""
|
||||||
Applies any dynamic discounts to a cart
|
Applies any dynamic discounts to a cart
|
||||||
|
|
||||||
:param event: Event the cart belongs to
|
:param event: Event the cart belongs to
|
||||||
:param sales_channel: Sales channel the cart was created with
|
:param sales_channel: Sales channel the cart was created with
|
||||||
:param positions: Tuple of the form ``(item_id, subevent_id, line_price_gross, is_addon_to, is_bundled, voucher_discount)``
|
:param positions: Tuple of the form ``(item_id, subevent_id, line_price_gross, is_addon_to, is_bundled, voucher_discount)``
|
||||||
|
: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 in it.
|
||||||
|
|
||||||
:return: A list of ``(new_gross_price, discount)`` tuples in the same order as the input
|
:return: A list of ``(new_gross_price, discount)`` tuples in the same order as the input
|
||||||
"""
|
"""
|
||||||
if isinstance(sales_channel, SalesChannel):
|
if isinstance(sales_channel, SalesChannel):
|
||||||
|
|||||||
Reference in New Issue
Block a user