aboutsummaryrefslogtreecommitdiff
path: root/api/game/new.py
diff options
context:
space:
mode:
authorlonkaars <l.leblansch@gmail.com>2021-04-11 18:03:11 +0200
committerlonkaars <l.leblansch@gmail.com>2021-04-11 18:03:11 +0200
commitdeb09e5c749e3353c927d7fe94bbd35f25ff85ee (patch)
tree702ba982530aa98a96ddece365a32be842dae3c2 /api/game/new.py
parent28f104de9ae9abe4b42abafbf3865ede5687996c (diff)
dprint yapf continuation align style edit
Diffstat (limited to 'api/game/new.py')
-rw-r--r--api/game/new.py20
1 files changed, 10 insertions, 10 deletions
diff --git a/api/game/new.py b/api/game/new.py
index 7f0862b..8c936de 100644
--- a/api/game/new.py
+++ b/api/game/new.py
@@ -13,8 +13,8 @@ def create_game(user_1_id, private=False, user_2_id=None):
game_id = new_uuid("games")
cursor.execute(
- "insert into games values (?, NULL, \"\", ?, ?, NULL, ?, NULL, ?, NULL, NULL, NULL, \"wait_for_opponent\", \"default\", ?, FALSE) ",
- (game_id, user_1_id, user_2_id, timestamp, timestamp, private)
+ "insert into games values (?, NULL, \"\", ?, ?, NULL, ?, NULL, ?, NULL, NULL, NULL, \"wait_for_opponent\", \"default\", ?, FALSE) ",
+ (game_id, user_1_id, user_2_id, timestamp, timestamp, private)
)
connection.commit()
@@ -25,25 +25,25 @@ def start_game(game_id, user_2_id):
timestamp = int(time.time() * 1000)
db_game = cursor.execute(
- "select player_2_id, status, private from games where game_id = ?",
- [game_id]
+ "select player_2_id, status, private from games where game_id = ?",
+ [game_id]
).fetchone()
if db_game[1] != "wait_for_opponent": return False
if db_game[0] == None:
cursor.execute(
- "update games set player_2_id = ? where game_id = ?",
- (user_2_id, game_id)
+ "update games set player_2_id = ? where game_id = ?",
+ (user_2_id, game_id)
)
cursor.execute(
- "update games set status = \"in_progress\", started = ?, last_activity = ? where game_id = ?",
- (timestamp, timestamp, game_id)
+ "update games set status = \"in_progress\", started = ?, last_activity = ? where game_id = ?",
+ (timestamp, timestamp, game_id)
)
connection.commit()
players = cursor.execute(
- "select player_1_id, player_2_id from games where game_id = ?",
- [game_id]
+ "select player_1_id, player_2_id from games where game_id = ?",
+ [game_id]
).fetchone()
games[game_id] = game(game_id, io, players[0], players[1])