@@ -314,6 +314,8 @@ def send_users_digest_email(dry_run=False):
314314 user_id = group ['user_id' ]
315315 notification_ids = [msg ['notification_id' ] for msg in group ['info' ]]
316316 if not dry_run :
317+ notifications_qs = Notification .objects .filter (id__in = notification_ids )
318+ notifications_qs .update (scheduled = True )
317319 send_user_email_task .delay (user_id , notification_ids )
318320
319321@celery_app .task (name = 'notifications.tasks.send_moderators_digest_email' )
@@ -334,6 +336,8 @@ def send_moderators_digest_email(dry_run=False):
334336 provider_content_type_id = group ['provider_content_type_id' ]
335337 notification_ids = [msg ['notification_id' ] for msg in group ['info' ]]
336338 if not dry_run :
339+ notifications_qs = Notification .objects .filter (id__in = notification_ids )
340+ notifications_qs .update (scheduled = True )
337341 send_moderator_email_task .delay (user_id , notification_ids , provider_content_type_id , provider_id )
338342
339343def get_moderators_emails (message_freq : str ):
@@ -358,6 +362,7 @@ def get_moderators_emails(message_freq: str):
358362 INNER JOIN osf_notificationtype AS nt ON ns.notification_type_id = nt.id
359363 LEFT JOIN osf_guid ON ns.user_id = osf_guid.object_id
360364 WHERE n.sent IS NULL
365+ AND n.scheduled = FALSE
361366 AND ns.message_frequency = %s
362367 AND nt.name IN (%s, %s)
363368 AND nt.name NOT IN (%s, %s, %s)
@@ -401,6 +406,7 @@ def get_users_emails(message_freq):
401406 INNER JOIN osf_notificationtype AS nt ON ns.notification_type_id = nt.id
402407 LEFT JOIN osf_guid ON ns.user_id = osf_guid.object_id
403408 WHERE n.sent IS NULL
409+ AND n.scheduled = FALSE
404410 AND ns.message_frequency = %s
405411 AND nt.name NOT IN (%s, %s, %s, %s, %s)
406412 AND osf_guid.content_type_id = (
0 commit comments