Files
simple-aircraft-manager-rails/app/jobs/weekly_reminder_job.rb
T
rickyandClaude Opus 5.5 aa262065b2 Certificates on user profiles, with "Sign as"
- 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>
2026-11-07 11:08:21 -05:00

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