From 35410e25d223945a420e24a7896c97feedd22890 Mon Sep 17 00:00:00 2001 From: James Grugett Date: Tue, 1 Mar 2022 21:07:22 -0800 Subject: [PATCH] Fix to actually show investment instead of current value. And subtract bet amount from current value. --- web/components/bets-list.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/web/components/bets-list.tsx b/web/components/bets-list.tsx index fff0975e..7c6e5ffe 100644 --- a/web/components/bets-list.tsx +++ b/web/components/bets-list.tsx @@ -82,7 +82,8 @@ export function BetsList(props: { user: User }) { if (bet.isSold || bet.sale) return 0 const contract = contracts.find((c) => c.id === contractId) - return contract ? calculatePayout(contract, bet, 'MKT') : 0 + const payout = contract ? calculatePayout(contract, bet, 'MKT') : 0 + return payout - (bet.loanAmount ?? 0) }) } ) @@ -137,7 +138,7 @@ export function BetsList(props: { user: User }) {
Invested
- {formatMoney(currentBetsValue)}{' '} + {formatMoney(currentInvestment)}{' '}