Skip to content

armgit / TREK

Public Imported from GitHub
0

The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.

Tours: the trip copy keeps its copied tours in one map, so trips.service stays at its size baseline; unused TourMapVisibility type removed

Maurice1d7758b81919
diff --git a/client/src/components/Tours/useTourMapVisibility.ts b/client/src/components/Tours/useTourMapVisibility.ts
index 30e40a439..de8f2a2be 100644
--- a/client/src/components/Tours/useTourMapVisibility.ts
+++ b/client/src/components/Tours/useTourMapVisibility.ts
@@ -36,5 +36,3 @@ export function useTourMapVisibility(tripId: number, tourIds: ReadonlySet<number
return { hiddenIds, isHidden, toggle, showAll, hiddenCount: hiddenIds.size };
}
-
-export type TourMapVisibility = ReturnType<typeof useTourMapVisibility>;
diff --git a/server/src/nest/trips/trips.service.ts b/server/src/nest/trips/trips.service.ts
index 94d03dc46..d4c0a59ab 100644
--- a/server/src/nest/trips/trips.service.ts
+++ b/server/src/nest/trips/trips.service.ts
@@ -737,17 +737,14 @@ export class TripsService {
// through; without them the copy is a plain place with a line, no Tour, its route not editable.
// The facet row goes first, since the waypoints and the import record reference it.
const oldTours = await this.toursRepo.listRowsForTrip(Number(sourceTripId));
- const copiedTours = new Set<number>();
- const copiedSources: Array<[number, number]> = [];
+ const copiedTours = new Map<number, number>();
for (const { place_id, ...tour } of oldTours) {
const newPlaceId = placeMap.get(place_id);
if (!newPlaceId) continue;
await this.toursRepo.insertCopy(newPlaceId, tour, placeMap);
- copiedSources.push([place_id, newPlaceId]);
- copiedTours.add(place_id);
+ copiedTours.set(place_id, newPlaceId);
}
- // The import records after the facets they reference; the order among them does not matter.
- await Promise.all(copiedSources.map(([from, to]) => this.toursRepo.copySource(from, to)));
+ await Promise.all([...copiedTours].map(([from, to]) => this.toursRepo.copySource(from, to)));
const waypointsByPlace = new Map<number, TourWaypointRow[]>();
for (const { place_id, ...waypoint } of await this.tourWaypointsRepo.listForTrip(Number(sourceTripId))) {