From c721fb2e97dc81cee71d4b74f53ae7a5d583936f Mon Sep 17 00:00:00 2001 From: Ahadjimalis Date: Tue, 15 Jun 2021 09:15:15 -0700 Subject: [PATCH 01/11] Update main.py --- main.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/main.py b/main.py index 67fb91b..4391348 100644 --- a/main.py +++ b/main.py @@ -34,15 +34,15 @@ 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 3 ') # 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) @@ -176,10 +176,10 @@ def update_profile(): @app.route("/loginForm") def login_form(): # Uncomment to enable logging in and registration - #if 'email' in session: + if 'email' in session: return redirect(url_for('root')) - #else: - # return render_template('login.html', error='') + else: + return render_template('login.html', error='') @app.route("/login", methods = ['POST', 'GET']) def login(): From 8747e18383a084ce23e4501a299a2926d9f51ba4 Mon Sep 17 00:00:00 2001 From: Ahadjimalis Date: Tue, 15 Jun 2021 09:49:22 -0700 Subject: [PATCH 02/11] Update main.py --- main.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main.py b/main.py index 4391348..6d5cf7c 100644 --- a/main.py +++ b/main.py @@ -34,12 +34,12 @@ 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 3 ') + 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 4') item_data = cur.fetchall() # Show an error instead of the categories - category_data = [(-1,"Error")] + category_data = [(-1, "Error")] # Show all categories cur.execute('SELECT categoryId, name FROM categories') category_data = cur.fetchall() From 695b8c15fc955fe26d657ba68e194673f4197470 Mon Sep 17 00:00:00 2001 From: CJ-Stevens Date: Tue, 15 Jun 2021 12:55:53 -0700 Subject: [PATCH 03/11] I just done wrong. --- .idea/workspace.xml | 68 ++++----------------------------------------- 1 file changed, 5 insertions(+), 63 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 61919bd..ec2525c 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -1,10 +1,7 @@ - - - -