mirror of
https://github.com/rickbarrette/simple-aircraft-manager-rails.git
synced 2026-11-17 23:50:36 -05:00
- Squawks: defer an inoperative item under 91.213(d) once each condition is confirmed (pilots may too); deferred items stop grounding and are listed for awareness. Resolving can record the fix as a logbook entry (43.9 fields) or link an existing one - Expiration dates on components (ELT battery, 91.207(c)) and documents; new document types (registration, airworthiness certificate, insurance, radio license). Expired replacement-critical parts and an expired registration (91.203) ground; others warn; registration warns 90 days out - Standard inspections: one click adds annual, 100-hour, 91.411, 91.413, ELT (91.207(d)) and VOR (91.171) checks with the right rules, skipping ones already tracked and linking annual to 100-hour - Weekly Monday reminder email to owners when something needs attention; profile opt-out; admin "send me this week's reminder" - README feature table updated Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
40 lines
1.5 KiB
Ruby
40 lines
1.5 KiB
Ruby
# The aircraft's maintenance status as 14 CFR 91.417(a)(2) lists it:
|
|
# total time in service (airframe, engines, propellers), life-limited parts,
|
|
# time since overhaul, inspection status, AD status and major alterations.
|
|
class MaintenanceReport
|
|
attr_reader :aircraft, :generated_at
|
|
|
|
def initialize(aircraft)
|
|
@aircraft = aircraft
|
|
@generated_at = Time.current
|
|
end
|
|
|
|
def time_in_service = aircraft.current_hours
|
|
|
|
# Engines and propellers, by component type name.
|
|
def engines = major_components(/engine/i)
|
|
def propellers = major_components(/propell?er|\bprop\b/i)
|
|
|
|
# Parts with a mandatory replacement time (life limits).
|
|
def life_limited
|
|
in_use.select { |c| (c.replacement_critical? && (c.replacement_hours || c.replacement_days)) || c.expires_on }
|
|
end
|
|
|
|
# Items overhauled on a time basis.
|
|
def overhaul_items
|
|
in_use.select { |c| c.tbo_hours || c.tbo_days }
|
|
end
|
|
|
|
def inspections = @inspections ||= Compliance.inspection_rows(aircraft)
|
|
def ads = @ads ||= Compliance.ad_rows(aircraft)
|
|
def major_records = aircraft.major_records.recent_first.includes(:component, :form_337_document, :stc_document)
|
|
def open_squawks = aircraft.squawks.active.by_priority.includes(:component)
|
|
def airworthiness = aircraft.airworthiness
|
|
|
|
private
|
|
|
|
def in_use = @in_use ||= aircraft.components.in_use.includes(:component_type).order(:install_location).to_a
|
|
|
|
def major_components(pattern) = in_use.select { |c| c.component_type&.name.to_s.match?(pattern) }
|
|
end
|