Skip to content

fix: keep non-DSC enrollments visible in the Learner Progress Report - #703

Merged
marlonkeating merged 2 commits into
openedx:masterfrom
sjasti-sonata-svg:fix/cr-8194-lpr-non-dsc-enrollments
Aug 4, 2026
Merged

fix: keep non-DSC enrollments visible in the Learner Progress Report#703
marlonkeating merged 2 commits into
openedx:masterfrom
sjasti-sonata-svg:fix/cr-8194-lpr-non-dsc-enrollments

Conversation

@sjasti-sonata-svg

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

Copy link
Copy Markdown
Contributor

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

Summary

  • The enterprise_user__is_linked=True filter added to EnterpriseLearnerEnrollmentViewSet.get_queryset() to exclude unlinked learners from the LPR also silently excluded enrollments without granted Data Sharing Consent (DSC), since both cases null out the enterprise_user link the same way.
  • Enrollments without consent should still appear in the LPR with is_consent_granted=False, not disappear entirely.
  • Updated the filter to Q(enterprise_user__is_linked=True) | Q(enterprise_user__isnull=True, is_consent_granted=False). This narrows the "show it anyway" carve-out to only the true scrubbed case (enterprise_user is NULL, no learner association at all) rather than any non-consented enrollment regardless of link state -- so a genuinely unlinked learner (a real EnterpriseLearner row with is_linked=False) stays excluded even if their enrollment also happens to lack consent.
  • This also fixes the overview() analytics endpoint, since it reuses the same queryset.

Test plan

  • Updated test_get_queryset_adds_placeholder_metadata_columns mock assertions for the new two-step filter chain.
  • Added test_list_includes_non_consented_enrollments_with_no_enterprise_user reproducing the reported scenario (enterprise_user is NULL).
  • Added test_list_excludes_non_consented_enrollments_of_genuinely_unlinked_learners covering the case where a real, is_linked=False learner exists -- confirms it still stays excluded even without consent.
  • Confirmed existing test_list_excludes_enrollments_of_unlinked_learners and test_overview_number_of_users_excludes_unlinked_learners still pass.

@sjasti-sonata-svg
sjasti-sonata-svg force-pushed the fix/cr-8194-lpr-non-dsc-enrollments branch 2 times, most recently from 1086948 to ef08596 Compare August 4, 2026 06:52
The is_linked=True filter added to exclude unlinked learners also
scrubbed non-DSC enrollments, since both cases null out the
enterprise_user link. Enrollments without granted consent should
still appear in the LPR with is_consent_granted=False, not disappear
entirely. [ENT-12136]
@sjasti-sonata-svg
sjasti-sonata-svg force-pushed the fix/cr-8194-lpr-non-dsc-enrollments branch from ef08596 to e4d8f59 Compare August 4, 2026 09:06
enterprise_user__is_linked=True,
mock_filter.assert_called_once_with(enterprise_customer_uuid=self.enterprise_id)
enrollments.filter.assert_called_once_with(
Q(enterprise_user__is_linked=True) | Q(enterprise_user__isnull=True, is_consent_granted=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.

check one use case where enterprise_user IS NULL and is_consent_granted=False

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Noted and it is already covered .

@marlonkeating marlonkeating self-assigned this Aug 4, 2026
@marlonkeating
marlonkeating merged commit e15e20d into openedx:master Aug 4, 2026
6 checks passed
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