From e2412d8d62e8fd57d63753ee0d92fe4e3db5a3cc Mon Sep 17 00:00:00 2001 From: Daniel Muckerman Date: Sat, 12 Dec 2020 01:33:33 -0500 Subject: [PATCH] Fix game list user id bug --- app.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app.py b/app.py index 4cfe309..0fb76dc 100644 --- a/app.py +++ b/app.py @@ -229,7 +229,7 @@ def add_game(): c = conn.cursor() if game_title is not None and len(game_title) > 0 and game_link is not None and len(game_link) > 0: - c.execute("INSERT INTO games (user_id, game_title, game_link) VALUES (?, ?, ?)", (session['user_id'], game_title, game_link,)) + c.execute("INSERT INTO games (user_id, game_title, game_link) VALUES (?, ?, ?)", (current_user.username, game_title, game_link,)) conn.commit() conn.close() @@ -262,8 +262,8 @@ def generate_game_list(): conn = sqlite3.connect('config/games_in_progress.db') c = conn.cursor() - if 'user_id' in session: - c.execute('SELECT * FROM games WHERE user_id=?', (session['user_id'], )) + if current_user.is_authenticated: + c.execute('SELECT * FROM games WHERE user_id=?', (current_user.username, )) rows = c.fetchall() conn.close()