Signed-off-by: Chaoscaot <max@maxsp.de>
This commit is contained in:
@@ -30,6 +30,7 @@ import org.jetbrains.exposed.v1.core.eq
|
||||
import org.jetbrains.exposed.v1.core.lessSubQuery
|
||||
import org.jetbrains.exposed.v1.dao.CompositeEntity
|
||||
import org.jetbrains.exposed.v1.dao.CompositeEntityClass
|
||||
import org.jetbrains.exposed.v1.dao.flushCache
|
||||
import org.jetbrains.exposed.v1.javatime.CurrentTimestamp
|
||||
import org.jetbrains.exposed.v1.javatime.timestamp
|
||||
import org.jetbrains.exposed.v1.jdbc.select
|
||||
@@ -70,10 +71,10 @@ class Leaderboard(id: EntityID<CompositeID>) : CompositeEntity(id) {
|
||||
|
||||
@JvmStatic
|
||||
fun upsert(userId: Int, name: String, time: Long, bestTime: Boolean) = useDb {
|
||||
findByIdAndUpdate(CompositeID {
|
||||
findById(CompositeID {
|
||||
it[LeaderboardTable.userId] = userId
|
||||
it[LeaderboardTable.name] = name
|
||||
}) {
|
||||
})?.also {
|
||||
it.time = time
|
||||
it.bestTime = bestTime
|
||||
} ?: new(
|
||||
|
||||
Reference in New Issue
Block a user