Skip to content

[ENG-11764] Filter, order, skip user by activity, registration date and spam status#11815

Open
antkryt wants to merge 2 commits into
CenterForOpenScience:feature/project-enterfrom
antkryt:feature/ENG-11764
Open

[ENG-11764] Filter, order, skip user by activity, registration date and spam status#11815
antkryt wants to merge 2 commits into
CenterForOpenScience:feature/project-enterfrom
antkryt:feature/ENG-11764

Conversation

@antkryt

@antkryt antkryt commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Ticket

Purpose

Sort recipients by activity priority

Changes

Side Effects

QE Notes

CE Notes

Documentation

@cslzchen cslzchen left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥

Comment thread osf/email/notification_campaign.py Outdated
qs = filter_users(filters, campaign_id, restart_failed=restart_failed)

qs = qs.annotate(activity_total=Coalesce(Subquery(counter_subquery), 0)).order_by('-activity_total', '-date_registered', '-id')
is_spam = Q(spam_status=SpamStatus.SPAM)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Include SpamStatus.FLAGGED

Comment thread osf/email/notification_campaign.py Outdated
activity_total=Coalesce(Subquery(counter_subquery), 0),
).annotate(
activity_priority=Case(
When(~is_spam & Q(activity_total__gte=ACTIVITY_ACTIVE_THRESHOLD), then=Value(ActivityPriority.ACTIVE)),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TBD: non-spam (active + non-spam inactive) vs only active users

Comment thread osf/email/notification_campaign.py Outdated
Comment on lines +16 to +17
ACTIVITY_ACTIVE_THRESHOLD = 5000
ACTIVITY_SPAM_THRESHOLD = 100000

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move thresholds to metadata configurable from admin and set default value in settings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants