Do not renumber tables when the new forced table is free
This commit is contained in:
@@ -105,6 +105,9 @@ object PairingHandler: PairgothApiHandler {
|
|||||||
}
|
}
|
||||||
tournament.dispatchEvent(GameUpdated, request, Json.Object("round" to round, "game" to game.toJson()))
|
tournament.dispatchEvent(GameUpdated, request, Json.Object("round" to round, "game" to game.toJson()))
|
||||||
if (game.table != previousTable) {
|
if (game.table != previousTable) {
|
||||||
|
val tableWasOccupied = ( tournament.games(round).values.find { g -> g != game && g.table == game.table } != null )
|
||||||
|
if (tableWasOccupied) {
|
||||||
|
// some renumbering is necessary
|
||||||
val sortedPairables = tournament.getSortedPairables(round)
|
val sortedPairables = tournament.getSortedPairables(round)
|
||||||
val sortedMap = sortedPairables.associateBy {
|
val sortedMap = sortedPairables.associateBy {
|
||||||
it.getID()!!
|
it.getID()!!
|
||||||
@@ -120,8 +123,12 @@ object PairingHandler: PairgothApiHandler {
|
|||||||
}
|
}
|
||||||
tournament.dispatchEvent(
|
tournament.dispatchEvent(
|
||||||
TablesRenumbered, request,
|
TablesRenumbered, request,
|
||||||
Json.Object("round" to round, "games" to games.map { it.toJson() }.toCollection(Json.MutableArray()))
|
Json.Object(
|
||||||
|
"round" to round,
|
||||||
|
"games" to games.map { it.toJson() }.toCollection(Json.MutableArray())
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Json.Object("success" to true)
|
return Json.Object("success" to true)
|
||||||
|
Reference in New Issue
Block a user