fix(maps): stop the day route drawing drives to airports you flew from

A flight leaving overnight contributes only its departure airport on the day
it leaves, and the evening hotel bookend was attaching to whatever point sat
at the day's edge. So the map drew a straight line from the airport you took
off from to the hotel you were checking into.

The same blind spot on the run builder produced the long rays: a day's order
is a bare wall clock, so an inbound long-haul whose departure clock reads late
sorts after the day's local stops, and its far departure airport got appended
to that run. OSRM answers such a pair with NoRoute and the fallback straightens
the whole chunk, taking the genuine local drive with it.

Both now ask whether the pair could be driven at all. A flight, train, ferry,
cruise or coach carries you out of the day's geography, so its departure point
has no drive back to tonight's hotel and its arrival point had no drive from
this morning's. A hire car is the opposite and stays out of that set: you keep
driving it, so a multi-day rental's pickup and drop-off points keep their hotel
legs. Alongside it, any leg touching a booking endpoint has to be within
MAX_DRIVE_KM, which catches the mis-sorted edges the role alone cannot see.

The sidebar gets both guards so its hotel connectors stay in step with the
drawn route; the mobile map and timeline read the same hook.
This commit is contained in:
Maurice
2026-08-29 11:57:05 +02:00
committed by Maurice
parent 3c865c9605
commit 9162f5d7ac
8 changed files with 328 additions and 38 deletions
+21
View File
@@ -54,6 +54,27 @@ export function hidesOnMiddleDay(
return !!r.type && MIDDLE_DAY_HIDDEN_TYPES.has(r.type) && getSpanPhase(r, dayId) === 'middle'
}
/**
* Bookings you ride and then leave behind: the vehicle carries you out of the day's
* geography and keeps going without you. Their endpoints are therefore not the ends of
* a drive — you did not drive to tonight's hotel from the airport you took off from, and
* you did not drive to the airport you landed at from this morning's hotel (#2133).
*
* A hire car, a parked car or a hired bike is the exact opposite and must stay out of
* this set: you collect the vehicle and keep driving it, so a multi-day rental's pickup
* point IS where a drive to the hotel starts, and its drop-off point IS where a drive
* from the hotel ends (both pinned by the car-rental span rules above).
*
* `taxi`, `transit` and `transport_other` are left out on purpose: they are same-day
* hops, so both their endpoints land on the day anyway and the distinction never fires.
* Keeping them out means this set cannot change any behaviour they have today.
*/
const CARRIER_TRANSPORT_TYPES = new Set(['flight', 'train', 'ferry', 'cruise', 'bus'])
export function isCarrierTransport(r: { type?: string | null }): boolean {
return !!r.type && CARRIER_TRANSPORT_TYPES.has(r.type)
}
/**
* The route waypoints a transport contributes on a given day, respecting multi-day spans.
* A car rental (or any reservation whose span covers several days) is only routed to on its