Fix hiding answers where all bets sold

This commit is contained in:
James Grugett 2022-02-22 14:12:49 -06:00
parent 858ce10b49
commit 8fe9f23d91

View File

@ -15,11 +15,13 @@ import { AnswerResolvePanel } from './answer-resolve-panel'
export function AnswersPanel(props: { contract: Contract; answers: Answer[] }) { export function AnswersPanel(props: { contract: Contract; answers: Answer[] }) {
const { contract } = props const { contract } = props
const { creatorId, resolution, resolutions, pool } = contract const { creatorId, resolution, resolutions, totalBets } = contract
const answers = useAnswers(contract.id) ?? props.answers const answers = useAnswers(contract.id) ?? props.answers
const [winningAnswers, otherAnswers] = _.partition( const [winningAnswers, otherAnswers] = _.partition(
answers.filter((answer) => answer.id !== '0' && pool[answer.id] > 0), answers.filter(
(answer) => answer.id !== '0' && totalBets[answer.id] > 0.000000001
),
(answer) => (answer) =>
answer.id === resolution || (resolutions && resolutions[answer.id]) answer.id === resolution || (resolutions && resolutions[answer.id])
) )