From 932979656a7d85002612a4ff72ab11c8dc5d43f6 Mon Sep 17 00:00:00 2001 From: themrrobert <10122432+themrrobert@users.noreply.github.com> Date: Thu, 13 Jun 2024 02:18:11 -0700 Subject: [PATCH] bug fixes --- src/lib/analytics.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/lib/analytics.ts b/src/lib/analytics.ts index eb8feca84c..d43aead457 100644 --- a/src/lib/analytics.ts +++ b/src/lib/analytics.ts @@ -54,12 +54,12 @@ export async function analyticsTick() { const [totalGeGp, totalArtifactGp, totalDemonStatuetteGp] = ( await Promise.all( [ - 'SELECT quantity AS ge_gp FROM ge_bank WHERE item_id = 995', - `SELECT SUM((bank->>'${artifact.id})::bigint) * ${artifact.highalch} as artifact_val`, - `SELECT SUM((bank->>'${statuette.id})::bigint) * ${statuette.highalch} as statuette_val` - ].map(q => prisma.$queryRawUnsafe(q)) + 'SELECT quantity AS val FROM ge_bank WHERE item_id = 995', + `SELECT COALESCE(SUM((bank->>'${artifact.id}')::bigint) * ${artifact.highalch}, 0) as val FROM users WHERE bank->>'${artifact.id}' IS NOT NULL`, + `SELECT COALESCE(SUM((bank->>'${statuette.id}')::bigint) * ${statuette.highalch}, 0) as val FROM users WHERE bank->>'${artifact.id}' IS NOT NULL` + ].map(q => prisma.$queryRawUnsafe<{ val: bigint }[]>(q)) ) - ).map((v: string) => BigInt(v)); + ).map((v: { val: bigint }[]) => BigInt(v[0].val)); const taskCounts = await calculateMinionTaskCounts(); const currentClientSettings = await prisma.clientStorage.findFirst({