Skip to content

Commit

Permalink
Save original time only when the run time was overridden
Browse files Browse the repository at this point in the history
  • Loading branch information
timoschwarzer committed Dec 16, 2024
1 parent b78a022 commit c06c983
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/main/kotlin/wotw/io/messages/protobuf/Messages.kt
Original file line number Diff line number Diff line change
Expand Up @@ -586,5 +586,5 @@ data class LeagueGameSubmissionRankingData(
@ProtoNumber(3) @Required val rank: Int? = null,
@ProtoNumber(5) @Required val videoUrl: String? = null,
@ProtoNumber(6) val rankingMultiplier: Float,
@ProtoNumber(7) @Required val saveFileTime: Float? = null,
@ProtoNumber(7) @Required val originalTime: Float? = null,
)
8 changes: 6 additions & 2 deletions src/main/kotlin/wotw/server/api/LeagueEndpoint.kt
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,12 @@ class LeagueEndpoint(server: WotwBackendServer) : Endpoint(server) {

newSuspendedTransaction {
handler.createSubmission(authenticatedUser()) {
it.time = timeOverride ?: saveData.inGameTime
it.saveFileTime = saveData.inGameTime
if (timeOverride != null) {
it.time = timeOverride
it.originalTime = saveData.inGameTime
} else {
it.time = saveData.inGameTime
}

it.saveFile = saveFileArray

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ object LeagueGameSubmissions : LongIdTable("league_game_submissions") {
val submittedAt = timestamp("submitted_at").defaultExpression(CurrentTimestamp)
val saveFile = binary("save_file", 512 * 1024).nullable()
val time = float("time").nullable()
val save_file_time = float("save_file_time").nullable()
val originalTime = float("originalTime").nullable()
val points = integer("points").default(0)
val rank = integer("rank").nullable()
val videoUrl = varchar("video_url", 128).nullable()
Expand All @@ -36,7 +36,7 @@ class LeagueGameSubmission(id: EntityID<Long>) : LongEntity(id) {
var submittedAt by LeagueGameSubmissions.submittedAt
var saveFile by LeagueGameSubmissions.saveFile
var time by LeagueGameSubmissions.time
var saveFileTime by LeagueGameSubmissions.save_file_time
var originalTime by LeagueGameSubmissions.originalTime
var points by LeagueGameSubmissions.points
var rank by LeagueGameSubmissions.rank
var videoUrl by LeagueGameSubmissions.videoUrl
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ class InfoMessagesService(private val server: WotwBackendServer) {
submission.rank,
submission.videoUrl,
submission.rankingMultiplier,
submission.saveFileTime,
submission.originalTime,
)
)

Expand Down

0 comments on commit c06c983

Please sign in to comment.