Add an API call and a button to reset all results for a round
This commit is contained in:
@@ -27,4 +27,14 @@ object ResultsHandler: PairgothApiHandler {
|
||||
tournament.dispatchEvent(Event.ResultUpdated, request, Json.Object("round" to round, "data" to game))
|
||||
return Json.Object("success" to true)
|
||||
}
|
||||
|
||||
override fun delete(request: HttpServletRequest, response: HttpServletResponse): Json {
|
||||
val tournament = getTournament(request)
|
||||
val round = getSubSelector(request)?.toIntOrNull() ?: badRequest("invalid round number")
|
||||
for (game in tournament.games(round).values) {
|
||||
game.result = Game.Result.UNKNOWN
|
||||
}
|
||||
tournament.dispatchEvent(Event.ResultsCleared, request, Json.Object("round" to round))
|
||||
return Json.Object("success" to true)
|
||||
}
|
||||
}
|
||||
|
@@ -17,6 +17,7 @@ enum class Event {
|
||||
GamesDeleted,
|
||||
GameUpdated,
|
||||
ResultUpdated,
|
||||
ResultsCleared,
|
||||
TablesRenumbered
|
||||
;
|
||||
|
||||
|
Reference in New Issue
Block a user