aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/moe
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2024-12-19 20:41:41 +0100
committerLinnea Gräf <nea@nea.moe>2024-12-19 20:41:41 +0100
commit4d40f0fa713bc396def07f3f9e4760bf78b97777 (patch)
treefd55e613dff5c3c22b192426bbe8b83c2c0a2201 /src/main/kotlin/moe
parent98857e6f70731b9e1d6bd19a51f992c9ca283f4c (diff)
downloadLocalTransactionLedger-4d40f0fa713bc396def07f3f9e4760bf78b97777.tar.gz
LocalTransactionLedger-4d40f0fa713bc396def07f3f9e4760bf78b97777.tar.bz2
LocalTransactionLedger-4d40f0fa713bc396def07f3f9e4760bf78b97777.zip
fix: duplicate entriers in query command
Diffstat (limited to 'src/main/kotlin/moe')
-rw-r--r--src/main/kotlin/moe/nea/ledger/QueryCommand.kt4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/main/kotlin/moe/nea/ledger/QueryCommand.kt b/src/main/kotlin/moe/nea/ledger/QueryCommand.kt
index 305069a..71a57e1 100644
--- a/src/main/kotlin/moe/nea/ledger/QueryCommand.kt
+++ b/src/main/kotlin/moe/nea/ledger/QueryCommand.kt
@@ -79,9 +79,13 @@ class QueryCommand : CommandBase() {
query.where(ANDExpression(value))
}
query.limit(80u)
+ val dedup = mutableSetOf<UUIDUtil.ULIDWrapper>()
query.forEach {
val type = it[DBLogEntry.type]
val transactionId = it[DBLogEntry.transactionId]
+ if (!dedup.add(transactionId)) {
+ return@forEach
+ }
val timestamp = transactionId.getTimestamp()
val items = DBItemEntry.selectAll(database.connection)
.where(Clause { column(DBItemEntry.transactionId) eq string(transactionId.wrapped) })