From 0e3e4b8192a6a05466959c18f171cbd46ce0c583 Mon Sep 17 00:00:00 2001 From: jahooma Date: Sun, 23 Jan 2022 23:55:48 -0600 Subject: [PATCH] Show unresolved markets first in fold --- web/pages/fold/[foldSlug]/index.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/web/pages/fold/[foldSlug]/index.tsx b/web/pages/fold/[foldSlug]/index.tsx index 002ad151..593a8199 100644 --- a/web/pages/fold/[foldSlug]/index.tsx +++ b/web/pages/fold/[foldSlug]/index.tsx @@ -33,11 +33,17 @@ export async function getStaticProps(props: { params: { foldSlug: string } }) { contracts.map((contract) => listAllComments(contract.id).catch((_) => [])) ) - const activeContracts = findActiveContracts( + let activeContracts = findActiveContracts( contracts, _.flatten(contractComments), 365 ) + const [resolved, unresolved] = _.partition( + activeContracts, + ({ isResolved }) => isResolved + ) + activeContracts = [...unresolved, ...resolved] + const activeContractBets = await Promise.all( activeContracts.map((contract) => listAllBets(contract.id).catch((_) => [])) )