mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-30 08:30:05 +00:00
fix(journey): drop the entry connection where a recorded day shows the way
The journey map joins every located entry with a faint dashed line in the order of its pins. It drew that line through everything, also across days whose real route is on the map as a kept recording or the live Dawarich trail, so straight guesses fanned out over the recorded track. The phone has no layer switches, so the line could not even be hidden there. A recorded track now carries the day it belongs to (an optional `date` on the track contract, set by every builder of recorded lines: kept days, the shared page's recordings, the live Dawarich trail and the day import preview). A pure model splits the connection into the stretches still open and those whose days were all recorded, the night between two recorded days included. Both renderers draw only the open stretches with the entries; the covered ones sit on a layer of their own that shows while the reader hides what was recorded, so the guess comes back exactly where nothing else explains the way. The live trail is now matched to a kept day by that date instead of reading the track name as one. Closes #2888
This commit is contained in:
@@ -14,6 +14,7 @@ import {
|
||||
journeyEntryVisibilitySchema,
|
||||
journeyCreateToolSchema,
|
||||
journeyUpdateToolSchema,
|
||||
journeyTrackSchema,
|
||||
} from './journey.schema';
|
||||
|
||||
import { describe, it, expect } from 'vitest';
|
||||
@@ -143,6 +144,20 @@ describe('the entry enums and the range of a read', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('journeyTrackSchema', () => {
|
||||
const track = { place_id: -1, trip_id: 0, name: 'Day', color: null, points: [[48.1, 11.5]], kind: 'day_recording' };
|
||||
|
||||
it('JRNSCH-004: a recorded line may name its calendar day, a GPX track leaves it out', () => {
|
||||
expect(journeyTrackSchema.parse({ ...track, date: '2026-10-29' }).date).toBe('2026-10-29');
|
||||
expect(journeyTrackSchema.parse({ ...track, kind: 'trip_gpx' }).date).toBeUndefined();
|
||||
});
|
||||
|
||||
it('JRNSCH-005: refuses a day that is not a calendar day', () => {
|
||||
expect(journeyTrackSchema.safeParse({ ...track, date: '29. Oktober' }).success).toBe(false);
|
||||
expect(journeyTrackSchema.safeParse({ ...track, date: '2026-02-30' }).success).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('the journey tool arguments', () => {
|
||||
it('JSCHEMA-TOOL-001: a new journey needs a title and refuses what the tool does not take', () => {
|
||||
expect(journeyCreateToolSchema.parse({ title: 'Japan', trip_ids: [5] })).toEqual({ title: 'Japan', trip_ids: [5] });
|
||||
|
||||
@@ -392,6 +392,11 @@ export const journeyTrackSchema = z.object({
|
||||
* which is all GET `:id/tracks` has ever answered.
|
||||
*/
|
||||
kind: z.enum(['trip_gpx', 'day_recording', 'dawarich_live']).optional(),
|
||||
/**
|
||||
* The day a recorded line belongs to, so the map can tell which stretches
|
||||
* between entries it already shows as travelled. A trip's GPX has none.
|
||||
*/
|
||||
date: journeyRecordingDateSchema.optional(),
|
||||
});
|
||||
export type JourneyTrack = z.infer<typeof journeyTrackSchema>;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user