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.

revert(places): keep the Tracks choice out of the pool while Tours is on, as B4A decided

Maurice094426debb73
diff --git a/client/src/components/Planner/usePlacesPool.test.ts b/client/src/components/Planner/usePlacesPool.test.ts
index 269890b9f..1dc445f81 100644
--- a/client/src/components/Planner/usePlacesPool.test.ts
+++ b/client/src/components/Planner/usePlacesPool.test.ts
@@ -48,17 +48,13 @@ afterEach(() => {
});
describe('places pool helpers', () => {
- it('FE-PLANNER-POOL-001: the Tracks choice needs a track that is no tour while tours are on (#2810)', () => {
+ it('FE-PLANNER-POOL-001: the Tracks choice needs a track and stays away while tours are on', () => {
const track = buildPlace({ route_geometry: '[[1,2],[3,4]]' });
- const tour = buildPlace({ route_geometry: '[[1,2],[3,4]]' });
- tour.tour_place_id = tour.id;
const pin = buildPlace();
expect(poolHasTracks([pin], false)).toBe(false);
expect(poolHasTracks([pin, track], false)).toBe(true);
expect(poolHasTracks([pin, track], undefined)).toBe(true);
- expect(poolHasTracks([pin, tour], true)).toBe(false);
- expect(poolHasTracks([pin, tour], false)).toBe(true);
- expect(poolHasTracks([pin, tour, track], true)).toBe(true);
+ expect(poolHasTracks([pin, track], true)).toBe(false);
});
it('FE-PLANNER-POOL-002: the show choices list all, unplanned and planned, then tracks when there are some', () => {
diff --git a/client/src/components/Planner/usePlacesPool.ts b/client/src/components/Planner/usePlacesPool.ts
index 04920f262..71d9f7ddf 100644
--- a/client/src/components/Planner/usePlacesPool.ts
+++ b/client/src/components/Planner/usePlacesPool.ts
@@ -12,13 +12,9 @@ export type PlacesFilter = 'all' | 'unplanned' | 'planned' | 'tracks';
type Translate = ReturnType<typeof useTranslation>['t'];
-/**
- * Whether the "Tracks" choice belongs in the pool: a place with a line that is
- * no tour. While tours are on a tour lists under Tours, but a track imported
- * before them (4.x) is a plain place and stays here (#2810).
- */
+/** Whether the "Tracks" choice belongs in the pool: never while tours are on, since tracks are tours then. */
export function poolHasTracks(places: Place[], toursEnabled: boolean | undefined): boolean {
- return places.some((p) => p.route_geometry && !(toursEnabled && p.tour_place_id === p.id));
+ return !toursEnabled && places.some((p) => p.route_geometry);
}
/** The "show" choices; tracks only once a place has one. */