Files
aperonight/config/initializers/event_reminder_scheduler.rb
kbe ce0752bbda feat: Complete email notifications system with comprehensive functionality
- Implement comprehensive email notification system for ticket purchases and event reminders
- Add event reminder job with configurable scheduling
- Enhance ticket mailer with QR code generation and proper formatting
- Update order model with email delivery tracking
- Add comprehensive test coverage for all email functionality
- Configure proper mailer settings and disable annotations
- Update backlog to reflect completed email features

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-06 20:21:01 +02:00

22 lines
817 B
Ruby

# Schedule event reminder notifications
Rails.application.config.after_initialize do
# Only schedule in production or when SCHEDULE_REMINDERS is set
if Rails.env.production? || ENV["SCHEDULE_REMINDERS"] == "true"
# Schedule the reminder scheduler to run daily at 9 AM
begin
# Use a simple cron-like approach with ActiveJob
# This will be handled by solid_queue in production
EventReminderSchedulerJob.set(wait_until: next_run_time).perform_later
rescue StandardError => e
Rails.logger.warn "Could not schedule event reminders: #{e.message}"
end
end
end
def next_run_time
# Schedule for 9 AM today, or 9 AM tomorrow if it's already past 9 AM
target_time = Time.current.beginning_of_day + 9.hours
target_time += 1.day if Time.current > target_time
target_time
end