From bdb10b4e3da6926db9e65f97a5b033694f376d50 Mon Sep 17 00:00:00 2001 From: Kaylie Velazquez-Becerra Date: Mon, 18 Nov 2024 17:17:17 -0800 Subject: [PATCH 1/2] Update main.py Task 3: Show all books in the database As a user, I should be able to see all available books in the Items page, so that I have the greatest selection of books. Changes were made to line 39, 44 and 45 --- main.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main.py b/main.py index 67fb91b..c8eadfd 100644 --- a/main.py +++ b/main.py @@ -36,13 +36,13 @@ def root(): # Show last product added cur.execute('SELECT productId, name, price, description, image, stock FROM products ORDER BY productId DESC LIMIT 1 ') # Show all items - #cur.execute('SELECT productId, name, price, description, image, stock FROM products LIMIT 1') + cur.execute('SELECT productId, name, price, description, image, stock FROM products LIMIT 1') item_data = cur.fetchall() # Show an error instead of the categories category_data = [(-1,"Error")] # Show all categories - #cur.execute('SELECT categoryId, name FROM categories') - #category_data = cur.fetchall() + cur.execute('SELECT categoryId, name FROM categories') + category_data = cur.fetchall() item_data = parse(item_data) return render_template('home.html', itemData=item_data, loggedIn=logged_in, firstName=first_name, noOfItems=no_of_items, categoryData=category_data) From eefaa96afbf028d566540366705987039415f159 Mon Sep 17 00:00:00 2001 From: Kaylie Velazquez-Becerra Date: Tue, 26 Nov 2024 13:34:31 -0800 Subject: [PATCH 2/2] Update main.py Change made to line 39, Deleted LIMIT 1 as this only shows one picture of books, by deleting we get a row of all pictures of current books. --- main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.py b/main.py index c8eadfd..f489f62 100644 --- a/main.py +++ b/main.py @@ -36,7 +36,7 @@ def root(): # Show last product added cur.execute('SELECT productId, name, price, description, image, stock FROM products ORDER BY productId DESC LIMIT 1 ') # Show all items - cur.execute('SELECT productId, name, price, description, image, stock FROM products LIMIT 1') + cur.execute('SELECT productId, name, price, description, image, stock FROM products') #Delete LIMIT 1 So all pictures show item_data = cur.fetchall() # Show an error instead of the categories category_data = [(-1,"Error")]