From a5fe170a43af7c20c39eac6e3994a3efedd4c2d6 Mon Sep 17 00:00:00 2001 From: vsitum <61758568+vsitum@users.noreply.github.com> Date: Tue, 23 Jun 2020 11:37:59 -0700 Subject: [PATCH 1/3] Update main.py Lines 24, 26, 179, 181 and 182 are fixed. #'s are removed and variables user_id and first_name are changed to userID and firstname. --- main.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/main.py b/main.py index 67fb91b..3047fb7 100644 --- a/main.py +++ b/main.py @@ -21,9 +21,9 @@ def get_login_details(): no_of_items = 0 else: logged_in = True - cur.execute("SELECT user_id, first_name FROM users WHERE email = '" + session['email'] + "'") + cur.execute("SELECT userId, firstName FROM users WHERE email = '" + session['email'] + "'") user_id, first_name = cur.fetchone() - cur.execute("SELECT count(productId) FROM kart WHERE user_id = " + str(user_id)) + cur.execute("SELECT count(productId) FROM kart WHERE userId = " + str(user_id)) no_of_items = cur.fetchone()[0] conn.close() return (logged_in, first_name, no_of_items) @@ -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 de5a9598da8313dbb83df6184bd55abd5d6be0d9 Mon Sep 17 00:00:00 2001 From: kulmiye73 <60412799+kulmiye73@users.noreply.github.com> Date: Tue, 23 Jun 2020 11:50:00 -0700 Subject: [PATCH 2/3] Update main.py lines 44 and 45 are fixed. #'s are removed . --- main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 67fb91b..e8e6bec 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 ad5babc5fd339d62cc642c762ae3a108d7fdc2ed Mon Sep 17 00:00:00 2001 From: igor-turcan <62028367+igor-turcan@users.noreply.github.com> Date: Tue, 23 Jun 2020 12:05:12 -0700 Subject: [PATCH 3/3] Update main.py Line 39 is fixed. # was removed and word "LIMIT 1" was erased. --- main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.py b/main.py index cf3b850..b30ff79 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') item_data = cur.fetchall() # Show an error instead of the categories category_data = [(-1,"Error")]