diff --git a/.idea/CNA340_FinalProject.iml b/.idea/CNA340_FinalProject.iml
index 86bd522..6e2b07a 100644
--- a/.idea/CNA340_FinalProject.iml
+++ b/.idea/CNA340_FinalProject.iml
@@ -4,10 +4,7 @@
-
+
-
-
-
\ No newline at end of file
diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
new file mode 100644
index 0000000..6234eb2
--- /dev/null
+++ b/.idea/inspectionProfiles/Project_Default.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index a31d283..6f3d4f6 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -1,4 +1,7 @@
-
+
+
+
+
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 61919bd..c150a29 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -1,10 +1,35 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
-
@@ -24,52 +49,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
registerationForm
@@ -90,23 +69,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -117,57 +79,16 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
@@ -213,7 +134,7 @@
-
+
@@ -287,7 +208,6 @@
-
@@ -308,151 +228,25 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/database.db b/database.db
index 26fcec2..186099d 100644
Binary files a/database.db and b/database.db differ
diff --git a/main.py b/main.py
index 67fb91b..4a1af6f 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)
@@ -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 ')
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():