mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-30 08:30:05 +00:00
feat(tours): plan a trail run on forest tracks and natural paths
RUN-02. Trail running joins Running as a run profile, chosen on purpose in the planner and in the GPX import. It asks Valhalla's pedestrian costing for tracks wherever they serve (use_tracks 1) and admits mountain paths up to T2 (max_hiking_difficulty 2), never T3 and above, with ferries only where no way on land exists. Checked with trace_attributes against the public instance: above Freiburg Guenterstal up to the Schauinsland the route went from 82 % roads and 83 % paved (running) to 78 % forest tracks and 81 % compacted, gravel and dirt; Rathen to the Bastei took 28 % of T2 path that running leaves out; Heidelberg's old town stayed as it was. Leaning on footways (walkway_factor) was tried and left out, it moved runs onto paved footways. While a run is planned, a card says what it runs on: its surfaces, the hiking grades of its paths (sac_scale, T1 to T6, as mappers gave them) and its kinds of way, each as shares with lengths that point at their stretches on the map. A way without a grade or a surface is its own row, unknown and never easy, and an info dot says the grades say nothing about whether a way can be run. The head carries the unpaved share and the hardest graded path as badges. The line is matched on foot for this, so steps and mountain paths stay on it; a bike tour's is matched as before. Reading fails, goes offline or is retried as for a bike tour, and nothing of it changes the run. Pace and time are RUN-01's: the running time stays the distance at the runner's pace, with climbs, descents and difficulty left out, whatever the profile. A profile change plans the route again and keeps the pace; a failed trail route keeps the last route and holds Save back. The card's building blocks moved out of the bike card into RouteWaySections, so both cards share one set of rows, bars and status lines. The run_profile column already allowed trail (RUN-01), so no migration. GPX export names a trail run trail_running, list_tours describes the profile as a routing preference, never a statement that a way can be run.
This commit is contained in:
@@ -24,10 +24,8 @@ async function ormBeforeTarget(): Promise<MikroORM> {
|
||||
}
|
||||
|
||||
describe('run columns match the contract', () => {
|
||||
it('TOURRUNMIG-001: stores every profile the contract knows, and besides them only trail running (RUN-02)', () => {
|
||||
const stored = Object.values(ToursRunProfile);
|
||||
expect(RUN_PROFILES.every((profile) => (stored as readonly string[]).includes(profile))).toBe(true);
|
||||
expect(stored.filter((profile) => !(RUN_PROFILES as readonly string[]).includes(profile))).toEqual(['trail']);
|
||||
it('TOURRUNMIG-001: stores exactly the profiles the contract knows, trail running (RUN-02) included', () => {
|
||||
expect([...Object.values(ToursRunProfile)].sort()).toEqual([...RUN_PROFILES].sort());
|
||||
});
|
||||
|
||||
it('TOURRUNMIG-002: switches the run type on, leaves every tour as it was and refuses a pace out of bounds', async () => {
|
||||
|
||||
@@ -33,5 +33,6 @@ describe('gpxActivityOf (PR1-06A, BIK-01, HIK-01, RUN-01)', () => {
|
||||
expect(gpxActivityOf({ tour_type: 'run', run_profile: 'running' })).toBe('running');
|
||||
expect(gpxActivityOf({ tour_type: 'run', run_profile: null })).toBe('running');
|
||||
expect(gpxActivityOf({ tour_type: 'run', run_profile: 'sprint' })).toBe('running');
|
||||
expect(gpxActivityOf({ tour_type: 'run', run_profile: 'trail' })).toBe('trail_running');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -392,4 +392,23 @@ describe('ToursMcp', () => {
|
||||
expect(description).toContain('no climb, descent or difficulty is in it');
|
||||
expect(description).toContain('never a recorded time');
|
||||
});
|
||||
|
||||
it('TOURS-MCP-017: list_tours names a trail run as such, and its profile as a routing preference only (RUN-02)', async () => {
|
||||
const { user, trip, ridge } = fixture();
|
||||
const orm = await createTestOrm(db);
|
||||
await updateRows(
|
||||
orm,
|
||||
Tours,
|
||||
{ place: ridge.id },
|
||||
{ tourTypeRef: 'run', max_hiking_difficulty: null, run_profile: 'trail', run_pace_seconds_per_km: 450 },
|
||||
);
|
||||
await orm.close();
|
||||
const { tours } = read(await mcp.listTours({ tripId: trip.id }, ctx(user.id)));
|
||||
const listed = tours.find((tour: { place_id: number }) => tour.place_id === ridge.id);
|
||||
expect(listed).toMatchObject({ tour_type: 'run', run_profile: 'trail', run_pace_seconds_per_km: 450 });
|
||||
const entry = getEntry(ToursMcp as unknown as ClassRef, 'listTours');
|
||||
const description = entry?.kind === 'tool' ? (entry.options.description ?? '') : '';
|
||||
expect(description).toContain('trail for forest tracks and natural paths up to mountain paths (T2)');
|
||||
expect(description).toContain('never a statement that a way can be run');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user