aboutsummaryrefslogtreecommitdiff
path: root/app.py
diff options
context:
space:
mode:
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)