Skip to content

Commit f0da862

Browse files
authored
Merge pull request #2 from seabird-chat/belak/fix-extra-reminder
Tweak the logic to avoid sending a reminder on Dec 25th
2 parents d091612 + 38d1419 commit f0da862

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

adventofcode/handlers.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -118,17 +118,17 @@ async def schedule_reminders(self):
118118
now = datetime.now(tz=AOC_TIMEZONE)
119119
day = 0
120120

121-
if now.month == 12 and now.day >= 24 and now.hour >= 23 and now.minute >= 45:
122-
# We have to special case the end of December because the next
123-
# event is "next year".
124-
next_reminder = now + relativedelta(years=+1, month=11, day=31, hour=23, minute=45, second=0)
125-
day = 1
126-
elif now.month == 12 and now.hour >= 23 and now.minute >= 45:
121+
if now.month == 12 and now.day <= 24 and now.hour >= 23 and now.minute >= 45:
127122
next_reminder = now + relativedelta(days=+1, hour=23, minute=45, second=0)
128123
day = now.day + 2
129-
elif now.month == 12:
124+
elif now.month == 12 and now.day <= 24:
130125
next_reminder = now + relativedelta(hour=23, minute=45, second=0)
131126
day = now.day + 1
127+
elif now.month == 12:
128+
# We have to special case the end of December because the next
129+
# event is "next year".
130+
next_reminder = now + relativedelta(years=+1, month=11, day=31, hour=23, minute=45, second=0)
131+
day = 1
132132
elif now.month == 11 and now.day >= 30 and now.hour >= 23 and now.minute >= 45:
133133
next_reminder = now + relativedelta(days=+1, hour=23, minute=45, second=0)
134134
day = 1

0 commit comments

Comments
 (0)