Skip to content

Commit bb3585c

Browse files
committed
Fix handling of initial receipt
1 parent f36af81 commit bb3585c

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

libpretixsync/src/main/java/eu/pretix/libpretixsync/models/db/ReceiptExtensions.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,13 @@ import eu.pretix.libpretixsync.models.Receipt as ReceiptModel
66
fun Receipt.toModel() =
77
ReceiptModel(
88
id = id,
9-
eventSlug = event_slug!!,
9+
eventSlug = if (event_slug == null && id == 1L) {
10+
// This case occurs when upgrading a device from pre-sqldelight to post-sqldelight
11+
// that previously was not ever properly used. It therefore contains only the receipt
12+
// with id=1 and isOpen=true, that has eventSlug=null because it was created before
13+
// the first event was selected.
14+
""
15+
} else { event_slug!! },
1016
paymentType = ReceiptModel.PaymentType.valueOf(payment_type!!.uppercase()),
1117
currency = currency,
1218
orderCode = order_code,

0 commit comments

Comments
 (0)