mirror of
https://github.com/rickbarrette/simple-aircraft-manager-rails.git
synced 2026-11-17 15:50:36 -05:00
Blackstone oil analysis, .sam.zip export/import, AI logbook transcription
- 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>
This commit is contained in:
1 parent
2d068e1a63
commit
1c6c2f88c0
54 files changed
+2794
-286
No files matched your search
@@ -1,9 +1,18 @@
|
||||
module OilAnalysesHelper
|
||||
STATUS_BADGES = { "normal" => "badge-green", "elevated" => "badge-orange", "high" => "badge-red" }.freeze
|
||||
STATUS_BADGES = { "normal" => "badge-green", "monitor" => "badge-orange", "action_required" => "badge-red" }.freeze
|
||||
TREND_COLORS = %w[#0ea5e9 #f97316 #22c55e #a855f7 #eab308 #ec4899 #64748b].freeze
|
||||
|
||||
# The lab's verdict; Blackstone reports don't rate samples, so there may be none.
|
||||
def oil_status_badge(analysis)
|
||||
tag.span OilAnalysis::STATUSES[analysis.status], class: STATUS_BADGES[analysis.status]
|
||||
return tag.span("Not rated", class: "badge-gray") unless analysis.status
|
||||
tag.span analysis.status_label, class: STATUS_BADGES[analysis.status]
|
||||
end
|
||||
|
||||
def oil_property(analysis, key)
|
||||
value = analysis.property(key) or return "—"
|
||||
_, unit = OilAnalysis::PROPERTIES.fetch(key)
|
||||
number = number_with_precision(value, precision: 2, strip_insignificant_zeros: true)
|
||||
unit.present? ? "#{number} #{unit}" : number
|
||||
end
|
||||
|
||||
def ppm(value)
|
||||
@@ -28,8 +37,9 @@ module OilAnalysesHelper
|
||||
"#{sign}#{ppm(delta)}"
|
||||
end
|
||||
|
||||
# Samples marked "exclude from averages" (e.g. right after an overhaul) are left out.
|
||||
def oil_trend_series(analyses)
|
||||
chronological = analyses.sort_by(&:sample_date)
|
||||
chronological = analyses.reject(&:excluded_from_averages?).sort_by(&:sample_date)
|
||||
OilAnalysis::TREND_ELEMENTS.filter_map do |el|
|
||||
data = chronological.filter_map { |a| [ a.sample_date, a.value(el).to_f ] if a.value(el) }
|
||||
{ name: OilAnalysis.element_label(el), data: data } if data.size >= 2
|
||||
|
||||
Reference in new issue
Block a user