Skip to content

Conversation

@Akanshu-2u
Copy link

Description:

User retirement failed when CourseOverview records were missing, causing CourseOverview.DoesNotExist exceptions in bulk email signal handler.

Solution:

Added exception handling in force_optout_all signal handler:

  • Added CourseOverview import
  • Wrapped Optout.objects.get_or_create() in try/except block
  • Log warning and skip enrollment when CourseOverview is missing

Private JIRA Link:

BOMS-370

Copilot AI review requested due to automatic review settings January 7, 2026 10:22
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds exception handling to prevent user retirement failures when CourseOverview records are missing for enrollments. The fix wraps the optout creation logic in a try-except block to catch and log CourseOverview.DoesNotExist exceptions, allowing the retirement process to continue by skipping problematic enrollments.

Key changes:

  • Added exception handling in force_optout_all signal handler to gracefully handle missing CourseOverview records
  • Added CourseOverview import for exception handling
  • Added warning log message when CourseOverview is not found

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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