From 055fb365434d22d1b489afcea617477348808679 Mon Sep 17 00:00:00 2001 From: Utsav Lal Date: Sat, 16 Sep 2023 22:23:36 -0400 Subject: [PATCH 1/2] Changes | Utsav --- insert_food_data.py | 2 +- requirements.txt | 4 ++-- tests/application.py | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/insert_food_data.py b/insert_food_data.py index a9a2603b..10f501bf 100644 --- a/insert_food_data.py +++ b/insert_food_data.py @@ -10,4 +10,4 @@ for i in range(1, len(l)): temp = l[i].split(",") - mongo.db.food.insert({'food': temp[0], 'calories': temp[1]}) + mongo.db.food.insert_one({'food': temp[0], 'calories': temp[1]}) diff --git a/requirements.txt b/requirements.txt index c849055b..81ab8254 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -bcrypt==3.2.0 +bcrypt==4.0.1 blinker==1.4 bson==0.5.10 certifi==1.0.1 @@ -19,7 +19,7 @@ Jinja2==3.0.1 jwt==1.2.0 MarkupSafe==2.0.1 pycparser==2.20 -pymongo==3.11.3 +pymongo==4.5.0 python-dateutil==2.8.2 six==1.16.0 tabulate==0.8.9 diff --git a/tests/application.py b/tests/application.py index 2d26380a..a00d4adf 100644 --- a/tests/application.py +++ b/tests/application.py @@ -100,7 +100,7 @@ def register(): username = request.form.get('username') email = request.form.get('email') password = request.form.get('password') - mongo.db.user.insert({'name': username, 'email': email, 'pwd': bcrypt.hashpw( + mongo.db.user.insert_one({'name': username, 'email': email, 'pwd': bcrypt.hashpw( password.encode("utf-8"), bcrypt.gensalt())}) flash(f'Account created for {form.username.data}!', 'success') return redirect(url_for('home')) @@ -168,13 +168,13 @@ def user_profile(): temp = mongo.db.profile.find_one({'email': email}, { 'height', 'weight', 'goal', 'target_weight'}) if temp is not None: - mongo.db.profile.update({'email': email}, + mongo.db.profile.update_one({'email': email}, {'$set': {'weight': temp['weight'], 'height': temp['height'], 'goal': temp['goal'], 'target_weight': temp['target_weight']}}) else: - mongo.db.profile.insert({'email': email, + mongo.db.profile.insert_one({'email': email, 'height': height, 'weight': weight, 'goal': goal, From 4e28a79a5b2bda4abb4fda97f0e4341ac080f3a1 Mon Sep 17 00:00:00 2001 From: Utsav Lal Date: Mon, 9 Oct 2023 16:53:46 -0400 Subject: [PATCH 2/2] Fix user profile not showing correct values | Utsav --- templates/display_profile.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/templates/display_profile.html b/templates/display_profile.html index a59906d7..f69802ae 100644 --- a/templates/display_profile.html +++ b/templates/display_profile.html @@ -16,7 +16,7 @@

Your Profile

Your Height

-

164 cms

+

{{ form.height.data }}

@@ -24,7 +24,7 @@

Your Height

Your Weight

-

58 Kgs

+

{{ form.weight.data }}

@@ -32,7 +32,7 @@

Your Weight

Your Target Weight

-

53 Kgs

+

{{ form.target_weight.data }}