From b55c68a2187f782c9abc242a2767ae95e27f8df3 Mon Sep 17 00:00:00 2001 From: Mike <65267796+ThaHolyPaladin@users.noreply.github.com> Date: Mon, 22 Jun 2020 18:28:28 -0700 Subject: [PATCH 1/3] Update main.py --- main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.py b/main.py index 67fb91b..ea1afef 100644 --- a/main.py +++ b/main.py @@ -34,7 +34,7 @@ def root(): with sqlite3.connect('database.db') as conn: cur = conn.cursor() # Show last product added - cur.execute('SELECT productId, name, price, description, image, stock FROM products ORDER BY productId DESC LIMIT 1 ') + cur.execute('SELECT productId, name, price, description, image, stock FROM products ORDER BY productId DESC LIMIT 4 ') # Show all items #cur.execute('SELECT productId, name, price, description, image, stock FROM products LIMIT 1') item_data = cur.fetchall() From 5d15e7248ae17b5fb425c962e414b349af2cdd33 Mon Sep 17 00:00:00 2001 From: kingarthurthegr8 <65997741+kingarthurthegr8@users.noreply.github.com> Date: Mon, 22 Jun 2020 21:51:14 -0700 Subject: [PATCH 2/3] Category fix fixed the category function --- main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index ea1afef..47c7907 100644 --- a/main.py +++ b/main.py @@ -41,8 +41,8 @@ def root(): # 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 aed6cb2cff6284f6c8df60fb24fb32d6a2f00716 Mon Sep 17 00:00:00 2001 From: kingarthurthegr8 <65997741+kingarthurthegr8@users.noreply.github.com> Date: Mon, 22 Jun 2020 22:02:49 -0700 Subject: [PATCH 3/3] Category section fixed line 52 and 53 had "3"'s infron of them making them comments and not a part of the code. --- main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.py b/main.py index 47c7907..b8467b2 100644 --- a/main.py +++ b/main.py @@ -45,7 +45,7 @@ def root(): 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) - +# Part of function was made into a comment. @app.route("/add") def admin(): with sqlite3.connect('database.db') as conn: