Game edition ok, and other minor tweaks
This commit is contained in:
@@ -13,7 +13,7 @@ interface ApiHandler {
|
||||
when (request.method) {
|
||||
"GET" -> get(request, response)
|
||||
"POST" -> post(request)
|
||||
"PUT" -> put(request)
|
||||
"PUT" -> put(request)
|
||||
"DELETE" -> delete(request)
|
||||
else -> notImplemented()
|
||||
}
|
||||
|
@@ -16,7 +16,7 @@ interface PairgothApiHandler: ApiHandler {
|
||||
fun Tournament<*>.dispatchEvent(event: Event, data: Json? = null) {
|
||||
Event.dispatch(event, Json.Object("tournament" to id, "data" to data))
|
||||
// when storage is not in memory, the tournament has to be persisted
|
||||
if (event != Event.tournamentAdded && event != Event.tournamentDeleted && event != Event.gameUpdated)
|
||||
if (event != Event.tournamentAdded && event != Event.tournamentDeleted)
|
||||
Store.replaceTournament(this)
|
||||
}
|
||||
|
||||
|
@@ -71,6 +71,7 @@ object PairingHandler: PairgothApiHandler {
|
||||
val playing = (tournament.games(round).values).filter { it.id != gameId }.flatMap {
|
||||
listOf(it.black, it.white)
|
||||
}.toSet()
|
||||
if (game.result != Game.Result.UNKNOWN) badRequest("Game already has a result");
|
||||
game.black = payload.getID("b") ?: badRequest("missing black player id")
|
||||
game.white = payload.getID("w") ?: badRequest("missing white player id")
|
||||
tournament.recomputeDUDD(round, game.id)
|
||||
|
Reference in New Issue
Block a user