Skip to content

A spy satellite simulator in your browser, except the data is real. Live open source spatial intelligence on a photorealistic 3D globe.

fix: say the camera catalog has no cameras rather than none exist

Sameh Khamisad9a3976a9d9
diff --git a/src/tools/queries/media.js b/src/tools/queries/media.js
index 675ef2a27..f866c9c86 100644
--- a/src/tools/queries/media.js
+++ b/src/tools/queries/media.js
@@ -92,7 +92,11 @@ export const findCctvCameras = defineTool({
.sort((a, b) => a.distance_km - b.distance_km);
return {
summary:
- `${countNoun(rows.length, 'public camera')} in ${area.label}` +
+ (rows.length || trimmed.length
+ ? `${countNoun(rows.length, 'public camera')} in ${area.label}`
+ : // The catalog covers selected regions; an empty answer elsewhere
+ // means it has no cameras there, not that none exist.
+ `The camera catalog has no cameras in ${area.label}`) +
(trimmed.length
? ` (the catalog serves only some cameras here: ${trimmed
.map(
diff --git a/src/tools/queries/media.test.mjs b/src/tools/queries/media.test.mjs
index d7d014df7..a024191e7 100644
--- a/src/tools/queries/media.test.mjs
+++ b/src/tools/queries/media.test.mjs
@@ -321,4 +321,8 @@ test('an area the catalog trimmed away entirely is not reported complete', async
area: { lat: 40.7, lon: -74, radius_km: 3 },
});
assert.equal(elsewhere.data.complete, true);
+ assert.equal(
+ elsewhere.summary,
+ 'The camera catalog has no cameras in 3 km around 40.700, -74.000.',
+ );
});