From 8cfb69c2659b490bd483bb04db920a015660e406 Mon Sep 17 00:00:00 2001 From: Mira Weller Date: Mon, 15 Jul 2024 09:20:07 +0200 Subject: [PATCH] clarifications --- src/pretix/base/models/items.py | 3 ++- src/pretix/presale/checkoutflow.py | 10 +++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/pretix/base/models/items.py b/src/pretix/base/models/items.py index 376e2763f0..5ad7d02463 100644 --- a/src/pretix/base/models/items.py +++ b/src/pretix/base/models/items.py @@ -177,7 +177,8 @@ class ItemCategory(LoggedModel): collect_potential_discounts=potential_discounts_by_cartpos ) - # technically, this is a dict, but we use it as an OrderedSet here + # flatten potential_discounts_by_cartpos (a dict of lists of potential discounts) into a set of potential discounts + # (which is technically stored as a dict, but we use it as an OrderedSet here) potential_discount_set = dict.fromkeys(info for lst in potential_discounts_by_cartpos.values() for info in lst) # sum up the max_counts and pass them on (also pass on the discount_rules so we can calculate actual discounted prices later): diff --git a/src/pretix/presale/checkoutflow.py b/src/pretix/presale/checkoutflow.py index ec1039e194..977680da11 100644 --- a/src/pretix/presale/checkoutflow.py +++ b/src/pretix/presale/checkoutflow.py @@ -57,7 +57,7 @@ from django.views.generic.base import TemplateResponseMixin from django_scopes import scopes_disabled from pretix.base.models import Customer, Membership, Order -from pretix.base.models.items import Question +from pretix.base.models.items import Question, ItemCategory from pretix.base.models.orders import ( InvoiceAddress, OrderPayment, QuestionAnswer, ) @@ -649,10 +649,10 @@ class AddOnsStep(CartMixin, AsyncAction, TemplateFlowStep): @cached_property def cross_selling_data(self): class DummyCategory: - def __init__(self, rule, subevent=None): - self.id = rule.id - self.name = rule.name + (f" ({subevent})" if subevent else "") - self.description = rule.description + def __init__(self, category: ItemCategory, subevent=None): + self.id = category.id + self.name = category.name + (f" ({subevent})" if subevent else "") + self.description = category.description categories = self.cross_selling_applicable_categories if self.event.has_subevents: