From 1e0ed169b65b6c23906b9f07919c4432bb2fac43 Mon Sep 17 00:00:00 2001 From: Egor Matveev Date: Tue, 4 Apr 2023 14:40:07 +0000 Subject: [PATCH 1/4] Update notify.py --- daemons/notify.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/daemons/notify.py b/daemons/notify.py index 47b10a9..e9b3b7d 100644 --- a/daemons/notify.py +++ b/daemons/notify.py @@ -91,7 +91,7 @@ def process(): except ApiTelegramException: pass start_of_day = datetime.datetime(year=time_now.year, month=time_now.month, day=time_now.day) - mongo.lessons_collection.update_many({"begin": {"$gte": start_of_day, "$lt": (start_of_day + datetime.timedelta(days=1))}}, {"$set": {"notified_today": True}}) + mongo.lessons_collection.update_many({"begin": {"$gte": start_of_day, "$lt": (start_of_day + datetime.timedelta(days=1))}, "hse_user_id": user["hse_id"]}, {"$set": {"notified_today": True}}) break From e6add581ee8db5796fde11943fbb896aa978ab15 Mon Sep 17 00:00:00 2001 From: Egor Matveev Date: Wed, 5 Apr 2023 11:12:35 +0000 Subject: [PATCH 2/4] Update notify.py --- daemons/notify.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/daemons/notify.py b/daemons/notify.py index e9b3b7d..78c4e79 100644 --- a/daemons/notify.py +++ b/daemons/notify.py @@ -59,7 +59,7 @@ def process(): {"$set": {"next_daily_notify_time": user_model.next_daily_notify_time + datetime.timedelta(days=1)}} ) - for user in mongo.users_collection.find({"first_lesson_notify": {"$ne": None}, "hse_id": {"$ne": None}}): + for user in mongo.users_collection.find({"first_lesson_notify": True, "hse_id": {"$ne": None}}): time_now = now(UserSchema().load(user)) for lesson in mongo.lessons_collection.find({ "hse_user_id": user["hse_id"], From 64f8de54f1799bd7695cda99909cc6c45c0421e9 Mon Sep 17 00:00:00 2001 From: Egor Matveev Date: Wed, 5 Apr 2023 15:58:27 +0000 Subject: [PATCH 3/4] Update notify.py bugfix --- daemons/notify.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/daemons/notify.py b/daemons/notify.py index 78c4e79..8bd4d05 100644 --- a/daemons/notify.py +++ b/daemons/notify.py @@ -59,7 +59,7 @@ def process(): {"$set": {"next_daily_notify_time": user_model.next_daily_notify_time + datetime.timedelta(days=1)}} ) - for user in mongo.users_collection.find({"first_lesson_notify": True, "hse_id": {"$ne": None}}): + for user in mongo.users_collection.find({"first_lesson_notify": {"$exists": True}, "first_lesson_notify": {"$ne": None}, "hse_id": {"$ne": None}}): time_now = now(UserSchema().load(user)) for lesson in mongo.lessons_collection.find({ "hse_user_id": user["hse_id"], From bc68e594774ece132f1e2cdc86dec16b31658110 Mon Sep 17 00:00:00 2001 From: Egor Matveev Date: Thu, 6 Apr 2023 08:07:04 +0000 Subject: [PATCH 4/4] Update notify.py --- daemons/notify.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/daemons/notify.py b/daemons/notify.py index 8bd4d05..f89c234 100644 --- a/daemons/notify.py +++ b/daemons/notify.py @@ -50,7 +50,8 @@ def process(): try: bot.send_message( user["chat_id"], - f"Уведомляю о занятиях! Твое расписание на {'сегодня' if user_model.daily_notify_today else 'завтра'}:\n" + text + f"Уведомляю о занятиях! Твое расписание на {'сегодня' if user_model.daily_notify_today else 'завтра'}:\n" + text, + parse_mode='Markdown' ) except: pass