diff --git a/daemons/notify.py b/daemons/notify.py index 124e6bc..e4a80d0 100644 --- a/daemons/notify.py +++ b/daemons/notify.py @@ -33,12 +33,7 @@ def process(): time_now = now() for user in mongo.users_collection.find({"next_daily_notify_time": {"$lte": time_now}}): user_model = UserSchema().load(user) - 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: + if time_now.weekday() != 6: lessons = mongo.get_today_lessons(user_model) if len(lessons) == 0: text = "Сегодня у тебя нет пар." @@ -51,6 +46,10 @@ def process(): ) except: 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():