def playerMatchHistory(id): player = Player.find_by_id(id) playerMatches = PlayerMatch.find_by_player(id); lis = [] for playerMatch in playerMatches: match = Match.find_by_id(playerMatch.matchId) lis.append((playerMatch,match)) return render_template("playerMatchHistory.html", playerMatches=lis, player=player)
def deleteMatch(id): try: match = Match.find_by_id(id) winner = match.winner for pl in Player.find_all(): plmt = PlayerMatch.find_by_player_and_match(pl.id, match.id); if plmt: plmt.delete_from_db() pl.score -= getattr(pl, match.winner) match.delete_from_db() return Response("Match with id "+str(match.id)+" deleted") except Exception as e: raise