Slice the popular emails to the top 20

This commit is contained in:
Ian Philips 2022-08-19 14:45:04 -06:00
parent 36bfbe8f42
commit 634196d8f1

View File

@ -43,13 +43,15 @@ async function sendTrendingMarketsEmailsToAllUsers() {
const privateUsersToSendEmailsTo = privateUsers.filter((user) => {
return !user.unsubscribedFromWeeklyTrendingEmails
})
const trendingContracts = (await getTrendingContracts()).filter(
(contract) =>
!(
contract.question.toLowerCase().includes('trump') &&
contract.question.toLowerCase().includes('president')
) && (contract?.closeTime ?? 0) > Date.now() + DAY_MS
)
const trendingContracts = (await getTrendingContracts())
.filter(
(contract) =>
!(
contract.question.toLowerCase().includes('trump') &&
contract.question.toLowerCase().includes('president')
) && (contract?.closeTime ?? 0) > Date.now() + DAY_MS
)
.slice(0, 20)
for (const privateUser of privateUsersToSendEmailsTo) {
if (!privateUser.email) {
log(`No email for ${privateUser.username}`)