Skip to content

Commit 3a6e032

Browse files
committed
Fixed missing birthdate and distance in recommendation update task
1 parent b91f08e commit 3a6e032

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

backend/PyMatcha/utils/tasks.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,11 @@ def update_user_recommendations():
108108
count += 1
109109
user_to_update_recommendations = []
110110

111+
if not user_to_update.birthdate:
112+
continue
113+
if not user_to_update.geohash:
114+
continue
115+
111116
user_to_update_age = (
112117
today.year
113118
- user_to_update.birthdate.year
@@ -123,7 +128,8 @@ def update_user_recommendations():
123128
score = 0
124129

125130
distance = _get_distance(user_to_update.geohash, user.geohash)
126-
score -= distance
131+
if distance:
132+
score -= distance
127133

128134
user_age = (
129135
today.year

0 commit comments

Comments
 (0)