add support for check-in into overlapping events (#2039)

When events overlap, check-in only worked for the currently running event. If events run back-to-back, it can happen, that admission should start earlier and overlaps the currently running event. This checks if an overlapping event has started even if the current event is still running.
This commit is contained in:
Richard Schreiber
2021-04-26 13:13:21 +02:00
committed by GitHub
parent 8921ccb8c1
commit a0b3c70e2a
2 changed files with 53 additions and 21 deletions

View File

@@ -116,6 +116,15 @@ def test_choose_between_events(device_client, device):
assert resp.status_code == 200
assert resp.data['event']['slug'] == 'e2'
# check for overlapping events
e2.date_admission = tz.localize(datetime(2020, 1, 10, 14, 45))
e2.save()
with freeze_time("2020-01-10T14:45:00+09:00"):
resp = device_client.get(f'/api/v1/device/eventselection?current_event=e1')
assert resp.status_code == 200
resp = device_client.get(f'/api/v1/device/eventselection?current_event=e2')
assert resp.status_code == 304
@pytest.mark.django_db
def test_choose_between_subevents(device_client, device):
@@ -207,6 +216,15 @@ def test_choose_between_subevents(device_client, device):
assert resp.data['event']['slug'] == 'e1'
assert resp.data['subevent'] == se2.pk
# check for overlapping events
se2.date_admission = tz.localize(datetime(2020, 1, 10, 14, 45))
se2.save()
with freeze_time("2020-01-10T14:45:00+09:00"):
resp = device_client.get(f'/api/v1/device/eventselection?current_event=e1&current_subevent={se1.pk}')
assert resp.status_code == 200
resp = device_client.get(f'/api/v1/device/eventselection?current_event=e1&current_subevent={se2.pk}')
assert resp.status_code == 304
@pytest.mark.django_db
def test_require_gate(device_client, device):