From 7edecd7d1cd3f1e546a52bed737967167a6101f3 Mon Sep 17 00:00:00 2001 From: pierre geeraert Date: Tue, 30 Jun 2026 19:53:40 +0100 Subject: [PATCH] exit if the list is empty --- django_code/apps/telegram_communication/utils.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/django_code/apps/telegram_communication/utils.py b/django_code/apps/telegram_communication/utils.py index 787a875..a9c9843 100644 --- a/django_code/apps/telegram_communication/utils.py +++ b/django_code/apps/telegram_communication/utils.py @@ -72,6 +72,10 @@ class telegramUtils(): expired_messages_list = [] expired_messages = TelegramData.objects.filter(expiration_date__lte=yesterday) + #leave if the list is empty + if expired_messages.len == 0: + return 1 + #create a list with only the message_id for expired_message in expired_messages: expired_messages_list.append(expired_message.message_id)