Tweak current value calculation

This commit is contained in:
James Grugett 2022-04-03 11:18:31 -05:00
parent 6b2f6f7185
commit 1b9a38ff66

View File

@ -80,13 +80,13 @@ export function BetsList(props: { user: User }) {
contractBets, contractBets,
(bets, contractId) => { (bets, contractId) => {
return _.sumBy(bets, (bet) => { return _.sumBy(bets, (bet) => {
if (bet.isSold || bet.sale || bet.isRedemption) return 0
const contract = contractsById[contractId] const contract = contractsById[contractId]
if (contract.resolution) if (!contract) return 0
return calculatePayout(contract, bet, contract.resolution) if (bet.isSold || bet.sale) return 0
return contract ? calculatePayout(contract, bet, 'MKT') : 0 return contract.resolution
? calculatePayout(contract, bet, contract.resolution)
: calculatePayout(contract, bet, 'MKT')
}) })
} }
) )