mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
fix(street-level): probe KartaView's nearest photos side by side
Six candidates at once on photo storage (not the API host): the nearest showable one wins. Jakarta line clicks opened 5/8 (0/5 before the QA round; the rest are archived and say so), Detroit 8/8. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
454e261256
commit
1a2fbda464
2 files changed
+10
-4
No files matched your search
@@ -440,8 +440,14 @@ export function createKartaViewProvider({
|
||||
if (metres <= NEAREST_RADIUS_M) near.push({ photo, metres });
|
||||
}
|
||||
near.sort((a, b) => a.metres - b.metres);
|
||||
for (const { photo } of near.slice(0, NEAREST_PROBES))
|
||||
if (await showable(photo, { signal })) return photo.id;
|
||||
// Probed side by side (photo storage is not the API host): the
|
||||
// nearest one that answers wins.
|
||||
const candidates = near.slice(0, NEAREST_PROBES);
|
||||
const answers = await Promise.all(
|
||||
candidates.map(({ photo }) => showable(photo, { signal })),
|
||||
);
|
||||
const hit = candidates.find((_, i) => answers[i]);
|
||||
if (hit) return hit.photo.id;
|
||||
if (near.length) throw new Error(ARCHIVED_MESSAGE);
|
||||
return null;
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user