diff --git a/openedx/features/sdaia_features/course_progress/signals.py b/openedx/features/sdaia_features/course_progress/signals.py index b3a9bd66fa9..f24eb6c87db 100644 --- a/openedx/features/sdaia_features/course_progress/signals.py +++ b/openedx/features/sdaia_features/course_progress/signals.py @@ -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") diff --git a/openedx/features/sdaia_features/course_progress/tasks.py b/openedx/features/sdaia_features/course_progress/tasks.py index 766096f7078..75ef14a21d8 100644 --- a/openedx/features/sdaia_features/course_progress/tasks.py +++ b/openedx/features/sdaia_features/course_progress/tasks.py @@ -70,7 +70,8 @@ def send_user_course_progress_email(current_progress, progress_last_email_sent_a 'PLATFORM_NAME', settings.PLATFORM_NAME ) - + logger.info(f'\n\n Last email was sent at: {progress_last_email_sent_at} \n\n') + logger.info(f'\n\n User current progress is: {current_progress} and has crossed milestone of {course_completion_percentages_for_email} \n\n') context={ 'current_progress': int(current_progress), 'progress_milestone_crossed': progress_last_email_sent_at,