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

An empty camera answer outside the catalog's regions read as "0 public
cameras", as if the area had none. It now says the catalog has no cameras
there.
This commit is contained in:
Sameh Khamis committed 2026-10-02 15:21:36 -07:00
1 parent f610de77dc
commit ad9a3976a9
2 files changed
+9 -1

No files matched your search

+5 -1
View File
@@ -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(
+4
View File
@@ -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.',
);
});