Skip to content

Commit 044fb51

Browse files
claudfuenclaude
andcommitted
fix: also exclude orgs without access or onboarding from weekly digest
Adds hasAccess and onboardingCompleted filters alongside the 90-day session check. This excludes ~4,087 orgs (831 ghost + 3,256 churned) from receiving weekly digest emails. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent df38287 commit 044fb51

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

apps/app/src/trigger/tasks/task/weekly-task-reminder.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,12 @@ export const weeklyTaskReminder = schedules.task({
1414
const inactivityCutoff = new Date();
1515
inactivityCutoff.setDate(inactivityCutoff.getDate() - ORG_INACTIVITY_DAYS);
1616

17-
// Get all organizations that have at least one session updated in the last 90 days
17+
// Only email orgs that are active: have access, completed onboarding,
18+
// and at least one member logged in within the last 90 days
1819
const organizations = await db.organization.findMany({
1920
where: {
21+
hasAccess: true,
22+
onboardingCompleted: true,
2023
members: {
2124
some: {
2225
user: {

0 commit comments

Comments
 (0)