mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-06-19 13:21:46 +00:00
fix: PDF thumbnails missing for MCP-added places (osm_id)
fetchPlacePhotos only checked google_place_id, skipping places that only have osm_id (e.g. those added via MCP). Mirror PlaceAvatar logic by falling back to osm_id in both the filter and the photo fetch call.
This commit is contained in:
@@ -96,12 +96,12 @@ async function fetchPlacePhotos(assignments) {
|
|||||||
const allPlaces = Object.values(assignments).flatMap(a => a.map(x => x.place)).filter(Boolean)
|
const allPlaces = Object.values(assignments).flatMap(a => a.map(x => x.place)).filter(Boolean)
|
||||||
const unique = [...new Map(allPlaces.map(p => [p.id, p])).values()]
|
const unique = [...new Map(allPlaces.map(p => [p.id, p])).values()]
|
||||||
|
|
||||||
const toFetch = unique.filter(p => !p.image_url && p.google_place_id)
|
const toFetch = unique.filter(p => !p.image_url && (p.google_place_id || p.osm_id))
|
||||||
|
|
||||||
await Promise.allSettled(
|
await Promise.allSettled(
|
||||||
toFetch.map(async (place) => {
|
toFetch.map(async (place) => {
|
||||||
try {
|
try {
|
||||||
const data = await mapsApi.placePhoto(place.google_place_id)
|
const data = await mapsApi.placePhoto(place.google_place_id || place.osm_id)
|
||||||
if (data.photoUrl) photoMap[place.id] = data.photoUrl
|
if (data.photoUrl) photoMap[place.id] = data.photoUrl
|
||||||
} catch {}
|
} catch {}
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user