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 5d5a1860b5
commit 35410e25d2

View File

@ -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 }) {
<Col>
<div className="text-sm text-gray-500">Invested</div>
<div className="text-lg">
{formatMoney(currentBetsValue)}{' '}
{formatMoney(currentInvestment)}{' '}
<ProfitBadge profitPercent={investedProfit} />
</div>
</Col>