Skip to content

Commit 129cbcf

Browse files
Seluj78supalarry
authored andcommitted
Added distance bewteen logged in user and viewed user in profile view
1 parent ad2d8d9 commit 129cbcf

File tree

1 file changed

+6
-1
lines changed
  • backend/PyMatcha/routes/api/profile

1 file changed

+6
-1
lines changed

backend/PyMatcha/routes/api/profile/view.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
from PyMatcha.models.user import get_user
2323
from PyMatcha.models.view import View
2424
from PyMatcha.utils.errors import NotFoundError
25+
from PyMatcha.utils.match_score import _get_distance
2526
from PyMatcha.utils.success import SuccessOutput
2627

2728
profile_view_bp = Blueprint("profile_view", __name__)
@@ -46,4 +47,8 @@ def view_profile(uid):
4647
if current_user.id != u.id:
4748
View.create(profile_id=u.id, viewer_id=current_user.id)
4849

49-
return SuccessOutput("profile", u.to_dict())
50+
user_dict = u.to_dict()
51+
# TODO: Update swagger with this
52+
user_dict["distance"] = _get_distance(current_user.geohash, u.geohash)
53+
54+
return SuccessOutput("profile", user_dict)

0 commit comments

Comments
 (0)