Logbook entries link a component and its times; boxed page printouts

- An entry can link a component (engine, propeller…) and records its total
  time and time since overhaul at the entry; picking the engine or prop log
  selects that component and fills its current times (editable). Squawk
  fixes carry the squawk's component
- Components have an overhaul type (major, factory overhaul, factory new),
  shown as SMOH / SFOH / SNEW
- Printouts: engine and propeller entries add the serial number, total
  time and SMOH/SFOH (blanks when no component is linked); airframe total
  time is labelled as such; full-page layouts draw a box around each entry
- Archives carry the entry's component and times (the original format's
  components / component_hours), no longer dropped on import

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rickyandClaude Opus 5.5 committed 2026-11-07 11:19:44 -05:00
1 parent aa262065b2
commit a51f78ebf3
21 files changed
+265 -83

No files matched your search

+3
View File
@@ -21,6 +21,8 @@ class LogbookEntry < ApplicationRecord
belongs_to :aircraft
belongs_to :document, optional: true
# For engine / propeller logs: which one, and its times at this entry.
belongs_to :component, optional: true
has_many :inspection_records, dependent: :nullify
has_many :ad_compliances, dependent: :nullify
has_many :squawks, dependent: :nullify
@@ -30,6 +32,7 @@ class LogbookEntry < ApplicationRecord
validates :entry_type, inclusion: { in: ENTRY_TYPES.keys }
validates :signoff_certificate_type, inclusion: { in: CERTIFICATE_TYPES.keys }, allow_blank: true
validates :inspection_result, inclusion: { in: INSPECTION_RESULTS.keys }, allow_blank: true
validates :component_hours_at_entry, :component_since_overhaul_at_entry, numericality: { greater_than_or_equal_to: 0 }, allow_nil: true
normalizes :signoff_certificate_type, :inspection_result, :signoff_certificate_number, with: ->(v) { v.strip.presence }
scope :recent_first, -> { order(date: :desc, created_at: :desc) }