mirror of
https://github.com/rickbarrette/simple-aircraft-manager-rails.git
synced 2026-11-17 23:50:36 -05:00
- Users add their FAA certificates (kind, number, optional expiry) on their profile; admins see them on the Users list - "Sign as" on new/edited logbook entries and the squawk Resolve page fills the signer's name, kind of certificate and number (expired certificates aren't offered); deferrals default to mechanic for users with a mechanic certificate - Weekly reminder lists certificates expiring within 60 days (or lapsed in the last 30), even when nothing else is due - Preventive maintenance templates keep a certificate already chosen Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
17 lines
671 B
Ruby
17 lines
671 B
Ruby
# Weekly email to aircraft owners listing what's overdue or coming due
|
|
# (inspections, ADs, components, expiring documents), deferred items, new
|
|
# ADs, and the user's own certificates that are about to expire.
|
|
# Nothing is sent when nothing needs attention, or when email isn't set up.
|
|
class WeeklyReminderJob < ApplicationJob
|
|
queue_as :default
|
|
|
|
def perform
|
|
return unless MailSettings.configured?
|
|
User.where(reminder_emails: true).find_each do |user|
|
|
ReminderMailer.weekly(user).deliver_now if ReminderMailer.anything_for?(user)
|
|
rescue StandardError => e
|
|
Rails.logger.warn("[reminders] #{user.id}: #{e.class}: #{e.message}")
|
|
end
|
|
end
|
|
end
|