Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

Commit

Permalink
Improve /tzn command sorting
Browse files Browse the repository at this point in the history
  • Loading branch information
DRSchlaubi committed Jul 12, 2022
1 parent 3f43570 commit e477000
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ import dev.schlaubi.mikbot.plugin.api.util.discordError
import dev.schlaubi.stdx.core.isNotNullOrBlank
import kotlinx.datetime.Instant
import org.koin.core.component.inject
import kotlin.math.max
import kotlin.math.min

class TznJidArguments : Arguments() {
val jid by string {
Expand Down Expand Up @@ -96,13 +94,13 @@ context(Extension)
coachSequence.sequence.groups.forEach { group ->
val (coaches, name, _, _, _, number, model) = group
embed {
val a = coaches.firstOrNull { it.identificationNumber.isNotNullOrBlank() }?.identificationNumber?.toInt()
val a =
coaches.firstOrNull { it.identificationNumber.isNotNullOrBlank() }?.identificationNumber?.toInt()
val b = coaches.lastOrNull { it.identificationNumber.isNotNullOrBlank() }?.identificationNumber?.toInt()
title = if (a == null || b == null) {
translate("commands.tzn.info.title.unknown")
} else {
val begin = min(a, b)
val end = max(a, b)
val (begin, end) = listOf(a, b).sorted()

translate(
"commands.tzn.info.title",
Expand Down

0 comments on commit e477000

Please sign in to comment.