Add logs to weekly emails

This commit is contained in:
Ian Philips 2022-08-22 14:59:11 -06:00
parent 571cf80e13
commit b9a667b126

View File

@ -39,6 +39,11 @@ async function sendTrendingMarketsEmailsToAllUsers() {
const privateUsersToSendEmailsTo = privateUsers.filter((user) => {
return !user.unsubscribedFromWeeklyTrendingEmails
})
log(
'Sending weekly trending emails to',
privateUsersToSendEmailsTo.length,
'users'
)
const trendingContracts = (await getTrendingContracts())
.filter(
(contract) =>
@ -48,6 +53,10 @@ async function sendTrendingMarketsEmailsToAllUsers() {
) && (contract?.closeTime ?? 0) > Date.now() + DAY_MS
)
.slice(0, 20)
log(
`Found ${trendingContracts.length} trending contracts:\n`,
trendingContracts.map((c) => c.question).join('\n ')
)
for (const privateUser of privateUsersToSendEmailsTo) {
if (!privateUser.email) {
log(`No email for ${privateUser.username}`)