fix(places): read the dedup tracks off the dedup inputs, the places files stay within their size entries

This commit is contained in:
Maurice
2026-10-26 14:18:59 +01:00
parent e677d58f91
commit 313198ba63
6 changed files with 21 additions and 40 deletions
@@ -590,12 +590,6 @@ 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
@@ -611,16 +605,15 @@ export class PlacesRepository extends TrekRepository<Places> {
* it was.
*/
async listDedupInputs(trip_id: string): Promise<{
name: string | null; lat: number | null; lng: number | null;
name: string | null; lat: number | null; lng: number | null; route_geometry: string | null;
google_place_id: string | null; google_ftid: string | null; osm_id: string | null; amap_poi_id: string | null;
}[]> {
// route_geometry tells a track from a pin: a track to import matches only tracks (#2810).
return this.qb('p')
.select(['p.name', 'p.lat', 'p.lng', 'p.google_place_id', 'p.google_ftid', 'p.osm_id', 'p.amap_poi_id'])
.select(['p.name', 'p.lat', 'p.lng', 'p.route_geometry',
'p.google_place_id', 'p.google_ftid', 'p.osm_id', 'p.amap_poi_id'])
.where('p.trip_id = ?', [trip_id])
.execute<{
name: string | null; lat: number | null; lng: number | null;
google_place_id: string | null; google_ftid: string | null; osm_id: string | null; amap_poi_id: string | null;
}[]>('all', false);
.execute<Awaited<ReturnType<PlacesRepository['listDedupInputs']>>>('all', false);
}
/**