Skip to content

Commit d339f6a

Browse files
committed
Backend: fallback for unset lastSent in email notification object
1 parent 91c026f commit d339f6a

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

apps/backend/routes/internal/processScheduledAuditEmails.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,8 @@ 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-
console.log("Last sent from DB", email.lastSent);
7069
const rawLastSent = DateTime.fromISO(email.lastSent);
71-
const lastSent = rawLastSent < emailEnabledDate ? emailEnabledDate : rawLastSent;
72-
console.log("Last Sent:", lastSent);
70+
const lastSent = (rawLastSent < emailEnabledDate) || !rawLastSent ? emailEnabledDate : rawLastSent;
7371
let intervalDays = null;
7472
switch (email.frequency.toLowerCase()) {
7573
case "daily":

0 commit comments

Comments
 (0)