From d87ec1835a362119d21d1a36a156ebc7ce800583 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fe=CC=81lix=20Pe=CC=81ault?= Date: Mon, 30 May 2022 22:07:20 +0200 Subject: [PATCH] Remove unused global photos count --- src/routes/__layout.svelte | 31 ------------------------------- 1 file changed, 31 deletions(-) diff --git a/src/routes/__layout.svelte b/src/routes/__layout.svelte index b6ad7f7..70a6f9d 100644 --- a/src/routes/__layout.svelte +++ b/src/routes/__layout.svelte @@ -137,13 +137,6 @@ ) { count { id } } - countTotalPhotosByLocation: photo_aggregated ( - groupBy: "location", - filter: { status: { _eq: "published" }}, - ) { - group - count { id } - } countLocations: location_aggregated ( filter: { status: { _eq: "published" }}, ) { @@ -156,32 +149,8 @@ `) const { data } = res - - // Filter continents with linked countries const filteredContinents = data.continents.filter((cont: any) => cont.countries.length) - /** - * For each photos count, find the country and add the sum to it - */ - // Add count key - data.countries.forEach((country: any) => country.count = 0) - - // Loop through totals by location - data.countTotalPhotosByLocation.forEach(({ group, count }: { group: { location: number }, count: { id: number }}) => { - const locationId = group.location - const photosCount = Number(count.id) - const countryIndex = data.countries.findIndex((country: any) => { - // Find the location of a country - return country.locations.find((location: any) => { - // Match the count location ID to the country location ID - return Number(location.id) === locationId - }) - }) - - // Increment the count value found above - data.countries[countryIndex].count += photosCount - }) - return { props: { data: {