From 365b8f539064d3aba0229ab34c75c8103b5648cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fe=CC=81lix=20Pe=CC=81ault?= Date: Mon, 1 Nov 2021 11:11:33 +0100 Subject: [PATCH] Use filtered aggregated photos count on Location page --- src/routes/[country]/[location]/index.svelte | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/routes/[country]/[location]/index.svelte b/src/routes/[country]/[location]/index.svelte index b70a29c..a3be4da 100644 --- a/src/routes/[country]/[location]/index.svelte +++ b/src/routes/[country]/[location]/index.svelte @@ -271,21 +271,19 @@ date_created } - total_published: photo_aggregated (groupBy: "location") { - group - count { id } + total_published: photo_aggregated (filter: { location: { slug: { _eq: "${location}" }}}) { + count { location } } } `) const { data } = res - const photosCount = stuff.countTotalPhotosByLocation.find((total: any) => total.group.location === Number(data.location[0].id)) return { props: { location: data.location[0], photos: data.photos, - totalPhotos: data.photos.length ? photosCount.count.id : 0, + totalPhotos: data.photos.length ? data.total_published[0].count.location : 0, lastUpdated: data.photos.length ? data.photos[0].date_created : undefined, } }