mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-23 05:21:15 +00:00
fix(planner): show each leg's own seat on a flight with a stop
A flight with a stop saves a seat per leg, but every view read the booking's flat seat, which mirrors the first leg's. A seat booked only on the second leg showed nowhere, and one on the first leg showed on both. #2701 had fixed this for trains only. - getFlightLegs reads each leg's seat. The first leg falls back to the flat seat, as the booking form does, so older bookings keep theirs. - bookingSeats lists the seat of every leg that has one with its route. The detail views (the phone's transport sheet, the booking detail) show each leg's seat under its route ("Seat IST → JFK"), and a leg opened from its row shows its own. The cards and field grids (bookings list, the phone's Bookings and Transports tabs, the day plan's transport detail) hold every seat in one Seat cell, so a card cutting its grid short no longer drops the second leg's. - The day plan's flight leg rows carry their seat, and the PDF prints a flight's seat, direct or per leg. - The watch and the Wallet pass name every leg's seat of the booking. - A legs-only MCP update sets the flat seat, airline and flight number (train number and platform) again from the new first leg, so a seat taken off the first leg does not live on in the flat seat. A flat value the stored first leg never had stays. Closes #3158
This commit is contained in:
@@ -168,6 +168,20 @@ describe('watchBooking', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('carries the seat of every leg of a flight with a stop, also one booked only on the second', () => {
|
||||
const stopover = reservation({
|
||||
...flight,
|
||||
metadata: JSON.stringify({
|
||||
legs: [
|
||||
{ from: 'MXP', to: 'IST' },
|
||||
{ from: 'IST', to: 'JFK', seat: '14C' },
|
||||
],
|
||||
}),
|
||||
});
|
||||
const b = watchBooking(stopover, { day: '2026-11-17', time: '13:05' }, { dayDates: new Map(), places: new Map() });
|
||||
expect(b.seat).toBe('14C');
|
||||
});
|
||||
|
||||
it('gives a stay its check-in, check-out, dates from its days and the hotel as the place to go', () => {
|
||||
const dayDates = new Map([
|
||||
[2, '2026-11-18'],
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { Day, PackingItem, Place, Reservation, TodoItem, Trip } from '../types';
|
||||
import { parseReservationMetadata } from '../utils/flightLegs';
|
||||
import { bookingSeats, parseReservationMetadata } from '../utils/flightLegs';
|
||||
import { splitReservationDateTime } from '../utils/formatters';
|
||||
import { hasNativeFeature } from './capabilities';
|
||||
import { isNativeIos } from './platform';
|
||||
@@ -274,7 +274,13 @@ export function watchBooking(
|
||||
to: point(to),
|
||||
code: text(r.confirmation_number, 40),
|
||||
carrier: carrierOf(meta),
|
||||
seat: metaText(meta, 'seat'),
|
||||
// A flight or train with a stop: the seat of every leg, not only the first leg's.
|
||||
seat: text(
|
||||
bookingSeats(r)
|
||||
.map((s) => s.seat)
|
||||
.join(', '),
|
||||
20
|
||||
),
|
||||
platform: metaText(meta, 'platform'),
|
||||
...whereOf(r, places),
|
||||
checkIn: metaText(meta, 'check_in_time'),
|
||||
|
||||
Reference in New Issue
Block a user