From 54baf85a2a4d4fce35a2df799c49ee4994122115 Mon Sep 17 00:00:00 2001 From: Maurice Date: Tue, 20 Oct 2026 11:32:03 +0200 Subject: [PATCH] fix(tours): a city walk keeps to the bridges and avoids ferries The walk was routed with the pedestrian router's default, which takes ferries, so a walk through Venice went along the vaporetto lines across the canals instead of over the bridges. A walk now asks for no ferries (use_ferry 0), as a hike that avoids them does; where no way on land exists the router still takes the ferry. --- client/src/components/Tours/planner/tourRouting.test.ts | 4 ++-- client/src/components/Tours/planner/tourRouting.ts | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) 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 { - return routeOnLand(waypoints, 'walking', {}, signal) + return routeOnLand(waypoints, 'walking', CITY_WALK_COSTING, signal) } +const CITY_WALK_COSTING: Readonly = { 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[],