fix(roadtrip): other ways come from the router that draws the leg, and a choice is saved once it holds

The picker of other ways asked OSRM with nothing avoided while the rail drives a trip
that avoids a road class through Valhalla, so the list had no current road, called a road
the rail was not on the fastest, and choosing it changed nothing. A choice was stored as
one via where the offer strayed furthest, without asking whether the router then drove
it: a point on a ferry was pulled to the pier and the drive went overland, and a way
weighed away from motorways kept the motorway after its one point. An OSRM answer standing
in for a Valhalla that did not respond was cached as the avoided road, unmarked.

The rail now hands out a router per leg with the leg's own mode, avoided classes and
engine, and its days carry the line of every leg. Offers come from that engine, and the
rail's own leg always heads the list as Current. A choice is pinned and proven against
that router with at most three pins before anything is written; a way it will not follow
is not saved and says why, with a hint when it crosses by ferry, and a leg that changed
meanwhile or a device offline writes nothing. The OSRM stand-in is filed under the plain
key only and flags the day as not avoided.
This commit is contained in:
Maurice
2026-09-23 09:04:58 +02:00
parent 6124e0b056
commit 53a422d22d
53 changed files with 2121 additions and 378 deletions
+7 -1
View File
@@ -301,8 +301,14 @@ export interface RouteWithLegs {
* banning it, so a drive with no untolled connection comes back on a toll road and
* says so. Present only on a route that was asked to avoid something, so `undefined`
* means the question was never put rather than "avoided nothing".
*
* `fellBack` is set when the engine that weighs classes away could not answer and OSRM
* drove the request unweighted instead. Nothing was avoided then, so `achieved` is
* empty, the same reading the server's planner gives such a leg.
*/
avoidance?: { asked: RouteAvoidClass[]; achieved: RouteAvoidClass[] }
avoidance?: { asked: RouteAvoidClass[]; achieved: RouteAvoidClass[]; fellBack?: boolean }
/** Whether the road crosses by ferry, where the engine that drew it says so. */
hasFerry?: boolean
}
/** A road class a route can be asked to leave out. */