Allow edition of table number (but without recalc for now)

This commit is contained in:
Claude Brisson
2024-01-20 12:47:52 +01:00
parent fd1df8762a
commit a8bf1e891d

View File

@@ -89,6 +89,10 @@ object PairingHandler: PairgothApiHandler {
if (playing.contains(black.id)) badRequest("black is already in another game") if (playing.contains(black.id)) badRequest("black is already in another game")
if (playing.contains(white.id)) badRequest("white is already in another game") if (playing.contains(white.id)) badRequest("white is already in another game")
if (payload.containsKey("h")) game.handicap = payload.getString("h")?.toIntOrNull() ?: badRequest("invalid handicap") if (payload.containsKey("h")) game.handicap = payload.getString("h")?.toIntOrNull() ?: badRequest("invalid handicap")
if (payload.containsKey("t")) {
// TODO CB - update *all* tables numbers accordingly
game.table = payload.getString("t")?.toIntOrNull() ?: badRequest("invalid table number")
}
tournament.dispatchEvent(gameUpdated, Json.Object("round" to round, "game" to game.toJson())) tournament.dispatchEvent(gameUpdated, Json.Object("round" to round, "game" to game.toJson()))
return Json.Object("success" to true) return Json.Object("success" to true)
} }