Fix daily email timing to work across all timezones

Critical fix: Task now runs every hour instead of once at 6 AM UTC.
This ensures users in all timezones receive their email at 6 AM local time.

Changes:
- Run task every hour instead of once daily
- Check if it's 6-7 AM in user's timezone (1 hour window)
- Track sent emails in Notification model to prevent duplicates
- Add 'daily_email' notification type

Without this fix, users in timezones where 6 AM UTC is not morning
would never receive their daily email.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Keith Smith
2026-01-09 09:34:39 -07:00
co-authored by Claude Sonnet 4.5
parent 03cfdea42d
commit aca8abca56
3 changed files with 25 additions and 3 deletions
+1 -1
View File
@@ -24,7 +24,7 @@ app.autodiscover_tasks()
app.conf.beat_schedule = {
'send-daily-task-email': {
'task': 'notifications.tasks.send_daily_task_email',
'schedule': crontab(hour=6, minute=0), # Daily at 6 AM UTC
'schedule': crontab(minute=0), # Every hour on the hour
},
'process-recurring-tasks': {
'task': 'notifications.tasks.process_recurring_tasks',