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.

refactor(places): drop the unused phone pool counter

Maurice7659f2741e35
diff --git a/client/src/mobile/screens/trip/places/placesBrowserModel.test.ts b/client/src/mobile/screens/trip/places/placesBrowserModel.test.ts
index f6607f302..4c1a521db 100644
--- a/client/src/mobile/screens/trip/places/placesBrowserModel.test.ts
+++ b/client/src/mobile/screens/trip/places/placesBrowserModel.test.ts
@@ -1,7 +1,7 @@
import { describe, it, expect } from 'vitest'
import {
filterPool, firstPlannedDayNumbers, matchesSearch,
- plannedPlaceIds, poolCounts,
+ plannedPlaceIds,
} from './placesBrowserModel'
import { matchesCategoryFilter } from '../../../../utils/placesFilter'
import type { AssignmentsMap, Day, Place } from '../../../../types'
@@ -34,13 +34,6 @@ describe('placesBrowserModel — planned pool', () => {
const out = filterPool(named, { filter: 'planned', categoryFilters: noCats, search: 'eiff', plannedIds })
expect(out.map(p => p.id)).toEqual([3])
})
-
- it('MOBILE-POOL-counts: poolCounts reports planned alongside all/unplanned', () => {
- const c = poolCounts(places, noCats, '', plannedIds)
- expect(c.all).toBe(3)
- expect(c.planned).toBe(2)
- expect(c.unplanned).toBe(1)
- })
})
// FE-MOB-PMODEL-001 to FE-MOB-PMODEL-012
@@ -157,14 +150,6 @@ describe('placesBrowserModel — tracks pool', () => {
expect(all.map(p => p.id)).toEqual([1, 2, 3])
})
- it('FE-MOB-PMODEL-013: poolCounts counts tracks on the category+search base set', () => {
- const c = poolCounts(places, new Set(['4']), '', plannedIds)
- expect(c.all).toBe(2)
- expect(c.tracks).toBe(1)
- expect(c.planned).toBe(1)
- expect(c.unplanned).toBe(1)
- })
-
// #2072 — the phone pool has to agree with the desktop one; both ask the same
// shared helper now.
it('FE-MOB-PMODEL-014: a stay and a day-anchored booking both count as planned', () => {
diff --git a/client/src/mobile/screens/trip/places/placesBrowserModel.ts b/client/src/mobile/screens/trip/places/placesBrowserModel.ts
index 000e334b9..53b52cfea 100644
--- a/client/src/mobile/screens/trip/places/placesBrowserModel.ts
+++ b/client/src/mobile/screens/trip/places/placesBrowserModel.ts
@@ -1,7 +1,7 @@
import type { AssignmentsMap, Day, Place } from '../../../../types'
import { placeMatchesSearch } from '../../../../utils/placeSearch'
import {
- matchesCategoryFilter, matchesPlacesFilter, type PlacesRatingFloor,
+ matchesPlacesFilter, type PlacesRatingFloor,
} from '../../../../utils/placesFilter'
import {
plannedPlaceIds as sharedPlannedPlaceIds,
@@ -59,14 +59,3 @@ interface PoolFilterArgs {
export function filterPool(places: Place[], { filter, categoryFilters, ratingFilter = 'all', search, plannedIds }: PoolFilterArgs): Place[] {
return places.filter(p => matchesPlacesFilter(p, { filter, categoryFilters, ratingFilter }, { plannedIds }) && matchesSearch(p, search))
}
-
-/** Chip counts run on the category+search base set, like the desktop tabs. */
-export function poolCounts(places: Place[], categoryFilters: Set<string>, search: string, plannedIds: Set<number>) {
- const base = places.filter(p => matchesCategoryFilter(p, categoryFilters) && matchesSearch(p, search))
- return {
- all: base.length,
- unplanned: base.filter(p => !plannedIds.has(p.id)).length,
- planned: base.filter(p => plannedIds.has(p.id)).length,
- tracks: base.filter(p => p.route_geometry).length,
- }
-}