summaryrefslogtreecommitdiff
path: root/app.py
diff options
context:
space:
mode:
authorKaran Jayachandra <karan.jayachandra@nxp.com>2024-10-04 18:23:33 +0200
committerKaran Jayachandra <karan.jayachandra@nxp.com>2024-10-04 18:23:33 +0200
commit88d7300021cd3963f2d6a6202609b0f6e956cdab (patch)
treed9e9e186d86572e57253a188467ebb4084535039 /app.py
parentc58caf5b8b8801ba826b0ff6b241d7f25a333bc8 (diff)
Added the games view
Diffstat (limited to 'app.py')
-rw-r--r--app.py33
1 files changed, 31 insertions, 2 deletions
diff --git a/app.py b/app.py
index 7d9f808..7778b3e 100644
--- a/app.py
+++ b/app.py
@@ -1,6 +1,6 @@
from os import getenv
-from model import PlayerList
-from flask import Flask, abort, render_template
+from model import PlayerList, GameList
+from flask import Flask, abort, render_template, request
from dotenv import load_dotenv
load_dotenv()
@@ -8,6 +8,7 @@ load_dotenv()
print("Importing player list...\n")
PLAYER_LIST = PlayerList(location="test_data.csv")
+GAME_GENERATOR = GameList()
print("List of player:\n")
print(PLAYER_LIST)
@@ -21,6 +22,34 @@ def home():
return render_template("index.j2")
+# @app.route("/courts", methods=["POST"])
+# def set_courts():
+# print(request)
+# print(request.data)
+# print(request.json)
+# print(request.args)
+# return render_template(
+# "courts.j2",
+# courts=GAME_GENERATOR.courts,
+# )
+
+
+@app.route("/new-games", methods=["POST"])
+def get_new_games():
+ return render_template(
+ "games.j2",
+ games=GAME_GENERATOR.create_games(PLAYER_LIST.get_active_players()),
+ )
+
+
+@app.route("/game-list", methods=["GET"])
+def get_list_of_games():
+ return render_template(
+ "games.j2",
+ games=GAME_GENERATOR.create_games(PLAYER_LIST.get_active_players()),
+ )
+
+
@app.route("/player-toggle/<player_request>", methods=["POST"])
def toggle_player(player_request):
selection = PLAYER_LIST.get_player(player_request)