Skip to content

Commit 6ae5302

Browse files
committed
Backend: more tweaks to lastSent email fallback
1 parent 863e211 commit 6ae5302

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

apps/backend/routes/internal/processScheduledAuditEmails.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ export const processScheduledAuditEmails = async () => {
6666
subscriptionsCount++;
6767
// Ignore stale lastSent dates from before emails were enabled in prod
6868
const emailEnabledDate = DateTime.fromISO("2026-02-19T00:00:00.000Z");
69-
const rawLastSent = DateTime.fromISO(email.lastSent);
69+
const rawLastSent = email.lastSent ? DateTime.fromISO(email.lastSent) : emailEnabledDate;
7070
console.log(rawLastSent);
71-
const lastSent = (rawLastSent < emailEnabledDate) || !rawLastSent ? emailEnabledDate : rawLastSent;
71+
const lastSent = (rawLastSent < emailEnabledDate) ? emailEnabledDate : rawLastSent;
7272
let intervalDays = null;
7373
switch (email.frequency.toLowerCase()) {
7474
case "daily":

0 commit comments

Comments
 (0)