From be82406c4de01f1941672084f4810114eaf53cb4 Mon Sep 17 00:00:00 2001 From: jahooma Date: Sat, 22 Jan 2022 11:50:05 -0600 Subject: [PATCH] Include older contracts in fold feed --- web/pages/activity.tsx | 5 +++-- web/pages/fold/[foldSlug]/index.tsx | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/web/pages/activity.tsx b/web/pages/activity.tsx index 319dde6c..1934f0af 100644 --- a/web/pages/activity.tsx +++ b/web/pages/activity.tsx @@ -26,7 +26,8 @@ function lastActivityTime(contract: Contract) { // - Market resolved export function findActiveContracts( allContracts: Contract[], - recentComments: Comment[] + recentComments: Comment[], + daysAgo = 3 ) { const idToActivityTime = new Map() function record(contractId: string, time: number) { @@ -40,7 +41,7 @@ export function findActiveContracts( // Find contracts with activity in the last 3 days const DAY_IN_MS = 24 * 60 * 60 * 1000 for (const contract of allContracts || []) { - if (lastActivityTime(contract) > Date.now() - 3 * DAY_IN_MS) { + if (lastActivityTime(contract) > Date.now() - daysAgo * DAY_IN_MS) { contracts.push(contract) record(contract.id, lastActivityTime(contract)) } diff --git a/web/pages/fold/[foldSlug]/index.tsx b/web/pages/fold/[foldSlug]/index.tsx index 647000e8..515f2841 100644 --- a/web/pages/fold/[foldSlug]/index.tsx +++ b/web/pages/fold/[foldSlug]/index.tsx @@ -34,7 +34,8 @@ export async function getStaticProps(props: { params: { foldSlug: string } }) { const activeContracts = findActiveContracts( contracts, - _.flatten(contractComments) + _.flatten(contractComments), + 365 ) const activeContractBets = await Promise.all( activeContracts.map((contract) => listAllBets(contract.id))