From c0be02a2eddd5006ad38a5cc8e5b04a9edc59504 Mon Sep 17 00:00:00 2001 From: LukasDeco Date: Fri, 2 Aug 2024 22:32:24 -0600 Subject: [PATCH] fix: bugs with top traders --- lib/client/indexer/user.ts | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/lib/client/indexer/user.ts b/lib/client/indexer/user.ts index b799dc5..8bd6e32 100644 --- a/lib/client/indexer/user.ts +++ b/lib/client/indexer/user.ts @@ -416,6 +416,18 @@ export class FutarchyIndexerUserClient implements FutarchyUserClient { } async fetchTopTraders(daoSlug: string | null): Promise { + const userPerformanceWhere = daoSlug + ? { + proposal: { + dao: { + dao_detail: { + slug: { _eq: daoSlug } + } + } + } + } + : undefined; + const { users } = await this.graphqlClient.query({ users: { __args: { @@ -428,10 +440,16 @@ export class FutarchyIndexerUserClient implements FutarchyUserClient { } } } - ] + ], + where: { + user_performances: userPerformanceWhere + } }, user_acct: true, user_performances_aggregate: { + __args: { + where: userPerformanceWhere + }, aggregate: { sum: { total_volume: true