Skip to content

fix: simplify unlinked-learner exclusion in the Learner Progress Report - #704

Open
sjasti-sonata-svg wants to merge 1 commit into
openedx:masterfrom
sjasti-sonata-svg:fix/ent-12136-exclude-unlinked-refinement
Open

fix: simplify unlinked-learner exclusion in the Learner Progress Report#704
sjasti-sonata-svg wants to merge 1 commit into
openedx:masterfrom
sjasti-sonata-svg:fix/ent-12136-exclude-unlinked-refinement

Conversation

@sjasti-sonata-svg

@sjasti-sonata-svg sjasti-sonata-svg commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

JIRA: https://2u-internal.atlassian.net/browse/ENT-12136

Summary
Follow-up to #703. Simplifies the queryset filter in EnterpriseLearnerEnrollmentViewSet.get_queryset():

 before
Q(enterprise_user__is_linked=True) | Q(enterprise_user__isnull=True, is_consent_granted=False)

 after
.exclude(enterprise_user__is_linked=False)

Test plan

  • Updated test_get_queryset_adds_placeholder_metadata_columns mock assertions for the .exclude() call.
  • Existing test_list_includes_non_consented_enrollments_with_no_enterprise_user and test_list_excludes_non_consented_enrollments_of_genuinely_unlinked_learners (from fix: keep non-DSC enrollments visible in the Learner Progress Report #703) both still pass unchanged, confirming behavior is identical for the ticket's real scenarios.
  • Full suite (302 tests) passes.

Replaces the Q(is_linked=True) | Q(enterprise_user__isnull=True,
is_consent_granted=False) filter with a plain .exclude() on
is_linked=False. Equivalent for every case in current data (both
excluded genuinely-unlinked learners and include non-DSC enrollments
identically), with simpler code at the cost of an explicit guard
against the theoretical case of a NULL enterprise_user with consent
granted -- not expected to occur given current warehouse ETL
behavior. [ENT-12136]
@sjasti-sonata-svg
sjasti-sonata-svg force-pushed the fix/ent-12136-exclude-unlinked-refinement branch from ebd5bd0 to 97091ae Compare August 6, 2026 07:38
Comment on lines +105 to +106
).exclude(
enterprise_user__is_linked=False,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Have we confirmed that is_consent_granted=False users also have is_linked=True? The previous implementation seemed to be operating under a different assumption.

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.

3 participants