fix(booking-import): every leg of a connecting flight keeps its own seat

The grouped flight wrote a seat only on the booking itself, from the first
segment. Each leg in metadata.legs now carries the seat of its own segment,
which the planner and the PDF already show per leg.
This commit is contained in:
Maurice
2026-11-06 23:50:53 +01:00
parent 7ae9198a43
commit 25f2cd8192
2 changed files with 29 additions and 0 deletions
@@ -304,11 +304,13 @@ function mapFlightGroup(legs: KiReservation[], source: ParsedBookingItem['source
const arrEp = makeEndpoint(f.arrivalAirport, isLast ? 'to' : 'stop', onward.time, onward.date);
if (arrEp) endpoints.push(arrEp);
const airline = f.airline?.name ?? f.airline?.iataCode ?? '';
const { seat } = segmentDetail(legs[i]);
metaLegs.push({
from: iataOf(f.departureAirport),
to: iataOf(f.arrivalAirport),
...(airline ? { airline } : {}),
...(f.flightNumber ? { flight_number: f.flightNumber } : {}),
...(seat != null ? { seat } : {}),
dep_time: splitIso(f.departureTime).time,
arr_time: arr.time,
});