clarifications

This commit is contained in:
Mira Weller
2024-07-15 09:20:07 +02:00
parent 77fc13605e
commit 8cfb69c265
2 changed files with 7 additions and 6 deletions

View File

@@ -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):

View File

@@ -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: