Fix FR24 cabin-class import mapping + repair script #24
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/fr24-cabin-class-mapping"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The bug
The FR24 importer's
parseFlightClassassumed flightdiary's numeric "Flight class" codes were in rank order (1/2/3/4 = economy/premium/business/first). They are not — flightdiary added Economy Plus later and appended it as code4instead of inserting it. The correct mapping (cross-checked against AirTrail's reverse-engineered importer,FR24_FLIGHT_CLASS_MAP) is:So every non-economy imported flight was mislabelled — including the reported symptom (Economy Plus flights showing as First).
Changes
src/lib/fr24-parser.ts— corrected the mapping + explanatory comment; updatedfr24-parser.test.ts.scripts/fix-fr24-cabin.ts— one-off repair for already-imported rows (bijection → rotate back:premium_economy→business,business→first,first→premium_economy; economy/NULL unchanged). 3-cycle, not idempotent — a marker file blocks a second run. Dry-run by default;--applywrites.package.json—db:fix:fr24-cabinconvenience script..gitignore— ignore the repair marker.How to apply in production
Verification
pnpm typecheck✅ ·pnpm lint✅ ·pnpm test✅--apply.Fix FR24 cabin-class import mapping + repair scriptto Tail callbacks + first-time achievements + persistent SEEN BEFORE (roadmap #1)Tail callbacks + first-time achievements + persistent SEEN BEFORE (roadmap #1)to Fix FR24 cabin-class import mapping + repair script