diff options
author | lonkaars <l.leblansch@gmail.com> | 2021-03-10 16:03:54 +0100 |
---|---|---|
committer | lonkaars <l.leblansch@gmail.com> | 2021-03-10 16:03:54 +0100 |
commit | 91e284d685dab7525c9526be1cb264a7a9c65c5c (patch) | |
tree | 85eed8b5e6e35bf17668ea8a75f9108d1ae41474 /api/user | |
parent | f5b8dd384afb059aabc24af3539f30928c7f7da9 (diff) |
recent games on user page working :tada:
Diffstat (limited to 'api/user')
-rw-r--r-- | api/user/games.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/api/user/games.py b/api/user/games.py index 6073af2..95bd38a 100644 --- a/api/user/games.py +++ b/api/user/games.py @@ -25,7 +25,7 @@ def game_info(game_id, user_id = None): ]) + " from games where game_id = ?", [game_id]).fetchone() is_player_1 = game[4] != user_id outcome = "d" if game[5] == "d" else \ - "w" if game[5] == "w" and is_player_1 else "d" + "w" if game[5] == "w" and is_player_1 else "l" return { "id": game[0], "parent": game[1], @@ -70,7 +70,7 @@ def sum_games(user_id): #! SANITIZE USER_ID FIRST } def fetch_games(user_id, count): - game_ids = cursor.execute("select game_id from games where player_1_id = ? or player_2_id = ? order by created", [user_id, user_id]).fetchmany(count) + game_ids = cursor.execute("select game_id from games where player_1_id = ? or player_2_id = ? order by created desc", [user_id, user_id]).fetchmany(count) export = [] for game_id in game_ids: |