From 60d75397ff6d6508e68e8cbdfbf203e083d5146c Mon Sep 17 00:00:00 2001 From: secondl1ght Date: Sat, 9 Dec 2023 22:22:47 -0700 Subject: [PATCH] fix edge case comm ticket total --- src/routes/community/[area]/+page.svelte | 25 ++++++++++++------------ 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/src/routes/community/[area]/+page.svelte b/src/routes/community/[area]/+page.svelte index c66c6119..5e7b7baf 100644 --- a/src/routes/community/[area]/+page.svelte +++ b/src/routes/community/[area]/+page.svelte @@ -79,25 +79,24 @@ let showType = 'Add'; const tickets = data.tickets; - const totalTickets = tickets.length; const ticketError = tickets === 'error' ? true : false; $: ticketError && errToast('Could not load open tickets, please try again or contact BTC Map.'); const add = - tickets && - tickets.length && - !ticketError && - tickets.filter((issue: any) => - issue.labels.find((label: any) => label.name === 'location-submission') - ); + tickets && tickets.length && !ticketError + ? tickets.filter((issue: any) => + issue.labels.find((label: any) => label.name === 'location-submission') + ) + : []; const verify = - tickets && - tickets.length && - !ticketError && - tickets.filter((issue: any) => - issue.labels.find((label: any) => label.name === 'verify-submission') - ); + tickets && tickets.length && !ticketError + ? tickets.filter((issue: any) => + issue.labels.find((label: any) => label.name === 'verify-submission') + ) + : []; + + const totalTickets = add.length + verify.length; let avatar = community?.['icon:square']; let name = data.name;