diff options
Diffstat (limited to 'server')
-rw-r--r-- | server/analysis/src/main/kotlin/moe/nea/ledger/analysis/AnalysisFilter.kt | 5 | ||||
-rw-r--r-- | server/analysis/src/main/kotlin/moe/nea/ledger/analysis/CoinsSpentOnAuctions.kt | 12 |
2 files changed, 6 insertions, 11 deletions
diff --git a/server/analysis/src/main/kotlin/moe/nea/ledger/analysis/AnalysisFilter.kt b/server/analysis/src/main/kotlin/moe/nea/ledger/analysis/AnalysisFilter.kt index b9178cc..9df2ce3 100644 --- a/server/analysis/src/main/kotlin/moe/nea/ledger/analysis/AnalysisFilter.kt +++ b/server/analysis/src/main/kotlin/moe/nea/ledger/analysis/AnalysisFilter.kt @@ -2,6 +2,7 @@ package moe.nea.ledger.analysis import moe.nea.ledger.database.DBLogEntry import moe.nea.ledger.database.Query +import moe.nea.ledger.database.columns.DBUlid import moe.nea.ledger.database.sql.Clause import moe.nea.ledger.utils.ULIDWrapper import java.time.Instant @@ -10,8 +11,8 @@ import java.util.UUID interface AnalysisFilter { fun applyTo(query: Query) { - query.where(Clause { column(DBLogEntry.transactionId) ge string(ULIDWrapper.lowerBound(startWindow).wrapped) }) - .where(Clause { column(DBLogEntry.transactionId) le string(ULIDWrapper.upperBound(endWindow).wrapped) }) + query.where(Clause { column(DBLogEntry.transactionId) ge value(DBUlid, ULIDWrapper.lowerBound(startWindow)) }) + .where(Clause { column(DBLogEntry.transactionId) le value(DBUlid, ULIDWrapper.upperBound(endWindow)) }) // TODO: apply profiles filter } diff --git a/server/analysis/src/main/kotlin/moe/nea/ledger/analysis/CoinsSpentOnAuctions.kt b/server/analysis/src/main/kotlin/moe/nea/ledger/analysis/CoinsSpentOnAuctions.kt index 5e2e633..d1ce52b 100644 --- a/server/analysis/src/main/kotlin/moe/nea/ledger/analysis/CoinsSpentOnAuctions.kt +++ b/server/analysis/src/main/kotlin/moe/nea/ledger/analysis/CoinsSpentOnAuctions.kt @@ -20,15 +20,9 @@ class CoinsSpentOnAuctions : Analysis { override fun perform(database: Connection, filter: AnalysisFilter): AnalysisResult { val query = DBLogEntry.from(database) .join(DBItemEntry, Clause { column(DBItemEntry.transactionId) eq column(DBLogEntry.transactionId) }) - .where(Clause { - (column(DBItemEntry.itemId) eq string(ItemId.COINS.string)) - }) - .where(Clause { - (column(DBItemEntry.mode) eq string(ItemChange.ChangeDirection.LOST.name)) - }) - .where(Clause { - (column(DBLogEntry.type) eq string(TransactionType.AUCTION_BOUGHT.name)) - }) + .where(Clause { column(DBItemEntry.itemId) eq ItemId.COINS }) + .where(Clause { column(DBItemEntry.mode) eq ItemChange.ChangeDirection.LOST }) + .where(Clause { column(DBLogEntry.type) eq TransactionType.AUCTION_BOUGHT }) .select(DBItemEntry.size, DBLogEntry.transactionId) filter.applyTo(query) val spentThatDay = mutableMapOf<LocalDate, Double>() |