Filter out markets you sold out of from most of the views on portfolio page.

This commit is contained in:
James Grugett 2022-04-21 18:32:43 -05:00
parent a7c422e69e
commit a525ad82ec

View File

@ -113,6 +113,13 @@ export function BetsList(props: { user: User }) {
const displayedContracts = _.sortBy(contracts, SORTS[sort])
.reverse()
.filter(FILTERS[filter])
.filter((c) => {
if (sort === 'profit') return true
// Filter out contracts where you don't have shares anymore.
const metrics = contractsMetrics[c.id]
return metrics.payout > 0
})
const [settled, unsettled] = _.partition(
contracts,
@ -226,11 +233,10 @@ function MyContractBets(props: {
const isBinary = outcomeType === 'BINARY'
const probPercent = getBinaryProbPercent(contract)
const { payout, profit, profitPercent } = getContractBetMetrics(
const { payout, profit, profitPercent, invested } = getContractBetMetrics(
contract,
bets
)
return (
<div
tabIndex={0}