Keep pre-existing behaviour in case the specified checkinlist matches, even without the new parameter

This commit is contained in:
Mira Weller
2025-02-07 13:34:31 +01:00
parent faf50623d0
commit 97da945fe4
+20 -16
View File
@@ -165,26 +165,30 @@ class CheckinListViewSet(viewsets.ModelViewSet):
clist = self.get_object()
if not serializer.validated_data.get('position') and 'events_and_checkin_lists' in self.request.data:
if not serializer.validated_data.get('position'):
# an offline checkin failed, let's see whether a ticket with the given secret actually exists and just
# was not synced in time, so we can enrich the log message
candidate_position = OrderPosition.all.filter(
organizer=self.request.organizer,
secret=serializer.validated_data['raw_barcode']
).first()
if candidate_position.event.pk != clist.event.pk:
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:
candidate_position = OrderPosition.all.get(
organizer=self.request.organizer,
secret=serializer.validated_data['raw_barcode']
)
except (OrderPosition.DoesNotExist, OrderPosition.MultipleObjectsReturned):
pass
else:
if candidate_position.event.pk != clist.event.pk and 'events_and_checkin_lists' in self.request.data:
try:
clist = candidate_position.event.checkin_lists.get(pk=list_id)
except CheckinList.DoesNotExist: # ignore if list deleted in between
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
if candidate_position.event.pk == clist.event.pk:
kwargs['position'] = candidate_position
else:
try:
clist = candidate_position.event.checkin_lists.get(pk=list_id)
except CheckinList.DoesNotExist: # ignore if list deleted in between
pass
if candidate_position.event.pk == clist.event.pk:
kwargs['position'] = candidate_position
if serializer.validated_data.get('nonce'):
if kwargs.get('position'):