No systematic renumbering!

This commit is contained in:
Claude Brisson
2024-07-28 13:40:17 +02:00
parent 3ae27376a7
commit 809573e580
2 changed files with 8 additions and 5 deletions

View File

@@ -60,9 +60,6 @@ object PairingHandler: PairgothApiHandler {
} }
val games = tournament.pair(round, pairables) val games = tournament.pair(round, pairables)
// always renumber table to take table exclusion into account
tournament.renumberTables(round)
val ret = games.map { it.toJson() }.toJsonArray() val ret = games.map { it.toJson() }.toJsonArray()
tournament.dispatchEvent(GamesAdded, request, Json.Object("round" to round, "games" to ret)) tournament.dispatchEvent(GamesAdded, request, Json.Object("round" to round, "games" to ret))
return ret return ret

View File

@@ -114,11 +114,17 @@ sealed class Tournament <P: Pairable>(
} }
} }
fun usedTables(round: Int): BitSet = fun usedTables(round: Int): BitSet {
games(round).values.map { it.table }.fold(BitSet()) { acc, table -> val assigned = games(round).values.map { it.table }.fold(BitSet()) { acc, table ->
acc.set(table) acc.set(table)
acc acc
} }
val excluded = excludedTables(round)
for (table in excluded) {
assigned.set(table)
}
return assigned
}
private fun defaultGameOrderBy(game: Game): Int { private fun defaultGameOrderBy(game: Game): Int {
val whiteRank = pairables[game.white]?.rating ?: Int.MIN_VALUE val whiteRank = pairables[game.white]?.rating ?: Int.MIN_VALUE