From 4c3b6c421e88fcca684915bc43283c58219dfb6b Mon Sep 17 00:00:00 2001 From: JTNguyen269 <148581513+JTNguyen269@users.noreply.github.com> Date: Wed, 22 Nov 2023 08:48:46 -0800 Subject: [PATCH 01/12] Update to main.py Edits on line 24: user_id, first_name --> userId, firstName to fix sign in issue after registration Edits on line 44, 45: Uncommented to show all categories. Edits on line 179, 181, 182: Uncommented to enable login and registration feature --- main.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/main.py b/main.py index 67fb91b..a998ca7 100644 --- a/main.py +++ b/main.py @@ -21,7 +21,7 @@ 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)) no_of_items = cur.fetchone()[0] @@ -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) @@ -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 93efa68b831a09ed971081eb0d2f7ead703ac3cd Mon Sep 17 00:00:00 2001 From: JTNguyen269 <148581513+JTNguyen269@users.noreply.github.com> Date: Wed, 22 Nov 2023 10:19:09 -0800 Subject: [PATCH 02/12] main.py update Edit on line 26: Changed user_id --> userId --- database.db | Bin 28672 -> 28672 bytes main.py | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/database.db b/database.db index 26fcec2f7f733e9c79c9bd7b0262a68db0427e9d..fd2dde57e660c2ea360481437c35cba6d8323303 100644 GIT binary patch delta 178 zcmZp8z}WDBae_3X`9v9KR&xfuaIcLi3-~!0`D+;XYxo{*7F0OEH~Ea*hWbWEMqUPA zYf(vkUU5-Dbw$I(l%ynMLvssLOT)Aj)1)MWWFr#`Q$ve1W6Pv8vlOrVj6A>e(#q64 zBQr~f^xVYE9KGcHT!gTpp`nq5La?iXk(o(|heCjlrG&Zib8Nn WVo7STk*Tq{F{`4^nJiN%R2dU=WIiAC9oB_*j2>A8uSIeN+Yxh@EKKe)89p=oeNW|@LtVoG9>LTFxQ zS!z*nW=W-yfw7T+xqD)1Nn);oQ)x;{Mj}uR(9qD5lEk8bqQsQc;tbEcl*~j+Q%g%@ NRwE+=LxV*M0RXG7J(~ak diff --git a/main.py b/main.py index a998ca7..cf3b850 100644 --- a/main.py +++ b/main.py @@ -23,7 +23,7 @@ def get_login_details(): logged_in = True 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) From abfac417e42f18c5bcb389e56a879373ec65f7b0 Mon Sep 17 00:00:00 2001 From: JTNguyen269 <148581513+JTNguyen269@users.noreply.github.com> Date: Wed, 22 Nov 2023 10:22:19 -0800 Subject: [PATCH 03/12] Edit Profile update on main.py Edit on line 116: first_name --> firstName Fixed Operational Error --- main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.py b/main.py index cf3b850..e95e025 100644 --- a/main.py +++ b/main.py @@ -113,7 +113,7 @@ def edit_profile(): logged_in, first_name, no_of_items = get_login_details() with sqlite3.connect('database.db') as conn: cur = conn.cursor() - cur.execute("SELECT userId, email, first_name, lastName, address1, address2, zipcode, city, state, country, phone FROM users WHERE email = '" + session['email'] + "'") + cur.execute("SELECT userId, email, firstName, lastName, address1, address2, zipcode, city, state, country, phone FROM users WHERE email = '" + session['email'] + "'") profile_data = cur.fetchone() conn.close() return render_template("editProfile.html", profileData=profile_data, loggedIn=logged_in, firstName=first_name, noOfItems=no_of_items) From 68d1e4c2a0e8f7546401236a13d1ccaaf98d9d21 Mon Sep 17 00:00:00 2001 From: AbiyuTamirat2 <148640715+AbiyuTamirat2@users.noreply.github.com> Date: Fri, 24 Nov 2023 10:34:12 -0800 Subject: [PATCH 04/12] Update main.py --- main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.py b/main.py index e95e025..e599c09 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 LIMIT 1') item_data = cur.fetchall() # Show an error instead of the categories category_data = [(-1,"Error")] From 7c2bf0470363e16001e831f5a43e6a737178c8ed Mon Sep 17 00:00:00 2001 From: AbiyuTamirat2 <148640715+AbiyuTamirat2@users.noreply.github.com> Date: Fri, 24 Nov 2023 10:45:51 -0800 Subject: [PATCH 05/12] Revert "Update main.py" This reverts commit 68d1e4c2a0e8f7546401236a13d1ccaaf98d9d21. --- main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.py b/main.py index e599c09..e95e025 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 LIMIT 1') item_data = cur.fetchall() # Show an error instead of the categories category_data = [(-1,"Error")] From 459af11824fd6d68883c390f90e3d566b55c6130 Mon Sep 17 00:00:00 2001 From: AbiyuTamirat2 <148640715+AbiyuTamirat2@users.noreply.github.com> Date: Fri, 24 Nov 2023 10:49:50 -0800 Subject: [PATCH 06/12] To show all books in the database, removed '#' on line 39. --- main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.py b/main.py index e95e025..e599c09 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 LIMIT 1') item_data = cur.fetchall() # Show an error instead of the categories category_data = [(-1,"Error")] From b24b57f0c404fcbd5df1585ff9fb3b1d76ab5d7b Mon Sep 17 00:00:00 2001 From: JTNguyen269 <148581513+JTNguyen269@users.noreply.github.com> Date: Sat, 25 Nov 2023 10:56:46 -0800 Subject: [PATCH 07/12] Update Fiction Tab Added new book to Fiction tab. --- database.db | Bin 28672 -> 28672 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/database.db b/database.db index fd2dde57e660c2ea360481437c35cba6d8323303..9d3b9b61ce1e6d7169658190228084955abb7dd8 100644 GIT binary patch delta 186 zcmZp8z}WDBae_3X#Y7orMvILJOZ0hIc-J%Vi|}pdv*lgCSx{g;Z+#;-D<^|LW23z| zBcn%RQBkErKz>O{YLP->UW!6VMyi5yX;E=%ih^@SW=@J^2vDH7Bp;|Mvsj@xwL~E= zGcUCyH8oG6GBvTNSRpYDq!pwswJbHSq*x(8O#!Q^E~$wn899{-{2qxpIr-(qdS-fA O1?l`On{Dk58v+2CWIcfZ delta 42 ycmZp8z}WDBae_3X`9v9KM)QpcOZ0h|`D_{ZMfkS!+49+L78KCs+iYuh*bo2?j|;m1 From 9263e2456ea1cb66d288003b20beb418b039c7ce Mon Sep 17 00:00:00 2001 From: JTNguyen269 <148581513+JTNguyen269@users.noreply.github.com> Date: Sat, 25 Nov 2023 11:10:21 -0800 Subject: [PATCH 08/12] Edits on lines 254 & 257 Changed user_id --> userID --- database.db | Bin 28672 -> 28672 bytes main.py | 4 ++-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/database.db b/database.db index 9d3b9b61ce1e6d7169658190228084955abb7dd8..3cd0704a8044610ffc1b50092ae26166008cc79d 100644 GIT binary patch delta 51 zcmZp8z}WDBae_3X!$cWpMu&|FEA3go@PFZdzgaNgA^+s}{;b>#3=BMs%s`Tjar1wF GMg;)b+z;^p delta 51 zcmZp8z}WDBae_3X#Y7orMvILJEA3f-@_*)kzgaNgA^+s}{;b?g%#4gotc)OX^M8Lv F1pwFJ599y< diff --git a/main.py b/main.py index e599c09..52ee374 100644 --- a/main.py +++ b/main.py @@ -251,10 +251,10 @@ def remove_from_cart(): product_id = int(request.args.get('productId')) with sqlite3.connect('database.db') as conn: cur = conn.cursor() - cur.execute("SELECT user_id FROM users WHERE email = '" + email + "'") + cur.execute("SELECT userId FROM users WHERE email = '" + email + "'") user_id = cur.fetchone()[0] try: - cur.execute("DELETE FROM kart WHERE user_id = " + str(user_id) + " AND productId = " + str(product_id)) + cur.execute("DELETE FROM kart WHERE userId = " + str(user_id) + " AND productId = " + str(product_id)) conn.commit() msg = "removed successfully" except: From 9ccc369b1a2306456fed60d8973efe6c060156b3 Mon Sep 17 00:00:00 2001 From: AbiyuTamirat2 <148640715+AbiyuTamirat2@users.noreply.github.com> Date: Sat, 25 Nov 2023 11:46:50 -0800 Subject: [PATCH 09/12] Updated line 39: Displaying 4 books instead of 1. --- main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.py b/main.py index 52ee374..0f62066 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 LIMIT 4') item_data = cur.fetchall() # Show an error instead of the categories category_data = [(-1,"Error")] From 9167df08327ad8cabb54df266067c7d7ca6e8073 Mon Sep 17 00:00:00 2001 From: AbiyuTamirat2 <148640715+AbiyuTamirat2@users.noreply.github.com> Date: Sat, 25 Nov 2023 12:05:11 -0800 Subject: [PATCH 10/12] added The Power of Positive Thinking book to database. --- database.db | Bin 28672 -> 28672 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/database.db b/database.db index 3cd0704a8044610ffc1b50092ae26166008cc79d..38cabe268261cf0f7705daa79d3972baabd3a91a 100644 GIT binary patch delta 219 zcmZp8z}WDBae_3X<3t%}M#qf_OZ53zd2TT9i|}pdv*lgSb7Qlhz%d?y#t=4622aMO zNO4Bakc?D?$@A@{Smj`>dWFnlg+zs<{QPW%#H9Sv5`~QXa-cv#esN|=W?8C2Zf0Ie zacYS|a$=rBW^O@IK2R(tGc8q5!Lvjm9jF4RJ*6x&IaMJsFGZoaB)=#VC{&WKkdc~G wpir4#3KUDMM3@Is1vH~5IX^d5AvuFTF()TAFFmzb&rmO`Af0RTdfPxF0A_1S7XSbN delta 42 ycmZp8z}WDBae_3X!$cWpMu&|FOZ0hIc-J%Vi|}pdv*lgCSx{g;@8 Date: Sat, 25 Nov 2023 12:09:58 -0800 Subject: [PATCH 11/12] Updated line 39: Increased limit from 4 to 5. --- main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.py b/main.py index 0f62066..003af83 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 4') + cur.execute('SELECT productId, name, price, description, image, stock FROM products LIMIT 5') item_data = cur.fetchall() # Show an error instead of the categories category_data = [(-1,"Error")] From 913387be1ea5b99253bb390cfb3d9fdeda34848a Mon Sep 17 00:00:00 2001 From: AbiyuTamirat2 <148640715+AbiyuTamirat2@users.noreply.github.com> Date: Sun, 26 Nov 2023 10:12:43 -0800 Subject: [PATCH 12/12] Created username and password --- database.db | Bin 28672 -> 28672 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/database.db b/database.db index 38cabe268261cf0f7705daa79d3972baabd3a91a..aea1e339a7215832baa33dbb705ad774d16028e8 100644 GIT binary patch delta 189 zcmZp8z}WDBae_3X(?l6(MyHJlOZYjM_+B&c*YLgGEU0jRZ}J&A`T9maCSC?#cX4HH zUU5l5b>+0=6r)57GYbO?10!=o3jJnQ5X)l3_}sQL=GjajCJnfkSa#sa|SIsa|GYaAIOfS!Q-< zL1IcqWn!gqQgB9QnUR5^v7w1eVoFhFXn<#4N@k*wv5}#%iD9E2BQJxmud<@BxumhG pxMHfIL1Id>v89P+l2D?lWnxlNs;OD3fvI_#kwKcp<{J5y0027NH~#