skip if there are no items for the week at all
This commit is contained in:
parent
7c1a9f6844
commit
f99fae269d
1 changed files with 6 additions and 0 deletions
|
|
@ -24,6 +24,12 @@ def send_week():
|
||||||
week, archive = models.Item.public(now)
|
week, archive = models.Item.public(now)
|
||||||
week_obj = models.Week.objects.filter(monday=monday).first()
|
week_obj = models.Week.objects.filter(monday=monday).first()
|
||||||
notified_key = "week-%s-notified" % monday
|
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 week_obj:
|
||||||
if not cache.get(notified_key):
|
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)
|
message = "no title for week, can not send out email please add: %s/admin/item/week/add/?monday=%s" % (settings.URL, monday)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue