diff options
| author | Karan Jayachandra <karan.jayachandra@nxp.com> | 2024-10-14 11:10:35 +0200 |
|---|---|---|
| committer | Karan Jayachandra <karan.jayachandra@nxp.com> | 2024-10-14 11:10:35 +0200 |
| commit | d18e5880b47fcdf6542bcb9502e8cf35a4276f05 (patch) | |
| tree | e0bac60ba3eb36b84b068a93fee0782af96618eb /app.py | |
| parent | eac95cc2e259badf3a8c3309e6e7be97d5cbd868 (diff) | |
Cleand up the application code a bit
Diffstat (limited to 'app.py')
| -rw-r--r-- | app.py | 40 |
1 files changed, 8 insertions, 32 deletions
@@ -26,38 +26,26 @@ def home(): def get_random_games(): print("Creating new games...") GAME_GENERATOR.create_random_games(COURT_LIST, PLAYER_LIST) - return render_template( - "games.j2", - games=GAME_GENERATOR.games, - ) + return render_template("games.j2", games=GAME_GENERATOR.games) @app.route("/skilled-games", methods=["POST"]) def get_skilled_games(): print("Creating new games...") GAME_GENERATOR.create_skilled_games(COURT_LIST, PLAYER_LIST) - return render_template( - "games.j2", - games=GAME_GENERATOR.games, - ) + return render_template("games.j2", games=GAME_GENERATOR.games) @app.route("/clear-games", methods=["POST"]) def clear_games(): print("Clearing games...") GAME_GENERATOR.clear(COURT_LIST) - return render_template( - "games.j2", - games=GAME_GENERATOR.games, - ) + return render_template("games.j2", games=GAME_GENERATOR.games) @app.route("/game-list", methods=["GET"]) def get_list_of_games(): - return render_template( - "games.j2", - games=GAME_GENERATOR.games, - ) + return render_template("games.j2", games=GAME_GENERATOR.games) @app.route("/player-toggle/<player_request>", methods=["POST"]) @@ -67,18 +55,12 @@ def toggle_player(player_request): abort(404) PLAYER_LIST.toggle_player(player_request) selection = PLAYER_LIST.get_player(player_request) - return render_template( - "player.j2", - player=selection[0], - ) + return render_template("player.j2", player=selection[0]) @app.route("/player-list", methods=["GET"]) def get_list_of_players(): - return render_template( - "players.j2", - players=PLAYER_LIST.players, - ) + return render_template("players.j2", players=PLAYER_LIST.players) @app.route("/court-toggle/<court_number>", methods=["POST"]) @@ -89,15 +71,9 @@ def toggle_court(court_number): abort(404, f"Multiple courts requested: {len(selection)}") COURT_LIST.toggle_court(court_number) selection = COURT_LIST.get_court(court_number) - return render_template( - "court.j2", - court=selection[0], - ) + return render_template("court.j2", court=selection[0]) @app.route("/court-list", methods=["GET"]) def get_list_of_courts(): - return render_template( - "courts.j2", - courts=COURT_LIST.courts, - ) + return render_template("courts.j2", courts=COURT_LIST.courts) |
