CG envelope can be entered as moment (lb-in/1000)

As POH moment-envelope charts and Garmin Pilot give it. Stored as CG
inches (moment x 1000 / weight), shown back as entered with the CG next
to each point; switching the units and saving re-reads the numbers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rickyandClaude Opus 5.5 committed 2026-11-07 14:42:44 -05:00
1 parent 7694719582
commit c822bda779
5 files changed
+55 -11

No files matched your search

+2 -2
View File
@@ -9,10 +9,10 @@ class LoadingSetupsController < ApplicationController
end
def update
permitted = params.fetch(:setup, {}).permit(:fuel_lb_per_gal, stations: %i[name arm max fuel], envelope: %i[weight cg])
permitted = params.fetch(:setup, {}).permit(:fuel_lb_per_gal, :envelope_unit, stations: %i[name arm max fuel], envelope: %i[weight cg])
@setup = LoadingSetup.from_params(permitted.to_h)
if @setup.valid?
@aircraft.update!(loading_stations: @setup.stations_json, cg_envelope: @setup.envelope)
@aircraft.update!(loading_stations: @setup.stations_json, cg_envelope: @setup.envelope.map { |w, cg| [ w.to_f, cg.to_f ] })
log_event("aircraft", "Loading stations and CG envelope updated")
redirect_to aircraft_weight_balance_records_path(@aircraft), notice: "Loading setup saved."
else