Show unresolved markets first in fold

This commit is contained in:
jahooma 2022-01-23 23:55:48 -06:00
parent bc3e43802b
commit 0e3e4b8192

View File

@ -33,11 +33,17 @@ export async function getStaticProps(props: { params: { foldSlug: string } }) {
contracts.map((contract) => listAllComments(contract.id).catch((_) => [])) contracts.map((contract) => listAllComments(contract.id).catch((_) => []))
) )
const activeContracts = findActiveContracts( let activeContracts = findActiveContracts(
contracts, contracts,
_.flatten(contractComments), _.flatten(contractComments),
365 365
) )
const [resolved, unresolved] = _.partition(
activeContracts,
({ isResolved }) => isResolved
)
activeContracts = [...unresolved, ...resolved]
const activeContractBets = await Promise.all( const activeContractBets = await Promise.all(
activeContracts.map((contract) => listAllBets(contract.id).catch((_) => [])) activeContracts.map((contract) => listAllBets(contract.id).catch((_) => []))
) )