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
@@ -31,8 +31,8 @@ class OilAnalysesController < ApplicationController
|
||||
end
|
||||
end
|
||||
|
||||
# Create records from a lab report PDF. AvLab reports include the two previous
|
||||
# samples too, so samples already on file are skipped rather than duplicated.
|
||||
# Create records from a lab report PDF (AvLab or Blackstone). Reports repeat
|
||||
# earlier samples, so samples already on file are skipped rather than duplicated.
|
||||
def import
|
||||
file = params[:report]
|
||||
return redirect_to(new_aircraft_oil_analysis_path(@aircraft), alert: "Choose a lab report PDF.") if file.blank?
|
||||
@@ -50,7 +50,7 @@ class OilAnalysesController < ApplicationController
|
||||
OilAnalysis.transaction do
|
||||
report.samples.each do |sample|
|
||||
record = existing_sample(sample) ||
|
||||
@aircraft.oil_analyses.create!(sample.except(:current).merge(lab: report.lab, component: engine)).tap { created << _1 }
|
||||
@aircraft.oil_analyses.create!(sample.except(:current).merge(lab: report.lab, oil_type: report.oil_type, component: engine)).tap { created << _1 }
|
||||
current_record = record if sample[:current]
|
||||
end
|
||||
end
|
||||
@@ -108,9 +108,10 @@ class OilAnalysesController < ApplicationController
|
||||
|
||||
def analysis_params
|
||||
params.require(:oil_analysis).permit(
|
||||
:component_id, :sample_date, :analysis_date, :lab, :sample_number, :engine_hours, :oil_hours,
|
||||
:filter_hours, :oil_added, :status, :lab_comments, :notes, :report,
|
||||
*OilAnalysis::ELEMENTS.keys.flat_map { [ _1, :"#{_1}_avg" ] }
|
||||
:component_id, :sample_date, :analysis_date, :lab, :sample_number, :oil_type, :engine_hours, :oil_hours,
|
||||
:filter_hours, :oil_added, :status, :lab_comments, :notes, :report, :excluded_from_averages,
|
||||
elements: OilAnalysis::ELEMENTS.keys, element_averages: OilAnalysis::ELEMENTS.keys,
|
||||
oil_properties: OilAnalysis::PROPERTIES.keys
|
||||
).tap { |p| p[:component_id] = scoped_id(@aircraft.components, p[:component_id]) if p.key?(:component_id) }
|
||||
end
|
||||
end
|
||||
Reference in new issue
Block a user