Skip to content

armgit / TREK

Public Imported from GitHub
0

The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.

fix(tours): a city walk keeps to the bridges and avoids ferries

Maurice54baf85a2a4d
diff --git a/client/src/components/Tours/planner/tourRouting.test.ts b/client/src/components/Tours/planner/tourRouting.test.ts
index 5fc254183..cd34cd6d7 100644
--- a/client/src/components/Tours/planner/tourRouting.test.ts
+++ b/client/src/components/Tours/planner/tourRouting.test.ts
@@ -230,9 +230,9 @@ describe('routing on land, bike profiles and unreachable points (BIK-01)', () =>
).toEqual({ unreachable: 1, snappedMeters: 400 })
})
- it('TOUR-ROUTING-033: a city walk goes on foot with no hiking limit and no choice of a hike (CW-01)', async () => {
+ it('TOUR-ROUTING-033: a city walk goes on foot with no hiking limit, no choice of a hike, and avoids ferries (CW-01)', async () => {
valhallaRun.mockResolvedValueOnce(run([3, 4]))
expect(await routeCityWalk(waypoints)).toMatchObject({ distanceMeters: 1500, durationSeconds: 300 })
- expect(valhallaRun).toHaveBeenCalledWith(waypoints, 'walking', [], undefined, {})
+ expect(valhallaRun).toHaveBeenCalledWith(waypoints, 'walking', [], undefined, { use_ferry: 0 })
})
})
diff --git a/client/src/components/Tours/planner/tourRouting.ts b/client/src/components/Tours/planner/tourRouting.ts
index 10cf5e6c2..db07edac1 100644
--- a/client/src/components/Tours/planner/tourRouting.ts
+++ b/client/src/components/Tours/planner/tourRouting.ts
@@ -106,15 +106,19 @@ export async function routeWalkingTour(
/**
* CW-01: a city walk, on foot between its stations. No hiking limit is sent,
* so the router keeps to the ways it takes for walking anyway (T1), and no
- * route choice of a hike.
+ * route choice of a hike. Ferries are avoided: a walk is walked, and with the
+ * router's default Venice was crossed on the vaporetto lines instead of the
+ * bridges. Where no way on land exists the router still takes the ferry.
*/
export async function routeCityWalk(
waypoints: LandWaypoint[],
signal?: AbortSignal,
): Promise<TourRouteResult | TourRouteUnreachable | null> {
- return routeOnLand(waypoints, 'walking', {}, signal)
+ return routeOnLand(waypoints, 'walking', CITY_WALK_COSTING, signal)
}
+const CITY_WALK_COSTING: Readonly<CostingOptions> = { use_ferry: 0 }
+
/** BIK-01: a bike tour, routed for its profile; a leg drawn by hand is kept as drawn. */
export async function routeBikeTour(
waypoints: LandWaypoint[],