Overview shows coming due and the last flight; intervals in days, months or years

- Overview: "Coming due" (next 30 days or 10 hours) and "Last flight" (the
  most recent day's legs, meters at the end, fuel and oil left).
- Component replace / TBO / inspect intervals, inspection types and ADs take
  a number and a days / months / years choice (CalendarInterval). Components
  gain month columns (years stored as 12 months; months land on the same
  date); inspection types and ADs keep end-of-month. ADs now honour days.
- Due list: hours already run out count as overdue; a component covered by
  an inspection type no longer gets its own "Inspect every" item.
- Loading calculator moved to a partial; no limit warnings until a load is
  entered. Header buttons don't wrap on phones.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rickyandClaude Opus 5.5 committed 2026-11-11 21:40:14 -05:00
1 parent 215efe6814
commit 31ac991bab
37 files changed
+385 -75

No files matched your search

+5 -2
View File
@@ -6,6 +6,9 @@ class AirworthinessDirective < ApplicationRecord
}.freeze
BULLETIN_LABELS = { "ad" => "AD", "saib" => "SAIB", "sb" => "SB", "alert" => "Alert", "other" => "Bulletin" }.freeze
include CalendarInterval
calendar_interval :recurring, days: :recurring_days, months: :recurring_months, blank: 0
belongs_to :document, optional: true
include SharedRecordHistory # has_and_belongs_to_many :aircraft and :components, with history
has_many :ad_compliances, dependent: :destroy
@@ -45,9 +48,9 @@ class AirworthinessDirective < ApplicationRecord
def conditional? = compliance_type == "conditional"
def bulletin_label = BULLETIN_LABELS[bulletin_type]
# Recurrence rule for next-due math (AD status uses hours and months).
# Recurrence rule for next-due math.
def due_rule
{ hours: recurring_hours.to_f, months: recurring_months, days: 0 } if recurring?
{ hours: recurring_hours.to_f, months: recurring_months, days: recurring_days } if recurring?
end
def latest_compliance_for(aircraft)