fix: Fixing the issue of deactivating user while seat allocation#215
Merged
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #215 +/- ##
==========================================
+ Coverage 86.44% 86.46% +0.01%
==========================================
Files 154 154
Lines 12848 12869 +21
Branches 1227 1232 +5
==========================================
+ Hits 11107 11127 +20
Misses 1426 1426
- Partials 315 316 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
pbitla-sonata
approved these changes
Jun 25, 2026
bbea207 to
8dc5a86
Compare
pbitla-sonata
approved these changes
Jun 25, 2026
8dc5a86 to
6a6e5ad
Compare
vshaikismail-sonata
approved these changes
Jun 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
Jira ticket: https://2u-internal.atlassian.net/browse/ENT-12003
Guard against inadvertent enterprise link deactivation on re-assignment
Before calling create_pending_enterprise_users, create_pending_enterprise_learner_for_assignment_task now checks whether the learner is already actively linked to the target enterprise. If so, it records a successful linked action and returns early — skipping the LMS call that would otherwise trigger PendingEnterpriseCustomerUserSerializer's "inactivate other customers" side-effect.
Changes:
lms_client.py: new get_enterprise_learner_by_email() helper — resolves an email to an LMS user ID, then fetches the enterprise-learner record
tasks.py: pre-flight active-link check with early return; moves get_normalized_metadata_for_assignment import to content_metadata_api where it belongs
test_tasks.py: covers the skip path (active link), the proceed path (inactive/missing active field), and patches the new check in setUp so existing tests are unaffected
Test results:
