From e4d308e3c97b486ccc8d2b3e8f279549fca6dd6b Mon Sep 17 00:00:00 2001 From: Jennifer Taylor Date: Fri, 10 Sep 2021 19:15:20 +0000 Subject: [PATCH] Fix get_games_played to not accidentally see half-created profiles. --- bemani/data/mysql/user.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bemani/data/mysql/user.py b/bemani/data/mysql/user.py index c35c914..63b4357 100644 --- a/bemani/data/mysql/user.py +++ b/bemani/data/mysql/user.py @@ -548,7 +548,7 @@ class UserData(BaseData): """ if not userids: return [] - sql = "SELECT version, userid FROM refid WHERE game = :game AND userid IN :userids" + sql = "SELECT version, userid FROM refid WHERE game = :game AND userid IN :userids AND refid IN (SELECT refid FROM profile)" cursor = self.execute(sql, {'game': game.value, 'userids': userids}) profilever: Dict[UserID, int] = {} @@ -588,7 +588,7 @@ class UserData(BaseData): Returns: A List of Tuples of game, version for each game/version the user has played. """ - sql = "SELECT game, version FROM refid WHERE userid = :userid" + sql = "SELECT game, version FROM refid WHERE userid = :userid AND refid IN (SELECT refid FROM profile)" vals: Dict[str, Any] = {'userid': userid} if game is not None: