def calculate_fbh_for_team(tournament, team): games = get_games_of_team(tournament, team) fbh = 0 for g in [game for game in games if game.is_finished()]: opponent = tournament.get_team_by_name(g.get_opponent(team)) if opponent is not None: fbh += opponent.bh team.fbh = fbh
def calculate_sb_for_team(tournament, team): games = get_games_of_team(tournament, team) team.sb = 0 for g in [game for game in games if game.is_finished()]: if g.get_winner() == team.name: opponent = tournament.get_team_by_name(g.get_looser()) if opponent is not None: team.sb += opponent.wins
def calculate_koya_for_team(tournament, team): games = get_games_of_team(tournament, team) team.koya = 0 number_of_games = len(tournament.rounds) for g in [game for game in games if game.is_finished()]: opponent = tournament.get_team_by_name(g.get_opponent(team)) if opponent is not None: if opponent.wins >= number_of_games / 2: team.koya += opponent.wins
def calculate_wins_and_points_for_team(tournament, team): games = get_games_of_team(tournament, team) wins, losses, points, points_against, fr = 0, 0, 0, 0, 0 for g in [game for game in games if game.is_finished()]: if g.get_winner() == team.name: wins += 1 else: losses += 1 if g.is_free_round(): fr += 1 points += g.get_points(team) points_against += g.get_points_against(team) team.wins = wins team.losses = losses team.points = points team.points_against = points_against team.fl = fr