Implement corona-safe seating (#1685)

This commit is contained in:
Raphael Michel
2020-05-29 11:39:47 +02:00
committed by GitHub
parent 03bcfc7c5a
commit cf3412d54d
8 changed files with 183 additions and 73 deletions

View File

@@ -2087,8 +2087,8 @@ class SeatingTestCase(TestCase):
self.event.seat_category_mappings.create(
layout_category='Stalls', product=self.ticket
)
self.seat_a1 = self.event.seats.create(name="A1", product=self.ticket, blocked=False)
self.seat_a2 = self.event.seats.create(name="A2", product=self.ticket, blocked=False)
self.seat_a1 = self.event.seats.create(name="A1", product=self.ticket, blocked=False, x=0, y=0)
self.seat_a2 = self.event.seats.create(name="A2", product=self.ticket, blocked=False, x=1, y=1)
@classscope(attr='organizer')
def test_free(self):
@@ -2104,6 +2104,28 @@ class SeatingTestCase(TestCase):
assert not self.seat_a1.is_available()
assert self.seat_a2.is_available()
@classscope(attr='organizer')
def test_blocked_in_proximity(self):
o = Order.objects.create(
code='FOO', event=self.event, email='dummy@dummy.test', total=Decimal("30"),
locale='en', status=Order.STATUS_PENDING, datetime=now(),
expires=now() + timedelta(days=10),
)
OrderPosition.objects.create(
order=o, item=self.ticket, variation=None, price=Decimal("12"),
seat=self.seat_a1
)
self.event.settings.seating_minimal_distance = 1.5
assert set(self.event.free_seats()) == set()
assert not self.seat_a1.is_available()
assert not self.seat_a2.is_available()
self.event.settings.seating_minimal_distance = 1.4
assert set(self.event.free_seats()) == {self.seat_a2}
assert not self.seat_a1.is_available()
assert self.seat_a2.is_available()
@classscope(attr='organizer')
def test_order_pending(self):
o = Order.objects.create(