Skip to content

Commit

Permalink
Resolve TODO around addons
Browse files Browse the repository at this point in the history
  • Loading branch information
raphaelm committed Dec 17, 2024
1 parent 803a466 commit b78a1d7
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutionException;

import eu.pretix.libpretixsync.SentryInterface;
Expand Down Expand Up @@ -571,9 +573,16 @@ protected void uploadReceipts(ProgressFeedback feedback) throws SyncException {
JSONArray payments = new JSONArray();

List<ReceiptLine> dbLines = db.getReceiptLineQueries().selectForReceiptId(receipt.getId()).executeAsList();

Map<Long, Long> lineIdtoPositionId = new HashMap<>();

for (ReceiptLine line : dbLines) {
// TODO: Manually add addon_to.positionid when switching to SQLDelight
lines.put(ReceiptLineExtensionsKt.toJSON(line));
lineIdtoPositionId.put(line.getId(), line.getPositionid());
JSONObject json = ReceiptLineExtensionsKt.toJSON(line);
if (line.getAddon_to() != null) {
json.put("addon_to", lineIdtoPositionId.get(line.getAddon_to()));
}
lines.put(json);
}
List<ReceiptPayment> dbPayments = db.getReceiptPaymentQueries().selectForReceiptId(receipt.getId()).executeAsList();
for (ReceiptPayment payment : dbPayments) {
Expand Down

0 comments on commit b78a1d7

Please sign in to comment.