Skip to content

Commit

Permalink
fix: issue #407
Browse files Browse the repository at this point in the history
  • Loading branch information
whtsupbab3 committed Dec 11, 2024
1 parent 7836e21 commit da924d2
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/components/bounty/BountyClaims.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,16 @@ export default function BountyClaims({ bountyId }: { bountyId: string }) {
}
);

const bountyClaimsCount = trpc.bountyClaimsCount.useQuery(
{
bountyId: Number(bountyId),
chainId: chain.id,
},
{
enabled: !!bountyId,
}
);

const { data: votingClaim } = trpc.claim.useQuery(
{
claimId: Number(votingClaimId),
Expand Down Expand Up @@ -63,13 +73,7 @@ export default function BountyClaims({ bountyId }: { bountyId: string }) {
<div>
<div className='flex flex-col gap-x-2 py-4 border-b border-dashed'>
<div>
<span>
{claims.data?.pages.reduce(
(acc, curr) => acc + curr.items.length,
0
)}{' '}
claims
</span>
<span>{Number(bountyClaimsCount.data) || 0} claims</span>
</div>
</div>
{claims.data && (
Expand Down
19 changes: 19 additions & 0 deletions src/trpc/routers/_app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,25 @@ export const appRouter = createTRPCRouter({
};
}),

bountyClaimsCount: baseProcedure
.input(
z.object({
bountyId: z.number(),
chainId: z.number(),
})
)
.query(async ({ input }) => {
return await prisma.claims.count({
where: {
bounty_id: input.bountyId,
chain_id: input.chainId,
ban: {
none: {},
},
},
});
}),

claim: baseProcedure
.input(z.object({ claimId: z.number(), chainId: z.number() }))
.query(async ({ input }) => {
Expand Down

0 comments on commit da924d2

Please sign in to comment.