diff --git a/src/pretix/presale/views/event.py b/src/pretix/presale/views/event.py index 22b0ae5559..319dad5caf 100644 --- a/src/pretix/presale/views/event.py +++ b/src/pretix/presale/views/event.py @@ -37,7 +37,8 @@ class EventIndex(EventViewMixin, CartMixin, TemplateView): else: for var in item.available_variations: var.cached_availability = list(var['variation'].check_quotas()) - var.cached_availability[1] = min(var.cached_availability[1], + var.cached_availability[1] = min(var.cached_availability[1] + if var.cached_availability[1] is not None else sys.maxsize, int(self.request.event.settings.max_items_per_order)) var.price = var.get('price', item.default_price) if len(item.available_variations) > 0: diff --git a/src/tests/presale/test_event.py b/src/tests/presale/test_event.py index c2ea6219c2..4c9686b890 100644 --- a/src/tests/presale/test_event.py +++ b/src/tests/presale/test_event.py @@ -93,6 +93,22 @@ class ItemDisplayTest(EventTestMixin, BrowserTest): var1 = ItemVariation.objects.create(item=item) var1.values.add(val1) q.variations.add(var1) + self._assert_variation_found() + + def test_one_variation_in_unlimited_quota(self): + c = ItemCategory.objects.create(event=self.event, name="Entry tickets", position=0) + q = Quota.objects.create(event=self.event, name='Quota', size=None) + item = Item.objects.create(event=self.event, name='Early-bird ticket', category=c, default_price=0) + prop1 = Property.objects.create(event=self.event, name="Color", item=item) + val1 = PropertyValue.objects.create(prop=prop1, value="Red") + PropertyValue.objects.create(prop=prop1, value="Black") + q.items.add(item) + var1 = ItemVariation.objects.create(item=item) + var1.values.add(val1) + q.variations.add(var1) + self._assert_variation_found() + + def _assert_variation_found(self): self.driver.get('%s/%s/%s/' % (self.live_server_url, self.orga.slug, self.event.slug)) self.assertIn("Early-bird", self.driver.find_element_by_css_selector("section:nth-of-type(1) div:nth-of-type(1)").text)