From be3d4d77359eaea414f437a4d11d8620cc400e1e Mon Sep 17 00:00:00 2001 From: mantikoros Date: Thu, 19 May 2022 15:26:44 -0400 Subject: [PATCH] exclude antes from bets list --- web/components/bets-list.tsx | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/web/components/bets-list.tsx b/web/components/bets-list.tsx index 03c09ef0..24fa5934 100644 --- a/web/components/bets-list.tsx +++ b/web/components/bets-list.tsx @@ -330,16 +330,20 @@ export function MyBetsSummary(props: { bets: Bet[] className?: string }) { - const { bets, contract, className } = props + const { contract, className } = props const { resolution, outcomeType, mechanism } = contract const isBinary = outcomeType === 'BINARY' const isCpmm = mechanism === 'cpmm-1' - const excludeSales = bets.filter((b) => !b.isSold && !b.sale) - const yesWinnings = _.sumBy(excludeSales, (bet) => + const bets = props.bets.filter((b) => !b.isAnte) + + const excludeSalesAndAntes = bets.filter( + (b) => !b.isAnte && !b.isSold && !b.sale + ) + const yesWinnings = _.sumBy(excludeSalesAndAntes, (bet) => calculatePayout(contract, bet, 'YES') ) - const noWinnings = _.sumBy(excludeSales, (bet) => + const noWinnings = _.sumBy(excludeSalesAndAntes, (bet) => calculatePayout(contract, bet, 'NO') ) const { invested, profitPercent, payout, profit } = getContractBetMetrics( @@ -413,7 +417,9 @@ export function ContractBetsTable(props: { bets: Bet[] className?: string }) { - const { contract, bets, className } = props + const { contract, className } = props + + const bets = props.bets.filter((b) => !b.isAnte) const [sales, buys] = _.partition(bets, (bet) => bet.sale)