Skip to content

Commit 30beb4e

Browse files
committed
Added constants
1 parent c500faa commit 30beb4e

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

backend/PyMatcha/utils/tasks.py

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@
1212
from PyMatcha.utils.match_score import _get_distance
1313
from PyMatcha.utils.match_score import _get_gender_query
1414

15+
BASE_HEAT_SCORE = 30
16+
LIKES_MULTIPLIER = 2
17+
SUPERLIKES_MULTIPLIER = 10
18+
MATCHES_MULTIPLIER = 4
19+
REPORTS_MULTIPLIER = 10
20+
VIEW_MULTIPLIER = 1
21+
MESSAGES_DIVIDER = 5
22+
1523

1624
@celery.on_after_configure.connect
1725
def setup_periodic_tasks(sender, **kwargs):
@@ -34,15 +42,15 @@ def update_heat_scores():
3442
except ValueError:
3543
messages = 0
3644

37-
score = 30
45+
score = BASE_HEAT_SCORE
3846
if user.username == "seluj78" or user.username == "tet":
3947
score += 100
40-
score += likes_received * 2
41-
score += superlikes_received * 10
42-
score += matches * 4
43-
score -= reports_received * 10
44-
score += views
45-
score += ceil(messages / 5)
48+
score += likes_received * LIKES_MULTIPLIER
49+
score += superlikes_received * SUPERLIKES_MULTIPLIER
50+
score += matches * MATCHES_MULTIPLIER
51+
score -= reports_received * REPORTS_MULTIPLIER
52+
score += views * VIEW_MULTIPLIER
53+
score += ceil(messages / MESSAGES_DIVIDER)
4654
user.heat_score = score
4755
user.save()
4856
return f"Updated heat score for user {user.id}: {user.heat_score}."

0 commit comments

Comments
 (0)