File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
libpretixsync/src/main/java/eu/pretix/libpretixsync/sync Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change 2323import org .json .JSONObject ;
2424
2525import java .util .ArrayList ;
26+ import java .util .HashMap ;
2627import java .util .List ;
28+ import java .util .Map ;
2729import java .util .concurrent .ExecutionException ;
2830
2931import eu .pretix .libpretixsync .SentryInterface ;
@@ -571,9 +573,16 @@ protected void uploadReceipts(ProgressFeedback feedback) throws SyncException {
571573 JSONArray payments = new JSONArray ();
572574
573575 List <ReceiptLine > dbLines = db .getReceiptLineQueries ().selectForReceiptId (receipt .getId ()).executeAsList ();
576+
577+ Map <Long , Long > lineIdtoPositionId = new HashMap <>();
578+
574579 for (ReceiptLine line : dbLines ) {
575- // TODO: Manually add addon_to.positionid when switching to SQLDelight
576- lines .put (ReceiptLineExtensionsKt .toJSON (line ));
580+ lineIdtoPositionId .put (line .getId (), line .getPositionid ());
581+ JSONObject json = ReceiptLineExtensionsKt .toJSON (line );
582+ if (line .getAddon_to () != null ) {
583+ json .put ("addon_to" , lineIdtoPositionId .get (line .getAddon_to ()));
584+ }
585+ lines .put (json );
577586 }
578587 List <ReceiptPayment > dbPayments = db .getReceiptPaymentQueries ().selectForReceiptId (receipt .getId ()).executeAsList ();
579588 for (ReceiptPayment payment : dbPayments ) {
You can’t perform that action at this time.
0 commit comments