mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
fix(osm): keep a capped place list incomplete in analyst follow-ups
osm_query said "At least N" when the server capped its list, but handed the places to the analyst engine with truncated:false, so "which of those have emergency?" answered as if the list were whole. The handoff now carries the cap and its caveat, and follow-ups (and their follow-ups) stay incomplete with an unknown total.
This commit is contained in:
1 parent
4efba8ccca
commit
540629a0fc
6 files changed
+99
-20
No files matched your search
+17
-11
@@ -71,9 +71,9 @@ const EXAMPLES = Object.values(OSM_PRESETS)
|
||||
* @param {(enabled: boolean) => Promise<object>} deps.enableLayer
|
||||
* @param {Function} deps.search `/api/osm/features` client.
|
||||
* @param {() => void} [deps.onCredit] Registers the OpenStreetMap credit.
|
||||
* @param {(rows: object[]|null, presentation?: object) => void} [deps.rememberResults]
|
||||
* Hands the listed places, and the scope they were found in, to analyst
|
||||
* follow-ups; null forgets the previous set.
|
||||
* @param {(rows: object[]|null, presentation?: object, options?: {truncated: boolean}) => void} [deps.rememberResults]
|
||||
* Hands the listed places, the scope they were found in and whether the
|
||||
* list was capped to analyst follow-ups; null forgets the previous set.
|
||||
* @param {(step: string, label?: string) => void} [deps.progress]
|
||||
* @param {object} args
|
||||
* @param {{isCurrent?: () => boolean, budgetMs?: number, signal?: AbortSignal}} [options]
|
||||
@@ -266,15 +266,21 @@ export async function osmQuery(
|
||||
// These places are now "the last answer": follow-ups filter them and
|
||||
// "the second one" is the second row below. A follow-up keeps naming the
|
||||
// area they were found in, as an analyst count over that area would.
|
||||
// A capped list stays capped: follow-ups count a floor, with the caveat.
|
||||
const cappedCaveat = `listed the first ${limit}; there are more`;
|
||||
rememberResults(
|
||||
records,
|
||||
area
|
||||
? {
|
||||
scopeLabel: `inside ${areaName}`,
|
||||
coverageScope: `area:${args.areaId}`,
|
||||
areaId: args.areaId,
|
||||
}
|
||||
: { scopeLabel: 'in view', coverageScope: 'view' },
|
||||
{
|
||||
...(area
|
||||
? {
|
||||
scopeLabel: `inside ${areaName}`,
|
||||
coverageScope: `area:${args.areaId}`,
|
||||
areaId: args.areaId,
|
||||
}
|
||||
: { scopeLabel: 'in view', coverageScope: 'view' }),
|
||||
...(complete ? {} : { display: { caveat: cappedCaveat } }),
|
||||
},
|
||||
{ truncated: !complete },
|
||||
);
|
||||
const unnamed = `unnamed ${singularLabel(preset.label)}`;
|
||||
const referents = [
|
||||
@@ -309,7 +315,7 @@ export async function osmQuery(
|
||||
...(merged ? { merged: `${merged} duplicate mappings merged` } : {}),
|
||||
caveat: complete
|
||||
? 'OpenStreetMap coverage varies by place'
|
||||
: `listed the first ${limit}; there are more`,
|
||||
: cappedCaveat,
|
||||
},
|
||||
};
|
||||
} finally {
|
||||
|
||||
Reference in new issue
Block a user