Skip to content

Commit 10c1067

Browse files
committed
Renamed skip_recommendations to is_bot
Closes #392
1 parent 0ceacb6 commit 10c1067

File tree

4 files changed

+18
-18
lines changed

4 files changed

+18
-18
lines changed

backend/PyMatcha/models/user.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class User(Model):
6666
is_confirmed = Field(bool)
6767
confirmed_on = Field(datetime.datetime, fmt="%Y-%m-%d %H:%M:%S")
6868
previous_reset_token = Field(str)
69-
skip_recommendations = Field(bool)
69+
is_bot = Field(bool)
7070
superlikes_counter = Field(int)
7171
superlikes_reset_dt = Field(datetime.datetime, fmt="%Y-%m-%d %H:%M:%S")
7272

@@ -89,7 +89,7 @@ def create(
8989
is_profile_completed: bool = False,
9090
is_confirmed: bool = False,
9191
confirmed_on: datetime.datetime = None,
92-
skip_recommendations: bool = False,
92+
is_bot: bool = False,
9393
superlikes_counter: int = 5,
9494
superlikes_reset_dt: Optional[datetime.datetime] = None,
9595
) -> User:
@@ -151,7 +151,7 @@ def create(
151151
is_confirmed=is_confirmed,
152152
confirmed_on=confirmed_on,
153153
previous_reset_token=None,
154-
skip_recommendations=skip_recommendations,
154+
is_bot=is_bot,
155155
superlikes_counter=superlikes_counter,
156156
superlikes_reset_dt=superlikes_reset_dt,
157157
)
@@ -193,7 +193,7 @@ def register(email: str, username: str, password: str, first_name: str, last_nam
193193
is_confirmed=False,
194194
confirmed_on=None,
195195
previous_reset_token=None,
196-
skip_recommendations=False,
196+
is_bot=False,
197197
superlikes_counter=5,
198198
superlikes_reset_dt=None,
199199
)

backend/PyMatcha/utils/tables.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def _create_user_table(db):
4949
is_profile_completed BOOLEAN DEFAULT (FALSE),
5050
is_confirmed BOOLEAN DEFAULT (FALSE),
5151
confirmed_on DATETIME DEFAULT NULL,
52-
skip_recommendations BOOLEAN DEFAULT (FALSE),
52+
is_bot BOOLEAN DEFAULT (FALSE),
5353
superlikes_counter INT DEFAULT 5,
5454
superlikes_reset_dt DATETIME DEFAULT NULL
5555
) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci ;

backend/PyMatcha/utils/tasks.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def take_users_offline():
8989
@celery.task
9090
def update_user_recommendations():
9191
count = 0
92-
for user_to_update in User.get_multis(skip_recommendations=False):
92+
for user_to_update in User.get_multis(is_bot=False):
9393
create_user_recommendations(user_to_update)
9494
count += 1
9595
return f"Successfully updated recommendations for {count} users."
@@ -137,7 +137,7 @@ def calc_search_min_max():
137137
@celery.task
138138
def take_random_users_online():
139139
for user in User.select_random(250):
140-
if not user.skip_recommendations:
140+
if not user.is_bot:
141141
# User isn't a bot, so skip him
142142
continue
143143
user.is_online = True
@@ -149,7 +149,7 @@ def take_random_users_online():
149149
@celery.task
150150
def random_bot_action():
151151
for user in User.select_random(200):
152-
if not user.is_online and not user.skip_recommendations:
152+
if not user.is_online and not user.is_bot:
153153
continue
154154
else:
155155
decide_bot_action(user)

mysql_dump/users-dump.sql

Lines changed: 10 additions & 10 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)