From 37fc69680e0b3fbe58dd653f205045bbc166cc27 Mon Sep 17 00:00:00 2001 From: nmemmert Date: Mon, 15 Jun 2026 07:56:56 -0400 Subject: [PATCH] Send study reminder emails 8 hours after lesson release Lessons release at 1:00 AM, but reminders fired immediately, landing around 9 PM the prior evening. Delay sends by 8 hours so they go out at 9:00 AM on the release day. --- server/study-helpers.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/server/study-helpers.js b/server/study-helpers.js index 67b4c5e..6ef2de4 100644 --- a/server/study-helpers.js +++ b/server/study-helpers.js @@ -638,12 +638,14 @@ export async function scheduleStudyReminders(sendStudyReminderEmail) { const sectionId = section.id const releaseDate = getSectionReleaseDate(section) if (!releaseDate) continue - if (releaseDate > now) continue + // Lessons release at 1:00 AM; reminder emails go out 8 hours later, at 9:00 AM the same day. + const sendDate = new Date(releaseDate.getTime() + 8 * 60 * 60 * 1000) + if (sendDate > now) continue const sentForStudy = Array.isArray(userSent[studySlug]) ? userSent[studySlug] : [] if (sentForStudy.includes(sectionId)) continue - const hoursSinceRelease = (now.getTime() - releaseDate.getTime()) / (1000 * 60 * 60) - if (hoursSinceRelease > 24) continue + const hoursSinceSend = (now.getTime() - sendDate.getTime()) / (1000 * 60 * 60) + if (hoursSinceSend > 24) continue const canonical = state.cachedSiteContent?.seo?.canonicalUrl || 'https://versebyversewithnate.us/' const base = canonical.endsWith('/') ? canonical.slice(0, -1) : canonical