File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed
Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -38,8 +38,15 @@ def search():
3838 today = datetime .datetime .utcnow ()
3939
4040 query = _get_gender_query (current_user .orientation , current_user .gender )
41+ matches_id = [match .id for match in current_user .get_matches ()]
42+ likes_sent_user_ids = [like .liked_id for like in current_user .get_likes_sent ()]
4143 returned_list = []
4244 for user in query :
45+ if user .id == current_user .id :
46+ continue
47+ if user .id in matches_id or user .id in likes_sent_user_ids :
48+ continue
49+
4350 user_age = (
4451 today .year - user .birthdate .year - ((today .month , today .day ) < (user .birthdate .month , user .birthdate .day ))
4552 )
Original file line number Diff line number Diff line change @@ -32,9 +32,15 @@ def create_user_recommendations(user_to_update):
3232
3333 if not query :
3434 return
35+
36+ matches_id = [match .id for match in user_to_update .get_matches ()]
37+ likes_sent_user_ids = [like .liked_id for like in user_to_update .get_likes_sent ()]
38+
3539 for user in query :
3640 if user .id == user_to_update .id :
3741 continue
42+ if user .id in matches_id or user .id in likes_sent_user_ids :
43+ continue
3844 score = 0
3945
4046 distance = _get_distance (user_to_update .geohash , user .geohash )
You can’t perform that action at this time.
0 commit comments