Beispiel #1
0
def show_players():
    players = []
    selected_players = player_repository.select_all()
    for player in selected_players:
        players.append(get_player_info(player))

    return make_response(jsonify(players)), 200
def new_game():
    players = player_repository.select_all()
    games = game_repository.select_all()
    return render_template(
        "games/new.html",
        players=players,
        all_games=games,
    )
Beispiel #3
0
def create_predictions_for_knockout_matches():
    for player in player_repository.select_all():
        # Predictions
        for match in match_repository.select_all():
            if match.id > 36:
                if match.team_1 != None and match.team_2 != None:
                    home_player_team = player_team_repository.select_by_player_and_team(
                        player, match.team_1)
                    away_player_team = player_team_repository.select_by_player_and_team(
                        player, match.team_2)
                    prediction_repository.save(
                        Prediction(player, match, home_player_team,
                                   away_player_team))
                else:
                    prediction_repository.save(
                        Prediction(player, match, None, None))
Beispiel #4
0
def update_all_player_points():
    fetch_results()

    all_players = player_repository.select_all()

    for player in all_players:
        player.points = 0
        predictions = player_repository.predictions(player)

        if len(predictions) > 0:
            for prediction in predictions:
                if prediction.has_prediction and prediction.match.goals[
                        "home"] is not None and prediction.match.goals[
                            "away"] is not None:
                    prediction.award_points()

            player_repository.update(player)
def players():
    players = player_repository.select_all()
    return render_template("players/index.html", players=players)
def new_player():
    players = player_repository.select_all()
    return render_template("players/new.html", players=players)
def players():
    players = player_repository.select_all()
    teams = team_repository.select_all()
    return render_template("clubs/players/index.html",
                           players=players,
                           teams=teams)