mirror of
https://github.com/rickbarrette/simple-aircraft-manager-rails.git
synced 2026-11-17 15:50:36 -05:00
New Oil Analysis tab: one record per oil sample with dates, hours, the lab's verdict and comments, ppm results for 12 wear metals with the lab's averages, and the report PDF. Shows wear-metal trends, a side-by-side history table, and flags readings 1.5x or more above the lab average. AvLab report PDFs can be imported: every sample on the report (current and previous) is added unless already recorded, the engine is matched by serial number, and reports for another tail number are refused. The parser reads positioned text and drops the hidden color-code layer that overlaps results. Adds the pdf-reader gem. Test fixture is a rebuilt report with a dummy header. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
16 lines
643 B
Ruby
16 lines
643 B
Ruby
class AircraftEvent < ApplicationRecord
|
|
CATEGORIES = {
|
|
"hours" => "Hours Update", "flight" => "Flight", "component" => "Component",
|
|
"squawk" => "Squawk", "note" => "Note", "oil" => "Oil", "fuel" => "Fuel",
|
|
"logbook" => "Logbook", "ad" => "Airworthiness Directive", "inspection" => "Inspection",
|
|
"document" => "Document", "aircraft" => "Aircraft", "role" => "Role",
|
|
"major_record" => "Major Repair/Alteration", "oil_analysis" => "Oil Analysis"
|
|
}.freeze
|
|
|
|
belongs_to :aircraft
|
|
belongs_to :user, optional: true
|
|
|
|
validates :category, inclusion: { in: CATEGORIES.keys }
|
|
default_scope { order(created_at: :desc) }
|
|
end
|