fix(tours): the last review findings of the city walks

A place closing at midnight is no longer read as open past it: the hours
run on only where the next date opens at midnight (any window of the day
counts, as written order is kept), and an impossible date such as
2026-02-31 reads as unknown instead of rolling into March. The hours
source names the trip's places rather than "your own" entries, in all
27 locales, as the pill beside it does.

The day a walk's arrivals are checked for shows its date on the pill,
not only "Day N". The 12 hour clock is tested for a window to midnight.

The along-the-tour term table is built once again, now that the one test
that stubbed the places client without its real exports spreads them.
New test seeding goes through the ORM factories.
This commit is contained in:
Maurice
2026-10-20 10:37:29 +02:00
parent 6477bf5e39
commit 3882feec5c
40 changed files with 178 additions and 80 deletions
+4 -3
View File
@@ -23,6 +23,9 @@ import type { MapsAutocompleteResult } from '@trek/shared';
type PoiBbox = { south: number; west: number; north: number; east: number };
/** Every term the index is asked by, whichever kind asks for it. */
const EVERY_TERM = Object.values(POI_CATEGORY_TO_TREK).flat();
/** What one POI request asks the index, and how its answer is labelled. */
export interface IndexPoiPlan {
wanted: string[];
@@ -162,9 +165,7 @@ export function ownedByAsked(
row: { category: string | null; categoryPath: string | null },
asked: readonly string[],
): boolean {
// Every term the index is asked by, whichever kind asks for it; read here, not
// when the module loads, so a suite that stubs the index client stays loadable.
const term = indexRowTerm(Object.values(POI_CATEGORY_TO_TREK).flat(), row.category, row.categoryPath);
const term = indexRowTerm(EVERY_TERM, row.category, row.categoryPath);
return term === undefined || asked.some((kind) => POI_CATEGORY_TO_TREK[kind]?.includes(term));
}