Results tab ok
This commit is contained in:
@@ -33,6 +33,7 @@ object PairingHandler: PairgothApiHandler {
|
||||
override fun post(request: HttpServletRequest): Json {
|
||||
val tournament = getTournament(request)
|
||||
val round = getSubSelector(request)?.toIntOrNull() ?: badRequest("invalid round number")
|
||||
if (round > tournament.lastRound() + 1) badRequest("invalid round: previous round has not been played")
|
||||
val payload = getArrayPayload(request)
|
||||
val allPlayers = payload.size == 1 && payload[0] == "all"
|
||||
//if (!allPlayers && tournament.pairing.type == PairingType.SWISS) badRequest("Swiss pairing requires all pairable players")
|
||||
|
@@ -21,6 +21,7 @@ object ResultsHandler: PairgothApiHandler {
|
||||
override fun put(request: HttpServletRequest): Json {
|
||||
val tournament = getTournament(request)
|
||||
val round = getSubSelector(request)?.toIntOrNull() ?: badRequest("invalid round number")
|
||||
if (round != tournament.lastRound()) badRequest("cannot enter results in other rounds but the last")
|
||||
val payload = getObjectPayload(request)
|
||||
val game = tournament.games(round)[payload.getInt("id")] ?: badRequest("invalid game id")
|
||||
game.result = Game.Result.fromSymbol(payload.getChar("result") ?: badRequest("missing result"))
|
||||
|
@@ -212,6 +212,7 @@ object OpenGotha {
|
||||
}
|
||||
</Players>
|
||||
<Games>
|
||||
// TODO - table number is not any more kinda random like this
|
||||
${(1..tournament.lastRound()).map { tournament.games(it) }.flatMapIndexed { index, games ->
|
||||
games.values.mapIndexed { table, game ->
|
||||
Triple(index + 1, table , game)
|
||||
|
Reference in New Issue
Block a user