From f99fae269d226a810fe6c8b28c84cec9120d8991 Mon Sep 17 00:00:00 2001 From: j Date: Sun, 18 May 2025 14:58:22 +0100 Subject: [PATCH] skip if there are no items for the week at all --- app/listmonk/tasks.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/listmonk/tasks.py b/app/listmonk/tasks.py index c3d279a..0ac5d78 100644 --- a/app/listmonk/tasks.py +++ b/app/listmonk/tasks.py @@ -24,6 +24,12 @@ def send_week(): week, archive = models.Item.public(now) week_obj = models.Week.objects.filter(monday=monday).first() notified_key = "week-%s-notified" % monday + monday_dt = timezone.make_aware( + timezone.datetime.strptime(monday, '%Y-%m-%d'), + timezone.get_default_timezone() + ) + if not week.filter(announced__gt=monday_dt).count(): + return if not week_obj: if not cache.get(notified_key): message = "no title for week, can not send out email please add: %s/admin/item/week/add/?monday=%s" % (settings.URL, monday)