Skip to content

Conversation

@uxairibrar
Copy link
Collaborator

@uxairibrar uxairibrar commented Feb 13, 2025

Closes #42

  • Created SentEmailLog model to store sent email details.
  • Updated send_monthly_email() to log sent emails and handle missing manuscripts
  • Added a Django Admin action to trigger email sending manually
  • Updated test cases to check both scenarios (email sent vs. no email sent)
  • Implemented email scheduling using Django Q with a manual admin trigger.

Copy link
Member

@nuest nuest left a comment

Choose a reason for hiding this comment

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

This is a very good first iteration and only be reading your code came important requirements/features to mind. Good work!


def send_monthly_email(sent_by=None):
recipients = User.objects.values_list('email', flat=True)
last_month = now().replace(day=1) - timedelta(days=1) # Get last month's last day
Copy link
Member

Choose a reason for hiding this comment

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

Neat!

'publications.tasks.send_monthly_email',
schedule_type='MONTHLY',
repeats=-1,
next_run=datetime.now().replace(day=28, hour=23, minute=59)
Copy link
Member

Choose a reason for hiding this comment

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

Is next_run here setting up the first execution? I'm a bit worried about the 28 in there... does that work for all months?

@nuest nuest changed the title Send emails for new manuscripts 42 Send emails for new manuscripts Feb 21, 2025
@nuest nuest merged commit 69dbaa5 into main Mar 13, 2025
1 check failed
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.

Send emails for new manuscripts

3 participants