aboutsummaryrefslogtreecommitdiff
path: root/api/game/accept.py
diff options
context:
space:
mode:
authorlonkaars <l.leblansch@gmail.com>2021-04-11 17:50:58 +0200
committerlonkaars <l.leblansch@gmail.com>2021-04-11 17:50:58 +0200
commit28f104de9ae9abe4b42abafbf3865ede5687996c (patch)
tree65e651f09d8fbf81380384692e45803cb4f9d61c /api/game/accept.py
parent7b4859059b3bbabf4139ccdf3270a82c094f5d8e (diff)
dprint yapf python formatting
Diffstat (limited to 'api/game/accept.py')
-rw-r--r--api/game/accept.py17
1 files changed, 8 insertions, 9 deletions
diff --git a/api/game/accept.py b/api/game/accept.py
index 073f422..a231d3a 100644
--- a/api/game/accept.py
+++ b/api/game/accept.py
@@ -12,19 +12,18 @@ from game.new import start_game
join_game = Blueprint('game_accept', __name__)
+
# join a game by game_id (public or private)
-@join_game.route('/accept', methods = ['POST'])
+@join_game.route('/accept', methods=['POST'])
@auth_required("user")
def index(game_id):
- if cursor.execute("select status from games where game_id = ?", [game_id]).fetchone()[0] != "wait_for_opponent":
- return "", 403
+ if cursor.execute("select status from games where game_id = ?",
+ [game_id]).fetchone()[0] != "wait_for_opponent":
+ return "", 403
+
+ start_game(game_id, user_id)
- start_game(game_id, user_id)
+ return {"id": game_id, "player_1": False, "game_started": True}, 200
- return {
- "id": game_id,
- "player_1": False,
- "game_started": True
- }, 200
dynamic_route = ["/game", join_game]