diff --git a/web/lib/firebase/contracts.ts b/web/lib/firebase/contracts.ts index 4300a2db..4ce20dbe 100644 --- a/web/lib/firebase/contracts.ts +++ b/web/lib/firebase/contracts.ts @@ -146,7 +146,7 @@ export function computeHotContracts(recentBets: Bet[]) { const contractBets = _.groupBy(recentBets, (bet) => bet.contractId) const hotContractIds = _.sortBy(Object.keys(contractBets), (contractId) => _.sumBy(contractBets[contractId], (bet) => -1 * bet.amount) - ).slice(0, 4) + ) return hotContractIds } diff --git a/web/pages/index.tsx b/web/pages/index.tsx index 7896adc7..c16bb68b 100644 --- a/web/pages/index.tsx +++ b/web/pages/index.tsx @@ -32,9 +32,10 @@ const Home = (props: { contracts: Contract[]; hotContractIds: string[] }) => { if (user === undefined) return <> const { contracts, hotContractIds } = props - const hotContracts = hotContractIds.map( - (id) => contracts.find((contract) => contract.id === id) as Contract - ) + const hotContracts = hotContractIds + .map((id) => contracts.find((contract) => contract.id === id) as Contract) + .filter((contract) => !contract.isResolved) + .slice(0, 4) return user ? ( diff --git a/web/pages/markets.tsx b/web/pages/markets.tsx index f28c493d..6aa30cd0 100644 --- a/web/pages/markets.tsx +++ b/web/pages/markets.tsx @@ -39,10 +39,13 @@ export default function Markets(props: { hotContractIds === 'loading' ? props.hotContractIds : hotContractIds const readyContracts = contracts === 'loading' ? props.contracts : contracts - const hotContracts = readyHotContractIds.map( - (hotId) => - _.find(readyContracts, (contract) => contract.id === hotId) as Contract - ) + const hotContracts = readyHotContractIds + .map( + (hotId) => + _.find(readyContracts, (contract) => contract.id === hotId) as Contract + ) + .filter((contract) => !contract.isResolved) + .slice(0, 4) return (