diff --git a/src/routes/[country]/[location]/index.svelte b/src/routes/[country]/[location]/index.svelte index 98d894e..846adb7 100644 --- a/src/routes/[country]/[location]/index.svelte +++ b/src/routes/[country]/[location]/index.svelte @@ -210,6 +210,7 @@ }, limit: ${import.meta.env.VITE_LIST_AMOUNT}, ) { + id name slug description @@ -243,24 +244,21 @@ date_created } - total_published: photo ( - filter: { - status: { _eq: "published" }, - location: { slug: { _eq: "${location}" }} - } - ) { - id + total_published: photo_aggregated (groupBy: "location") { + group + count { id } } } `) const { data } = res + const locationPhotosCount = data.total_published.find(({ group }: any) => group.id === data.location.id) return { props: { data: data.location[0], photos: data.photos, - totalPhotos: data.total_published.length, + totalPhotos: locationPhotosCount.count.id, lastUpdated: data.photos[0].date_created, } }