mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-24 07:53:09 +00:00
fix(tours): a hike over several days reaches the router without its stage ends
The router checks its request against the strict plan point, which has no stage_end, so every hike with a stage end was refused with "Unrecognized key: stage_end" before a way was planned. The points go to the router with their position, name and kind only.
This commit is contained in:
@@ -158,10 +158,17 @@ export class HikePlanService {
|
||||
preferences: HikingPreferences | null | undefined,
|
||||
grades: boolean,
|
||||
): Promise<PlannedHike> {
|
||||
// The router takes the points only: where a stage ends is the hike's, not the way's.
|
||||
const waypoints = points.map(({ lat, lng, name, poi_category }) => ({
|
||||
lat,
|
||||
lng,
|
||||
...(name === undefined ? {} : { name }),
|
||||
...(poi_category === undefined ? {} : { poi_category }),
|
||||
}));
|
||||
return await this.routing.plan(
|
||||
userId,
|
||||
tripId,
|
||||
{ waypoints: points, max_hiking_difficulty: limit, hiking_preferences: preferences },
|
||||
{ waypoints, max_hiking_difficulty: limit, hiking_preferences: preferences },
|
||||
{ grades },
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user