diff --git a/src/pretix/control/templates/pretixcontrol/checkin/index.html b/src/pretix/control/templates/pretixcontrol/checkin/index.html index 07ef3d0073..28fc1d6500 100644 --- a/src/pretix/control/templates/pretixcontrol/checkin/index.html +++ b/src/pretix/control/templates/pretixcontrol/checkin/index.html @@ -21,12 +21,12 @@ {% trans "Check-in simulator" %} - {% trans "PDF" %} - {% trans "CSV" %} diff --git a/src/pretix/plugins/checkinlists/exporters.py b/src/pretix/plugins/checkinlists/exporters.py index d40ccb206a..eca1f20cc1 100644 --- a/src/pretix/plugins/checkinlists/exporters.py +++ b/src/pretix/plugins/checkinlists/exporters.py @@ -39,7 +39,7 @@ import bleach import dateutil.parser from django import forms from django.db.models import ( - Case, Exists, Max, OuterRef, Q, Subquery, Value, When, + Case, Exists, F, Max, OuterRef, Q, Subquery, Value, When, ) from django.db.models.functions import Coalesce, NullIf from django.urls import reverse @@ -99,6 +99,17 @@ class CheckInListMixin(BaseExporter): label=_('Only tickets requiring special attention'), required=False )), + ('status', + forms.ChoiceField( + label=_('Check-in status'), + choices=( + ('', _('All attendees')), + ('3', pgettext_lazy('checkin state', 'Checked in but left')), + ('2', pgettext_lazy('checkin state', 'Present')), + ('1', _('Checked in')), + ('0', _('Not checked in')), + ), + )), ('sort', forms.ChoiceField( label=_('Sort by'), @@ -171,6 +182,19 @@ class CheckInListMixin(BaseExporter): 'answers', 'answers__question', 'addon_to__answers', 'addon_to__answers__question' ).select_related('order', 'item', 'variation', 'addon_to', 'order__invoice_address', 'voucher', 'seat') + if form_data.get('status'): + s = form_data.get('status') + if s == '1': + qs = qs.filter(last_checked_in__isnull=False) + elif s == '2': + qs = qs.filter(pk__in=cl.positions_inside.values_list('pk')) + elif s == '3': + qs = qs.filter(last_checked_in__isnull=False).filter( + Q(last_checked_out__isnull=False) & Q(last_exit__gte=F('last_checked_in')) + ) + elif s == '0': + qs = qs.filter(last_checked_in__isnull=True) + if not cl.all_products: qs = qs.filter(item__in=cl.limit_products.values_list('id', flat=True))