From 32c0baedaf593514eae0607a023c62aa688aeda9 Mon Sep 17 00:00:00 2001 From: Benjamyn Love Date: Sun, 9 Feb 2020 03:08:01 +1100 Subject: [PATCH] Updated query to use the USER_META table --- shop.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shop.py b/shop.py index a398377..385b8e5 100644 --- a/shop.py +++ b/shop.py @@ -52,8 +52,8 @@ def runQuery(query, data=None): return ret def readFromDB(): - # query = '''select * from SHOPLIST''' - query = '''select SHOPLIST.id, SHOPLIST.item, SHOPLIST.gotten, USERS.username from SHOPLIST inner join USERS on SHOPLIST.user_id = USERS.id''' + # By default load all shopping lists the user is a part of (Most users will only have one so this this fine) + query = '''select SHOPLIST.id, SHOPLIST.item, SHOPLIST.gotten, USERS.username, SHOPLIST.list_id from SHOPLIST inner join USERS on SHOPLIST.user_id = USERS.id inner join USER_META on SHOPLIST.list_id = USER_META.list_id''' return runQuery(query) def insertToDB(data):