From 4d40f0fa713bc396def07f3f9e4760bf78b97777 Mon Sep 17 00:00:00 2001 From: Linnea Gräf Date: Thu, 19 Dec 2024 20:41:41 +0100 Subject: fix: duplicate entriers in query command --- src/main/kotlin/moe/nea/ledger/QueryCommand.kt | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/main/kotlin/moe/nea/ledger/QueryCommand.kt') 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() 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) }) -- cgit