From e0989bdfde1b9ea53a40fbd99c062832f137e516 Mon Sep 17 00:00:00 2001 From: James Grugett Date: Thu, 17 Mar 2022 12:04:44 -0500 Subject: [PATCH] Fix loan amount label to account for sales. --- web/components/bets-list.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/web/components/bets-list.tsx b/web/components/bets-list.tsx index 388e3ad4..f9c72ce4 100644 --- a/web/components/bets-list.tsx +++ b/web/components/bets-list.tsx @@ -437,7 +437,10 @@ export function ContractBetsTable(props: { -0.5 * _.sumBy(redemptions, (b) => b.shares) ) - const amountLoaned = _.sumBy(bets, (bet) => bet.loanAmount ?? 0) + const amountLoaned = _.sumBy( + bets.filter((bet) => !bet.isSold && !bet.sale), + (bet) => bet.loanAmount ?? 0 + ) const { isResolved, mechanism } = contract const isCPMM = mechanism === 'cpmm-1'