specify only checkinlist-ID, infer events

This commit is contained in:
Mira Weller
2025-02-25 14:53:57 +01:00
parent 65abae9cbc
commit e08a1551ee
2 changed files with 5 additions and 11 deletions
+4 -10
View File
@@ -176,17 +176,11 @@ class CheckinListViewSet(viewsets.ModelViewSet):
except (OrderPosition.DoesNotExist, OrderPosition.MultipleObjectsReturned):
pass
else:
if candidate_position.event.pk != clist.event.pk and 'events_and_checkin_lists' in self.request.data:
if candidate_position.event.pk != clist.event.pk and 'candidate_checkin_lists' in self.request.data:
try:
list_id = next(list_id for event_slug, list_id in self.request.data['events_and_checkin_lists']
if event_slug == candidate_position.event.slug)
except StopIteration: # ignore if candidate position's event was not active on device
pass
else:
try:
clist = candidate_position.event.checkin_lists.get(pk=list_id)
except CheckinList.DoesNotExist: # ignore if list deleted in between
pass
clist = candidate_position.event.checkin_lists.get(pk__in=self.request.data['candidate_checkin_lists'])
except CheckinList.DoesNotExist:
pass # ignore if candidate position's event was not active on device, if list was deleted in between
if candidate_position.event.pk == clist.event.pk:
kwargs['position'] = candidate_position
+1 -1
View File
@@ -812,7 +812,7 @@ def test_store_failed_other_event(token_client, organizer, clist, event, clist_e
), {
'raw_barcode': 'xyzabc',
'error_reason': 'invalid',
'events_and_checkin_lists': [(event.slug, clist.pk), (event2.slug, clist_event2.pk)],
'candidate_checkin_lists': [clist.pk, clist_event2.pk],
'nonce': '333',
}, format='json')
assert resp.status_code == 201