Skip to content

Commit

Permalink
only send one progress email on crossing multiple milestones
Browse files Browse the repository at this point in the history
  • Loading branch information
Muhammad Faraz Maqsood authored and Muhammad Faraz Maqsood committed Mar 6, 2024
1 parent 65a3ad3 commit ec403b0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion openedx/features/sdaia_features/course_progress/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,12 @@ def send_course_progress_milestones_achievement_emails(**kwargs):
user_completion_percentage = get_user_course_progress(user, course_key)

if user_completion_percentage > progress_last_email_sent_at:
percentage_crossed = 0
for course_completion_percentages_for_email in course_completion_percentages_for_emails:
if user_completion_percentage >= course_completion_percentages_for_email > progress_last_email_sent_at:
send_user_course_progress_email.delay(user_completion_percentage, progress_last_email_sent_at, course_completion_percentages_for_email, str(course_key), user_id)
percentage_crossed = course_completion_percentages_for_email
if percentage_crossed > 0:
send_user_course_progress_email.delay(user_completion_percentage, progress_last_email_sent_at, percentage_crossed, str(course_key), user_id)


@receiver(COURSE_GRADE_NOW_PASSED, dispatch_uid="course_completion")
Expand Down

0 comments on commit ec403b0

Please sign in to comment.