mirror of
https://github.com/rickbarrette/simple-aircraft-manager-rails.git
synced 2026-11-17 15:50:36 -05:00
- Oil analysis: Blackstone PDF import (20 elements, oil properties, universal averages), results stored per element, oil type, "leave out of trends", the original app's statuses; AvLab fixes (multi-line comments, unrelated labels no longer steal values). Existing records migrate. - Aircraft archives in the original app's .sam.zip format (schema v2): export from Access & Sharing, background import from the Fleet page, rake tasks. Archives move both ways between this app and the original. - Scanned logbook pages (images or PDFs) upload as a document; with ANTHROPIC_API_KEY set, Claude transcribes them into logbook entries. - Fix: deleting a component or aircraft failed when AD compliances or inspection records pointed at a component. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
20 lines
739 B
Ruby
20 lines
739 B
Ruby
# One upload of an aircraft archive (.sam.zip), imported by AircraftImportJob.
|
|
class AircraftImport < ApplicationRecord
|
|
belongs_to :user, optional: true
|
|
belongs_to :aircraft, optional: true
|
|
has_one_attached :archive # staged upload; purged once imported
|
|
|
|
STATUSES = %w[queued running done failed].freeze
|
|
|
|
validates :status, inclusion: { in: STATUSES }
|
|
|
|
def in_progress? = status.in?(%w[queued running])
|
|
def done? = status == "done"
|
|
def failed? = status == "failed"
|
|
|
|
# "12 components, 140 logbook entries, …" for whatever was imported.
|
|
def summary
|
|
counts.select { |_, n| n.to_i.positive? }.map { |key, n| "#{n} #{key.to_s.humanize(capitalize: false).then { n == 1 ? _1.singularize : _1 }}" }.to_sentence
|
|
end
|
|
end
|