Fix limit bet filter to exclude cancelled and filled bets

This commit is contained in:
James Grugett 2022-07-10 22:28:29 -05:00
parent 89d48d6c34
commit 098f20ccad

View File

@ -132,7 +132,9 @@ export function BetsList(props: {
if (filter === 'sold') return !hasShares if (filter === 'sold') return !hasShares
if (filter === 'limit_bet') if (filter === 'limit_bet')
return (contractBets[c.id] ?? []).some((b) => b.limitProb !== undefined) return (contractBets[c.id] ?? []).some(
(b) => b.limitProb !== undefined && !b.isCancelled && !b.isFilled
)
return hasShares return hasShares
}) })
const displayedContracts = filteredContracts.slice(start, end) const displayedContracts = filteredContracts.slice(start, end)
@ -262,7 +264,7 @@ function ContractBets(props: {
const { resolution, outcomeType } = contract const { resolution, outcomeType } = contract
const limitBets = bets.filter( const limitBets = bets.filter(
(bet) => bet.limitProb !== undefined (bet) => bet.limitProb !== undefined && !bet.isCancelled && !bet.isFilled
) as LimitBet[] ) as LimitBet[]
const resolutionValue = (contract as NumericContract).resolutionValue const resolutionValue = (contract as NumericContract).resolutionValue