Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow course entitlements REST API to be filtered on course_uuid #32305

Merged
merged 3 commits into from
May 26, 2023

Conversation

christopappas
Copy link
Contributor

Description

Describe what this pull request changes, and why. Include implications for people using this change.
Design decisions and their rationales should be documented in the repo (docstring / ADR), per
OEP-19, and can be
linked here.

Useful information to include:

  • Which edX user roles will this change impact? Common user roles are "Learner", "Course Author",
    "Developer", and "Operator".
  • Include screenshots for changes to the UI (ideally, both "before" and "after" screenshots, if applicable).
  • Provide links to the description of corresponding configuration changes. Remember to correctly annotate these
    changes.

Supporting information

Link to other information about the change, such as Jira issues, GitHub issues, or Discourse discussions.
Be sure to check they are publicly readable, or if not, repeat the information here.

Testing instructions

Please provide detailed step-by-step instructions for testing this change.

Deadline

"None" if there's no rush, or provide a specific date or event (and reason) if there is one.

Other information

Include anything else that will help reviewers and consumers understand the change.

  • Does this change depend on other changes elsewhere?
  • Any special concerns or limitations? For example: deprecations, migrations, security, or accessibility.
  • If your database migration can't be rolled back easily.

Copy link
Contributor

@shafqatfarhan shafqatfarhan left a comment

Choose a reason for hiding this comment

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

Q: Do we further need to filter on the expired_at field?

@@ -40,7 +40,8 @@ class CourseEntitlementFilter(filters.FilterSet):

uuid = UUIDListFilter()
user = filters.CharFilter(field_name='user__username')
course_uuid = UUIDListFilter(field_name='course_uuid')
Copy link
Contributor

Choose a reason for hiding this comment

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

Will query params character length be an issue if there is a large courseUUID list?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

potentially, yes

for entitlement in entitlements[0:3]
}
# Create a 2nd entitlement for one of the ones to filter on
CourseEntitlementFactory.create(user=self.user, course_uuid=str(entitlements[0].course_uuid))
Copy link
Contributor

Choose a reason for hiding this comment

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

I did not get it. Could you please elaborate on why are we creating another entry with the same course UUID?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wanted the test set to seem more realistic, because in the wild we can potentially encounter a response that has entitlements with the same course_uuid

@christopappas christopappas merged commit 38a69d1 into master May 26, 2023
@christopappas christopappas deleted the cpappas/PON-158 branch May 26, 2023 13:44
@edx-pipeline-bot
Copy link
Contributor

EdX Release Notice: This PR has been deployed to the staging environment in preparation for a release to production.

@edx-pipeline-bot
Copy link
Contributor

EdX Release Notice: This PR has been deployed to the production environment.

Yagnesh1998 pushed a commit to ManpraXSoftware/edx-platform that referenced this pull request Jun 8, 2023
openedx#32305)

* feat: allow course entitlements REST API to be filtered on course_uuid

* feat: add field to filter out entitlements with null expired_at values

* chore: update tests
Yagnesh1998 pushed a commit to ManpraXSoftware/edx-platform that referenced this pull request Jun 8, 2023
openedx#32305)

* feat: allow course entitlements REST API to be filtered on course_uuid

* feat: add field to filter out entitlements with null expired_at values

* chore: update tests
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