mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-22 13:10:29 +00:00
feat(client): route every day through Valhalla where the TREK services or an own Valhalla answer
With the TREK services or an own Valhalla, the day plan, the road trip and the other ways of a leg are routed by Valhalla on foot, by bike and by car, twenty locations a request. A day it cannot answer (relay refusal, time out, no way for a leg) goes to OSRM whole and without a word; it is never handed to FOSSGIS unless it avoids something only Valhalla can avoid. With FOSSGIS nothing changes: OSRM routes the days and Valhalla the avoidances. A Valhalla answer is cached under its own key beside the OSRM one, so switching engines never serves a day from the other engine. The Valhalla day routing moves out of RouteCalculator into valhallaDayRoute.ts.
This commit is contained in:
@@ -1149,7 +1149,8 @@ describe('a leg asked for again on demand', () => {
|
||||
})
|
||||
|
||||
it('FE-ROADTRIP-ROUTES-047: a seam is asked under the card it arrives on, and a leg nothing weighs is OSRM\'s', () => {
|
||||
act(() => { useSettingsStore.setState(s => ({ settings: { ...s.settings, roadtrip_avoid: 'motorway' } })) })
|
||||
// FOSSGIS chosen: Valhalla only answers what OSRM cannot.
|
||||
act(() => { useSettingsStore.setState(s => ({ settings: { ...s.settings, roadtrip_avoid: 'motorway', routing_valhalla_provider: 'fossgis' } })) })
|
||||
const days = [day(1, 1, { default_transport_mode: 'cycling' }), day(2, 2, { default_transport_mode: 'driving' })]
|
||||
const { result } = renderHook(() => useRoadtripRoutes(7, days, {} as AssignmentsMap))
|
||||
|
||||
@@ -1164,6 +1165,17 @@ describe('a leg asked for again on demand', () => {
|
||||
.toMatchObject({ mode: 'plugin:ev/fast', avoid: [], engine: 'plugin' })
|
||||
})
|
||||
|
||||
it('FE-ROADTRIP-ROUTES-047b: where Valhalla routes the days, a leg nothing weighs is Valhalla\'s too', () => {
|
||||
act(() => { useSettingsStore.setState(s => ({ settings: { ...s.settings, routing_valhalla_provider: 'trek' } })) })
|
||||
const days = [day(1, 1, { default_transport_mode: 'cycling' }), day(2, 2, { default_transport_mode: 'driving' })]
|
||||
const { result } = renderHook(() => useRoadtripRoutes(7, days, {} as AssignmentsMap))
|
||||
|
||||
expect(result.current.legRouter?.(stopOn(1, 2, HAMBURG), stopOn(1, 3, LUENEBURG), 2))
|
||||
.toMatchObject({ mode: 'cycling', avoid: [], engine: 'valhalla' })
|
||||
expect(result.current.legRouter?.(stopOn(2, 0, BERLIN, { legMode: 'plugin:ev/fast' }), stopOn(2, 1, HAMBURG), 2))
|
||||
.toMatchObject({ engine: 'plugin' })
|
||||
})
|
||||
|
||||
it('FE-ROADTRIP-ROUTES-048: a day the stand-in engine drove while avoiding says the avoidance did not happen', async () => {
|
||||
act(() => { useSettingsStore.setState(s => ({ settings: { ...s.settings, roadtrip_avoid: 'toll,ferry' } })) })
|
||||
calculateRouteWithLegs.mockResolvedValue({ ...routed(1), avoidance: { asked: ['ferry', 'toll'], achieved: [], fellBack: true } })
|
||||
|
||||
Reference in New Issue
Block a user