Don't show resolved markets in hot markets
This commit is contained in:
parent
34b208f63d
commit
6d4554e9ef
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -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 ? (
|
||||
<Markets contracts={contracts} hotContractIds={hotContractIds} />
|
||||
|
|
|
@ -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 (
|
||||
<Page>
|
||||
|
|
Loading…
Reference in New Issue
Block a user