From 4097082c7576976b161199d6954423a4492366d1 Mon Sep 17 00:00:00 2001 From: James Grugett Date: Thu, 13 Oct 2022 23:29:57 -0500 Subject: [PATCH] Dynamically choose outcome in Position tooltip (#1048) --- web/components/bet-summary.tsx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/web/components/bet-summary.tsx b/web/components/bet-summary.tsx index aa64da43..4dc39823 100644 --- a/web/components/bet-summary.tsx +++ b/web/components/bet-summary.tsx @@ -25,10 +25,8 @@ export function BetsSummary(props: { const isBinary = outcomeType === 'BINARY' const bets = props.userBets.filter((b) => !b.isAnte) - const { profitPercent, payout, profit, invested } = getContractBetMetrics( - contract, - bets - ) + const { profitPercent, payout, profit, invested, hasShares } = + getContractBetMetrics(contract, bets) const excludeSales = bets.filter((b) => !b.isSold && !b.sale) const yesWinnings = sumBy(excludeSales, (bet) => @@ -39,6 +37,7 @@ export function BetsSummary(props: { ) const position = yesWinnings - noWinnings + const outcome = hasShares ? (position > 0 ? 'YES' : 'NO') : undefined const prob = isBinary ? getProbability(contract) : 0 const expectation = prob * yesWinnings + (1 - prob) * noWinnings @@ -60,7 +59,9 @@ export function BetsSummary(props: {
Position{' '} - +
{position > 1e-7 ? (