From b581661c993095c43ad19540999ab21957d0e013 Mon Sep 17 00:00:00 2001 From: Karan Jayachandra Date: Wed, 16 Oct 2024 16:20:13 +0200 Subject: Added guests funtionality --- app.py | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'app.py') diff --git a/app.py b/app.py index c6f7af1..a37be7c 100644 --- a/app.py +++ b/app.py @@ -15,21 +15,35 @@ def home(): return render_template("index.j2") +@app.route("/guests", methods=["GET"]) +def get_guests(): + return render_template("guests.j2", guests=rg.players.guests) + + +@app.route("/decrement", methods=["POST"]) +def increment_guests(): + return render_template("guests.j2", guests=rg.players.decrement_guests()) + + +@app.route("/increment", methods=["POST"]) +def decrement_guests(): + return render_template("guests.j2", guests=rg.players.increment_guests()) + + @app.route("/propose", methods=["POST"]) def get_random_games(): levels = int(request.form["type"].split()[0]) - return render_template("games.j2", title="Proposal", games=rg.propose(levels)) + return render_template("games.j2", games=rg.propose(levels), title="Proposal") @app.route("/confirm", methods=["POST"]) def confirm_games(): - games = rg.confirm() - return render_template("games.j2", title=f"Round: {rg.round}", games=games) + return render_template("games.j2", games=rg.confirm(), title=f"Round: {rg.round}") @app.route("/clear", methods=["POST"]) def clear_games(): - return render_template("games.j2", title=f"Round: {rg.round}", games=rg.clear()) + return render_template("games.j2", games=rg.clear(), title=f"Round: {rg.round}") @app.route("/player-toggle/", methods=["POST"]) -- cgit v1.3.1