Fix to actually show investment instead of current value. And subtract bet amount from current value.

This commit is contained in:
James Grugett 2022-03-01 21:07:22 -08:00
parent 985cdd2537
commit 1dd078562a

View File

@ -82,7 +82,8 @@ export function BetsList(props: { user: User }) {
if (bet.isSold || bet.sale) return 0 if (bet.isSold || bet.sale) return 0
const contract = contracts.find((c) => c.id === contractId) 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 }) {
<Col> <Col>
<div className="text-sm text-gray-500">Invested</div> <div className="text-sm text-gray-500">Invested</div>
<div className="text-lg"> <div className="text-lg">
{formatMoney(currentBetsValue)}{' '} {formatMoney(currentInvestment)}{' '}
<ProfitBadge profitPercent={investedProfit} /> <ProfitBadge profitPercent={investedProfit} />
</div> </div>
</Col> </Col>