Skip to content

Commit

Permalink
Sort teams with a same result by displayName on the scoreboard
Browse files Browse the repository at this point in the history
  • Loading branch information
kunyavskiy committed Oct 19, 2023
1 parent 8c87168 commit c2347fe
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,16 @@ internal abstract class AbstractScoreboardCalculator : ScoreboardCalculator {

@OptIn(InefficientContestInfoApi::class)
override fun getRanking(info: ContestInfo, rows: Map<Int, ScoreboardRow>): Ranking {
val order_ = info.teamList.filterNot { it.isHidden }.map { it.id to rows[it.id]!! }.sortedWith { a, b ->
comparator.compare(a.second, b.second)
}
val comparatorWithName = compareBy(comparator) { it: Pair<Int, ScoreboardRow> -> it.second }
.thenBy { info.teams[it.first]!!.displayName }
val orderList = info.teamList
.filterNot { it.isHidden }
.map { it.id to rows[it.id]!! }
.sortedWith(comparatorWithName)

val order = order_.map { it.first }
val order = orderList.map { it.first }
val ranks = MutableList(order.size) { 0 }
val orderedRows = order_.map { it.second }
val orderedRows = orderList.map { it.second }

val firstGroupRank = mutableMapOf<String, Int>()

Expand Down

0 comments on commit c2347fe

Please sign in to comment.