Add flying stats to the Flights tab; drop the DRS search link setting

Flights tab:
- Summary cards for the past 30 days, this year, past 12 months and
  since the first flight (flight hours, flights, tach, fuel).
- Flight hours by month (last 24 months) with the past-year monthly
  average, totals (flights, flight/tach time, average and longest
  flight, fuel, gal/hr, airports visited, most visited) and a by-year
  table.
- Flight time is Hobbs time where recorded, otherwise tach time.

Removed the per-aircraft DRS search link and its "Open in DRS" button:
each AD's DRS link already comes from the Excel import. A guarded
migration drops the column.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rickyandClaude Opus 5.5 committed 2026-11-05 18:52:00 -05:00
1 parent b75fd7cf62
commit 0c4803d717
15 files changed
+221 -23

No files matched your search

-12
View File
@@ -45,18 +45,6 @@ class AdImportFlowTest < ActionDispatch::IntegrationTest
assert_equal "GREEN", @aircraft.reload.airworthiness.status
end
test "saved DRS search link shows an Open in DRS button; only drs.faa.gov links allowed" do
sign_in @owner
url = "https://drs.faa.gov/browse/ADFRAWD/doctypeDetails?Status=Current&Make=Cessna%20Aircraft%20Company&Model=150L#:~:text=Save-,Results"
patch aircraft_path(@aircraft), params: { aircraft: { drs_search_url: url } }
assert_equal url.sub(/#.*/, ""), @aircraft.reload.drs_search_url
get aircraft_airworthiness_directives_path(@aircraft)
assert_select "a[href='#{@aircraft.drs_search_url}']", text: "Open in DRS ↗"
patch aircraft_path(@aircraft), params: { aircraft: { drs_search_url: "https://evil.example/drs.faa.gov" } }
assert_response :unprocessable_entity
end
test "pilots cannot import ADs" do
sign_in @pilot
post aircraft_ad_import_path(@aircraft), params: { file: fixture_file_upload("drs_ads.csv", "text/csv") }
+6
View File
@@ -82,6 +82,12 @@ class PagesTest < ActionDispatch::IntegrationTest
assert_select "a[href='https://drs.faa.gov/browse/excelExternalWindow/ABC.0001']", minimum: 2 # status + history
end
test "flights tab shows flying stats" do
get aircraft_flight_logs_path(@a)
assert_select "h2", text: "Flight hours by month"
assert_select "dt", text: "Airports visited"
end
test "maintenance share link renders without login and shows history" do
delete session_path
get shared_path(@token.token)