Enrich existing flights with aircraft types

The user re-imported the CSV expecting the new enrichment-during-import
to kick in, but every row dedupe-matched their existing log so nothing
got updated. Adds a dedicated "look up missing types" flow for
already-saved flights.

- EnrichAircraftTypesView: scans every LoggedFlight where
  aircraftType == nil and carrierIATA + flightNumber are present,
  walks them sequentially through routeExplorer.searchSchedule for
  that carrier/flight/date window, patches in equipmentIata when the
  schedule has a match. Live progress (N / total), found count,
  Stop to cancel. Saves once at the end so SwiftData batches the
  writes.
- AircraftStatsView now takes a RouteExplorerClient and:
  - Surfaces a "Look up missing types" CTA button in the empty
    state (the most useful place to discover this).
  - Adds a wand.and.stars toolbar button so the flow is reachable
    even when stats are already populated (for top-ups after
    new imports).
- HistoryView passes the existing routeExplorer through to
  AircraftStatsView.

Net behavior: user opens Aircraft Stats → sees empty state → taps
"Look up missing types" → modal scans the log, queries
route-explorer per flight, fills in types, hits Done. Stats screen
populates without needing a re-import.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Trey T
2026-05-29 18:48:59 -05:00
parent 2e5cf6b9b3
commit e5333ff965
4 changed files with 211 additions and 18 deletions
+4
View File
@@ -85,6 +85,7 @@
HX1700001700000017000001 /* PassportComponents.swift in Sources */ = {isa = PBXBuildFile; fileRef = HX1700001700000017000002 /* PassportComponents.swift */; };
HX1800001800000018000001 /* PassportView.swift in Sources */ = {isa = PBXBuildFile; fileRef = HX1800001800000018000002 /* PassportView.swift */; };
HX1900001900000019000001 /* AircraftStatsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = HX1900001900000019000002 /* AircraftStatsView.swift */; };
HX2000002000000020000001 /* EnrichAircraftTypesView.swift in Sources */ = {isa = PBXBuildFile; fileRef = HX2000002000000020000002 /* EnrichAircraftTypesView.swift */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@@ -179,6 +180,7 @@
HX1700001700000017000002 /* PassportComponents.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PassportComponents.swift; sourceTree = "<group>"; };
HX1800001800000018000002 /* PassportView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PassportView.swift; sourceTree = "<group>"; };
HX1900001900000019000002 /* AircraftStatsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AircraftStatsView.swift; sourceTree = "<group>"; };
HX2000002000000020000002 /* EnrichAircraftTypesView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EnrichAircraftTypesView.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -231,6 +233,7 @@
HX1700001700000017000002 /* PassportComponents.swift */,
HX1800001800000018000002 /* PassportView.swift */,
HX1900001900000019000002 /* AircraftStatsView.swift */,
HX2000002000000020000002 /* EnrichAircraftTypesView.swift */,
AA5555555555555555555555 /* Styles */,
AA6666666666666666666666 /* Components */,
);
@@ -523,6 +526,7 @@
HX1700001700000017000001 /* PassportComponents.swift in Sources */,
HX1800001800000018000001 /* PassportView.swift in Sources */,
HX1900001900000019000001 /* AircraftStatsView.swift in Sources */,
HX2000002000000020000001 /* EnrichAircraftTypesView.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};