notify update
This commit is contained in:
parent
f58a2b5236
commit
930de2d2aa
@ -33,12 +33,7 @@ def process():
|
|||||||
time_now = now()
|
time_now = now()
|
||||||
for user in mongo.users_collection.find({"next_daily_notify_time": {"$lte": time_now}}):
|
for user in mongo.users_collection.find({"next_daily_notify_time": {"$lte": time_now}}):
|
||||||
user_model = UserSchema().load(user)
|
user_model = UserSchema().load(user)
|
||||||
if time_now.weekday() == 6:
|
if time_now.weekday() != 6:
|
||||||
mongo.users_collection.update_one(
|
|
||||||
{"chat_id": user["chat_id"]},
|
|
||||||
{"$set": {"next_daily_notify_time": get_next_daily_notify_time(user_model, time_now)}}
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
lessons = mongo.get_today_lessons(user_model)
|
lessons = mongo.get_today_lessons(user_model)
|
||||||
if len(lessons) == 0:
|
if len(lessons) == 0:
|
||||||
text = "Сегодня у тебя нет пар."
|
text = "Сегодня у тебя нет пар."
|
||||||
@ -51,6 +46,10 @@ def process():
|
|||||||
)
|
)
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
mongo.users_collection.update_one(
|
||||||
|
{"chat_id": user["chat_id"]},
|
||||||
|
{"$set": {"next_daily_notify_time": get_next_daily_notify_time(user_model, time_now)}}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def notify():
|
def notify():
|
||||||
|
Loading…
Reference in New Issue
Block a user