Skip to content

Commit

Permalink
updated order direction
Browse files Browse the repository at this point in the history
  • Loading branch information
kevupton committed Oct 24, 2023
1 parent b3e7eb3 commit bc4cee2
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions queries/voting/useVotingResult.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ export const useVotingResult = (
query: gql`
query VoteResults {
voteResults(
orderBy: voteCount
orderDirection: desc
where: { contract: "${contractAddress?.toLowerCase()}", epochIndex: "${epoch}", voteCount_gt: "0" }
) {
id
Expand All @@ -53,12 +55,7 @@ export const useVotingResult = (
totalVotePower: BigNumber.from(voteResult.votePower),
voteCount: voteResult.voteCount,
epochIndex: voteResult.epochIndex,
}))
.sort((a: any, b: any) => {
if (a.totalVotePower.gt(b.totalVotePower)) return -1;
if (a.totalVotePower.lt(b.totalVotePower)) return 1;
return 0;
});
}));
},
{
enabled: governanceModules !== null && moduleInstance !== null && epochIndex !== undefined,
Expand Down

0 comments on commit bc4cee2

Please sign in to comment.