From 97a74fb2cf47d2548edfbbd3d9bb185d88156c94 Mon Sep 17 00:00:00 2001 From: pierregeeraert Date: Thu, 2 Jul 2026 09:42:29 +0100 Subject: [PATCH] target messages older than today not older than tomorrow --- django_code/apps/telegram_communication/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/django_code/apps/telegram_communication/utils.py b/django_code/apps/telegram_communication/utils.py index ac99729..8fbeb07 100644 --- a/django_code/apps/telegram_communication/utils.py +++ b/django_code/apps/telegram_communication/utils.py @@ -67,10 +67,10 @@ class telegramUtils(): return send_result def clear_expired_messages(self): - yesterday=datetime.now()+timedelta(days=-1) + today = datetime.now() #filter all the messages that expired yesterday or before expired_messages_list = [] - expired_messages = TelegramData.objects.filter(expiration_date__lte=yesterday) + expired_messages = TelegramData.objects.filter(expiration_date__lte=today) #leave if the list is empty if len(expired_messages) == 0: