fix(tours): keep the waypoints of a GPX/KML file that also holds a track

With the Tours addon on, a file picked or dropped on the places column goes
into the Tours import as soon as it holds one line, and that import reads
lines only. A Sygic or Trip-o-matic export (a route plus its stops) came in
as one tour and every place was dropped without a word.

The preview now counts a GPX file's waypoints as it already counted a KML
file's pins, and the dialog offers to add those points as places of the
trip, on by default. Confirming runs the Tours import for the lines and the
places import (points only) for the same files. A file whose tracks the
trip already holds can still bring its points.

Closes #2969
This commit is contained in:
Maurice
2026-11-03 20:19:43 +01:00
parent f8e51cb83d
commit 2e683f8609
36 changed files with 374 additions and 42 deletions
+12
View File
@@ -1049,6 +1049,18 @@ describe('Tours e2e (real guards + temp SQLite)', () => {
expect(broadcast).not.toHaveBeenCalled();
});
it('counts the waypoints beside the track, which no tour takes in (#2969)', async () => {
expect((await previewGpx(OWNER, TRACK_GPX)).body.left_out).toBeUndefined();
const withPoints = TRACK_GPX.replace(
'<trk>',
'<wpt lat="49.1" lon="12.1"><name>Hut</name></wpt><wpt lat="49.2" lon="12.2"><name>Lake</name></wpt><trk>',
);
const res = await previewGpx(OWNER, withPoints);
expect(res.body.tracks).toHaveLength(1);
expect(res.body.left_out).toEqual({ points: 2, areas: 0, other: 0 });
expect(await countRows(orm, Places)).toBe(0);
});
it('leaves heights it does not have unknown, and names a track the trip already holds', async () => {
const flat = await previewGpx(OWNER, FLAT_GPX);
expect(flat.body.tracks[0]).toMatchObject({ elevation_gain_m: null, elevation_loss_m: null });