diff --git a/api-webapp/src/main/kotlin/org/jeudego/pairgoth/api/PairingHandler.kt b/api-webapp/src/main/kotlin/org/jeudego/pairgoth/api/PairingHandler.kt index 6e926c3..741f570 100644 --- a/api-webapp/src/main/kotlin/org/jeudego/pairgoth/api/PairingHandler.kt +++ b/api-webapp/src/main/kotlin/org/jeudego/pairgoth/api/PairingHandler.kt @@ -60,9 +60,6 @@ object PairingHandler: PairgothApiHandler { } 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() tournament.dispatchEvent(GamesAdded, request, Json.Object("round" to round, "games" to ret)) return ret diff --git a/api-webapp/src/main/kotlin/org/jeudego/pairgoth/model/Tournament.kt b/api-webapp/src/main/kotlin/org/jeudego/pairgoth/model/Tournament.kt index 5ea4daf..4358531 100644 --- a/api-webapp/src/main/kotlin/org/jeudego/pairgoth/model/Tournament.kt +++ b/api-webapp/src/main/kotlin/org/jeudego/pairgoth/model/Tournament.kt @@ -114,11 +114,17 @@ sealed class Tournament ( } } - fun usedTables(round: Int): BitSet = - games(round).values.map { it.table }.fold(BitSet()) { acc, table -> + fun usedTables(round: Int): BitSet { + val assigned = games(round).values.map { it.table }.fold(BitSet()) { acc, table -> acc.set(table) acc } + val excluded = excludedTables(round) + for (table in excluded) { + assigned.set(table) + } + return assigned + } private fun defaultGameOrderBy(game: Game): Int { val whiteRank = pairables[game.white]?.rating ?: Int.MIN_VALUE