Skip to content

feat: surface audit expiration date#248

Open
GBalaji3320 wants to merge 1 commit into
edx:release-ulmofrom
GBalaji3320:surface-audit-expiration-date
Open

feat: surface audit expiration date#248
GBalaji3320 wants to merge 1 commit into
edx:release-ulmofrom
GBalaji3320:surface-audit-expiration-date

Conversation

@GBalaji3320
Copy link
Copy Markdown

Audit expiration date https://2u-internal.atlassian.net/browse/SUBS-102

Adding the LMS enrollment endpoint, which will therefore proxy through the partner API enrollment endpoint.

Copilot AI review requested due to automatic review settings April 24, 2026 13:08
Copy link
Copy Markdown

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

Adds new enrollment response fields to expose whether an enrollment is audit and (for audit enrollments) the access expiration date derived from the course’s verified-mode upgrade deadline.

Changes:

  • Extend CourseEnrollmentSerializer/CourseEnrollmentsApiListSerializer with isAudit and accessExpirationDate.
  • Add/adjust tests asserting the new response fields for the single-enrollment endpoint.
  • Update API list fixture expectations to include the new fields.

Reviewed changes

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

File Description
openedx/core/djangoapps/enrollments/serializers.py Adds isAudit / accessExpirationDate serializer fields and computation logic.
openedx/core/djangoapps/enrollments/tests/test_views.py Updates enrollment endpoint tests to assert new fields.
openedx/core/djangoapps/enrollments/tests/fixtures/course-enrollments-api-list-valid-data.json Updates expected API list results to include new fields.

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

Comment thread openedx/core/djangoapps/enrollments/serializers.py Outdated
Comment thread openedx/core/djangoapps/enrollments/serializers.py Outdated
Comment thread openedx/core/djangoapps/enrollments/serializers.py Outdated
Comment thread openedx/core/djangoapps/enrollments/serializers.py Outdated
Comment thread openedx/core/djangoapps/enrollments/tests/test_views.py
Comment thread openedx/core/djangoapps/enrollments/serializers.py
@GBalaji3320 GBalaji3320 marked this pull request as draft April 24, 2026 13:25
@GBalaji3320 GBalaji3320 force-pushed the surface-audit-expiration-date branch 3 times, most recently from ad233cd to 1329619 Compare April 27, 2026 08:15
@GBalaji3320 GBalaji3320 marked this pull request as ready for review April 27, 2026 10:24
Copilot AI review requested due to automatic review settings April 27, 2026 10:24
Copy link
Copy Markdown

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 3 out of 3 changed files in this pull request and generated 5 comments.


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

Comment thread openedx/core/djangoapps/enrollments/serializers.py Outdated
Comment thread openedx/core/djangoapps/enrollments/serializers.py
Comment thread openedx/core/djangoapps/enrollments/serializers.py Outdated
Comment thread openedx/core/djangoapps/enrollments/serializers.py Outdated
Comment thread openedx/core/djangoapps/enrollments/serializers.py Outdated
@ankit-sonata
Copy link
Copy Markdown

@GBalaji3320,

  1. isAudit doesn't just mean "is enrollment in audit mode" — it means "is audit mode AND verified mode has an expiration." The name is misleading. Something like is_audit_with_expiring_upgrade would be clearer. A consumer seeing mode == 'audit' but isAudit == False would be confused.

  2. The existing test_check_enrollment adds assertions for the default (honor) mode which is good. But there's no dedicated test for an audit enrollment without a verified mode expiration (should return isAudit: false, accessExpirationDate: null).

  3. Both get_accessExpirationDate and get_isAudit perform a separate DB query (CourseMode.objects.filter(...)) per enrollment object. On list endpoints returning many enrollments, this creates an N+1 query problem (actually 2N extra queries). Use select_related/prefetch

Comment thread openedx/core/djangoapps/enrollments/serializers.py Outdated
@GBalaji3320 GBalaji3320 force-pushed the surface-audit-expiration-date branch from 1329619 to bac26e4 Compare April 30, 2026 09:45
Copilot AI review requested due to automatic review settings April 30, 2026 10:01
@GBalaji3320 GBalaji3320 force-pushed the surface-audit-expiration-date branch from bac26e4 to 87a1c4f Compare April 30, 2026 10:01
Copy link
Copy Markdown

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 3 out of 3 changed files in this pull request and generated no new comments.


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

@GBalaji3320 GBalaji3320 force-pushed the surface-audit-expiration-date branch from 87a1c4f to 5b667c1 Compare May 4, 2026 05:41
Copilot AI review requested due to automatic review settings May 4, 2026 07:47
@GBalaji3320 GBalaji3320 force-pushed the surface-audit-expiration-date branch from 5b667c1 to 94eeaad Compare May 4, 2026 07:47
Copy link
Copy Markdown

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 3 out of 3 changed files in this pull request and generated 4 comments.


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

Comment thread openedx/core/djangoapps/enrollments/tests/test_views.py
Comment thread openedx/core/djangoapps/enrollments/serializers.py
Comment thread openedx/core/djangoapps/enrollments/serializers.py
@GBalaji3320
Copy link
Copy Markdown
Author

@GBalaji3320,

  1. isAudit doesn't just mean "is enrollment in audit mode" — it means "is audit mode AND verified mode has an expiration." The name is misleading. Something like is_audit_with_expiring_upgrade would be clearer. A consumer seeing mode == 'audit' but isAudit == False would be confused.
  2. The existing test_check_enrollment adds assertions for the default (honor) mode which is good. But there's no dedicated test for an audit enrollment without a verified mode expiration (should return isAudit: false, accessExpirationDate: null).
  3. Both get_accessExpirationDate and get_isAudit perform a separate DB query (CourseMode.objects.filter(...)) per enrollment object. On list endpoints returning many enrollments, this creates an N+1 query problem (actually 2N extra queries). Use select_related/prefetch

@ankit-sonata
Based upon your the above comments I have made accordingly.

@GBalaji3320 GBalaji3320 closed this May 4, 2026
@GBalaji3320 GBalaji3320 reopened this May 4, 2026
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