Compare commits
1 Commits
main
...
comment-po
Author | SHA1 | Date | |
---|---|---|---|
|
cc55a10b19 |
|
@ -257,11 +257,6 @@ export function getTopAnswer(
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getLargestPosition(contract: Contract, userBets: Bet[]) {
|
export function getLargestPosition(contract: Contract, userBets: Bet[]) {
|
||||||
let yesFloorShares = 0,
|
|
||||||
yesShares = 0,
|
|
||||||
noShares = 0,
|
|
||||||
noFloorShares = 0
|
|
||||||
|
|
||||||
if (userBets.length === 0) {
|
if (userBets.length === 0) {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
@ -286,12 +281,10 @@ export function getLargestPosition(contract: Contract, userBets: Bet[]) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const [yesBets, noBets] = partition(userBets, (bet) => bet.outcome === 'YES')
|
const [yesBets, noBets] = partition(userBets, (bet) => bet.outcome === 'YES')
|
||||||
yesShares = sumBy(yesBets, (bet) => bet.shares)
|
const yesShares = sumBy(yesBets, (bet) => bet.shares)
|
||||||
noShares = sumBy(noBets, (bet) => bet.shares)
|
const noShares = sumBy(noBets, (bet) => bet.shares)
|
||||||
yesFloorShares = Math.floor(yesShares)
|
return {
|
||||||
noFloorShares = Math.floor(noShares)
|
shares: Math.abs(yesShares - noShares),
|
||||||
|
outcome: yesShares > noShares ? 'YES' : 'NO',
|
||||||
const shares = yesFloorShares || noFloorShares
|
}
|
||||||
const outcome = yesFloorShares > noFloorShares ? 'YES' : 'NO'
|
|
||||||
return { shares, outcome }
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -134,7 +134,7 @@ export function FeedComment(props: {
|
||||||
commenterPositionProb != null &&
|
commenterPositionProb != null &&
|
||||||
commenterPositionOutcome != null &&
|
commenterPositionOutcome != null &&
|
||||||
commenterPositionShares != null &&
|
commenterPositionShares != null &&
|
||||||
commenterPositionShares > 0 &&
|
Math.floor(commenterPositionShares) > 0 &&
|
||||||
contract.outcomeType !== 'NUMERIC' && (
|
contract.outcomeType !== 'NUMERIC' && (
|
||||||
<>
|
<>
|
||||||
{'is '}
|
{'is '}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user