From 6e20f33ef510f62b4fe1fe8f5ebf548839446fd1 Mon Sep 17 00:00:00 2001 From: Raphael Michel Date: Mon, 19 Oct 2020 14:50:40 +0200 Subject: [PATCH] Add logdisplay --- src/pretix/api/views/checkin.py | 4 +++- src/pretix/control/logdisplay.py | 29 +++++++++++++++++++++++++---- 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/src/pretix/api/views/checkin.py b/src/pretix/api/views/checkin.py index 99756e093..0385477a8 100644 --- a/src/pretix/api/views/checkin.py +++ b/src/pretix/api/views/checkin.py @@ -1,6 +1,8 @@ import django_filters from django.core.exceptions import ValidationError -from django.db.models import Count, F, Max, OuterRef, Prefetch, Q, Subquery, Exists +from django.db.models import ( + Count, Exists, F, Max, OuterRef, Prefetch, Q, Subquery, +) from django.db.models.functions import Coalesce from django.http import Http404 from django.shortcuts import get_object_or_404 diff --git a/src/pretix/control/logdisplay.py b/src/pretix/control/logdisplay.py index 537c93bc4..0767a9384 100644 --- a/src/pretix/control/logdisplay.py +++ b/src/pretix/control/logdisplay.py @@ -165,21 +165,42 @@ def _display_checkin(event, logentry): if logentry.action_type == 'pretix.event.checkin.unknown': if show_dt: return _( - 'Unknown scan of code "{barcode}" at {datetime} for list "{list}", type "{type}".' + 'Unknown scan of code "{barcode}…" at {datetime} for list "{list}", type "{type}".' ).format( posid=data.get('positionid'), type=data.get('type'), - barcode=data.get('barcode'), + barcode=data.get('barcode')[:16], datetime=dt_formatted, list=checkin_list ) else: return _( - 'Unknown scan of code "{barcode}" for list "{list}", type "{type}".' + 'Unknown scan of code "{barcode}…" for list "{list}", type "{type}".' ).format( posid=data.get('positionid'), type=data.get('type'), - barcode=data.get('barcode'), + barcode=data.get('barcode')[:16], + list=checkin_list + ) + + if logentry.action_type == 'pretix.event.checkin.revoked': + if show_dt: + return _( + 'Scan scan of revoked code "{barcode}…" at {datetime} for list "{list}", type "{type}", was uploaded.' + ).format( + posid=data.get('positionid'), + type=data.get('type'), + barcode=data.get('barcode')[:16], + datetime=dt_formatted, + list=checkin_list + ) + else: + return _( + 'Scan of revoked code "{barcode}" for list "{list}", type "{type}", was uploaded.' + ).format( + posid=data.get('positionid'), + type=data.get('type'), + barcode=data.get('barcode')[:16], list=checkin_list )