refactor(places): drop the unused phone pool counter

poolCounts in the phone places browser model has had no caller since the
phone pool chips stopped showing counts in 8855b5581 (the FilterChip note in
MPlacesBrowser says counts are left out on the phone to save row space). Only
its own tests still ran it, and it had drifted from the desktop counts in
usePlacesSidebar, which count planned places against the day scoped planned
ids. Nothing on the phone should use it, so it goes, with its two tests.

No user facing change, so there is no red test: the helper is dead code.

Removed tests in src/mobile/screens/trip/places/placesBrowserModel.test.ts:
MOBILE-POOL-counts (expected all 3, planned 2, unplanned 1) and
FE-MOB-PMODEL-013 (expected all 2, tracks 1, planned 1, unplanned 1).
This commit is contained in:
Maurice
2026-10-09 17:42:00 +02:00
parent cee496c469
commit 7659f2741e
2 changed files with 2 additions and 28 deletions
@@ -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', () => {
@@ -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,
}
}