Show minimal check-in status in order export (Z#23154920) (#4223)

* Show minimal check-in status in order export (Z#23154920)

* Update src/pretix/helpers/database.py

Co-authored-by: Mira <weller@rami.io>

* Review note

---------

Co-authored-by: Mira <weller@rami.io>
This commit is contained in:
Raphael Michel
2024-06-24 17:34:10 +02:00
committed by GitHub
parent 70b48fdd4b
commit 4f9297e7d8
2 changed files with 31 additions and 13 deletions

View File

@@ -64,7 +64,8 @@ def casual_reads():
class GroupConcat(Aggregate):
function = 'group_concat'
template = '%(function)s(%(field)s, "%(separator)s")'
template = '%(function)s(%(distinct)s%(field)s, "%(separator)s")'
allow_distinct = True
def __init__(self, *expressions, ordered=False, **extra):
self.ordered = ordered
@@ -73,19 +74,17 @@ class GroupConcat(Aggregate):
extra.update({'separator': ','})
super().__init__(*expressions, **extra)
def as_postgresql(self, compiler, connection):
def as_postgresql(self, compiler, connection, **extra_context):
if self.ordered:
return super().as_sql(
compiler, connection,
function='string_agg',
template="%(function)s(%(field)s::text, '%(separator)s' ORDER BY %(field)s ASC)",
)
template = "%(function)s(%(distinct)s%(field)s::text, '%(separator)s' ORDER BY %(field)s::text ASC)"
else:
return super().as_sql(
compiler, connection,
function='string_agg',
template="%(function)s(%(field)s::text, '%(separator)s')",
)
template = "%(function)s(%(distinct)s%(field)s::text, '%(separator)s')"
return super().as_sql(
compiler, connection,
function='string_agg',
template=template,
**extra_context,
)
class ReplicaRouter: