Filter out answers with 0 dollars

This commit is contained in:
James Grugett 2022-02-20 17:19:45 -06:00
parent f5ab60b2df
commit 20a3966820

View File

@ -15,11 +15,11 @@ 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 } = contract const { creatorId, resolution, resolutions, pool } = 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'), answers.filter((answer) => answer.id !== '0' && pool[answer.id] > 0),
(answer) => (answer) =>
answer.id === resolution || (resolutions && resolutions[answer.id]) answer.id === resolution || (resolutions && resolutions[answer.id])
) )