def POST(self, id_round): list_inputs = web.input() # get bye player byePlayer = trn.reportIdByePlayer(id_round) for key in list_inputs: if key != "save": idPlayers = list_inputs[key].encode("ascii", "ignore") # Split id for each input to get the id which will be record separatorPlayers = str.find(idPlayers, ".") if separatorPlayers != -1: winner = idPlayers[:separatorPlayers] loser = idPlayers[separatorPlayers + 1 :] tied = None else: separatorPlayers = str.find(idPlayers, "_") winner = idPlayers[:separatorPlayers] loser = idPlayers[separatorPlayers + 1 :] tied = idPlayers # Records match results. trn.saveResultMatch(id_round, int(key[5:]), winner, loser, tied) # Update result of bye player to sum a win according to the rules trn.updateScoreboardBye(id_round, byePlayer) # Returns id tournament id_tournament = trn.reportIdTournament(id_round) # Returns next round id_round_next = trn.getNextRound(id_round, id_tournament) if id_round_next != None: # Returns standings for actual round standings = trn.roundStandings(id_round) for standing in standings: # register standing for next round trn.registerStandings( id_round_next, standing[0], standing[2], standing[3], standing[4], standing[5], "Insert" ) url = "/player_matches/%d" % int(id_round) raise web.seeother(url)
def GET(self, id_round): # Returns standings for round playerStandings = trn.roundStandings(id_round) # Returns id for a tournament id_tournament = trn.reportIdTournament(id_round) return render.player_standings(id_round, id_tournament, playerStandings)