mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-23 13:23:04 +00:00
fix(places): a track is a duplicate only of a track, never of a sight of that name
A GPX or KML import skipped every row whose name was already a place of the trip. A watch names a hike after where it went, so "Hokitika Gorge" was refused as already in the trip because the gorge itself was a planned place, with no track to show for it (#2810). A track now matches only the tracks of that name; a pin still matches every place of its name. The Places filter also hid its "Tracks" choice whenever Tours was on, on the grounds that tracks are tours then. A track imported before Tours is a plain place and stays in the list, so the choice now counts the tracks that are no tour.
This commit is contained in:
@@ -590,6 +590,12 @@ export class PlacesRepository extends TrekRepository<Places> {
|
||||
.execute<{ name: string; description: string | null; address: string | null; lat: number | null; lng: number | null; route_geometry: string | null; category: string | null }[]>('all', false);
|
||||
}
|
||||
|
||||
/** The names of the trip's places that carry a line, which a track to import is matched against (#2810). */
|
||||
async listTrackNames(trip_id: number): Promise<string[]> {
|
||||
const rows = await this.find({ trip: trip_id, route_geometry: { $ne: null } }, { fields: ['name'] });
|
||||
return rows.map((row) => row.name);
|
||||
}
|
||||
|
||||
/**
|
||||
* PL24 (`PlacesService.buildDedupSet`'s read) — `SELECT name, lat, lng,
|
||||
* google_place_id, google_ftid, osm_id, amap_poi_id FROM places WHERE
|
||||
|
||||
Reference in New Issue
Block a user