Skip to content

Commit

Permalink
Send original time to Discord thread
Browse files Browse the repository at this point in the history
  • Loading branch information
timoschwarzer committed Dec 16, 2024
1 parent c06c983 commit 6b2fb20
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,11 @@ class LeagueGameSubmission(id: EntityID<Long>) : LongEntity(id) {
var validated by LeagueGameSubmissions.validated
var autoValidationErrors by LeagueGameSubmissions.autoValidationErrors

val formattedTime: String get() {
return this.time?.let { time ->
val formattedTime: String get() = formatTime(time)
val formattedOriginalTime: String get() = formatTime(originalTime)

private fun formatTime(seconds: Float?): String {
return seconds?.let { time ->
(time * 1000f).toLong().milliseconds.toComponents { hours, minutes, seconds, nanoseconds ->
var result = ""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,13 @@ class LeagueManager(val server: WotwBackendServer) {
}

if (!submission.validated) {
this.content += " (auto-validation failed)"
this.content += " (auto-validation failed"

if (submission.originalTime != null) {
this.content += ", original time: ${submission.formattedOriginalTime}"
}

this.content += ")"
}

this.suppressEmbeds = true
Expand Down

0 comments on commit 6b2fb20

Please sign in to comment.