From a525ad82ecc293640726ad570fc73ff9b406f900 Mon Sep 17 00:00:00 2001 From: James Grugett Date: Thu, 21 Apr 2022 18:32:43 -0500 Subject: [PATCH] Filter out markets you sold out of from most of the views on portfolio page. --- web/components/bets-list.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/web/components/bets-list.tsx b/web/components/bets-list.tsx index 63cbfd57..35d7a08e 100644 --- a/web/components/bets-list.tsx +++ b/web/components/bets-list.tsx @@ -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 (