Merge branch 'main' of https://github.com/manticmarkets/mantic
This commit is contained in:
commit
1c74afd741
|
@ -11,7 +11,7 @@ import {
|
|||
XIcon,
|
||||
} from '@heroicons/react/solid'
|
||||
import { useBets } from '../hooks/use-bets'
|
||||
import { Bet } from '../lib/firebase/bets'
|
||||
import { Bet, withoutAnteBets } from '../lib/firebase/bets'
|
||||
import { Comment, mapCommentsByBetId } from '../lib/firebase/comments'
|
||||
import dayjs from 'dayjs'
|
||||
import relativeTime from 'dayjs/plugin/relativeTime'
|
||||
|
@ -479,6 +479,7 @@ export function ContractFeed(props: {
|
|||
|
||||
let bets = useBets(id)
|
||||
if (bets === 'loading') bets = []
|
||||
bets = withoutAnteBets(contract, bets)
|
||||
|
||||
let comments = useComments(id)
|
||||
if (comments === 'loading') comments = []
|
||||
|
|
|
@ -4,6 +4,7 @@ import dayjs from 'dayjs'
|
|||
import { getProbability } from '../../common/calculate'
|
||||
import { useBets } from '../hooks/use-bets'
|
||||
import { useWindowSize } from '../hooks/use-window-size'
|
||||
import { withoutAnteBets } from '../lib/firebase/bets'
|
||||
import { Contract } from '../lib/firebase/contracts'
|
||||
|
||||
export function ContractProbGraph(props: { contract: Contract }) {
|
||||
|
@ -12,6 +13,7 @@ export function ContractProbGraph(props: { contract: Contract }) {
|
|||
|
||||
let bets = useBets(id)
|
||||
if (bets === 'loading') bets = []
|
||||
bets = withoutAnteBets(contract, bets)
|
||||
|
||||
const startProb = getProbability(phantomShares)
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ import _ from 'lodash'
|
|||
|
||||
import { db } from './init'
|
||||
import { Bet } from '../../../common/bet'
|
||||
import { Contract } from '../../../common/contract'
|
||||
export type { Bet }
|
||||
|
||||
function getBetsCollection(contractId: string) {
|
||||
|
@ -43,3 +44,17 @@ export function listenForUserBets(
|
|||
setBets(bets)
|
||||
})
|
||||
}
|
||||
|
||||
export function withoutAnteBets(contract: Contract, bets: Bet[]) {
|
||||
const { createdTime } = contract
|
||||
|
||||
if (
|
||||
bets.length >= 2 &&
|
||||
bets[0].createdTime === createdTime &&
|
||||
bets[1].createdTime === createdTime
|
||||
) {
|
||||
return bets.slice(2)
|
||||
}
|
||||
|
||||
return bets
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user