-
Notifications
You must be signed in to change notification settings - Fork 10
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: can_redeem checks for enrollment deadline #538
Conversation
01c1cad
to
6ed0686
Compare
bfd9b56
to
e067bb1
Compare
@@ -768,7 +770,7 @@ def can_redeem(self, request, enterprise_customer_uuid): | |||
enterprise_customer_uuid, lms_user_id, content_key | |||
) | |||
|
|||
if not redemptions and not redeemable_policies: | |||
if not successful_redemptions and not redeemable_policies: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In local testing, I noticed I wasn't getting any reasons
in my test responses even when I can an expected can_redeem=False
result. I tend to use reversals a lot to set up test state, so I have many unsuccessful redemptions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems reasonable!
e067bb1
to
bd0c55f
Compare
We want the `can_redeem` query to return false for a given (user, content key) if the enrollment deadline for the content key is in the past. This is necessary because some courses have runs with an advertised run for which the deadline is in the future, but also have available recent runs where the upgrade deadline is in the past. ENT-7472
bd0c55f
to
689a620
Compare
@@ -768,7 +770,7 @@ def can_redeem(self, request, enterprise_customer_uuid): | |||
enterprise_customer_uuid, lms_user_id, content_key | |||
) | |||
|
|||
if not redemptions and not redeemable_policies: | |||
if not successful_redemptions and not redeemable_policies: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems reasonable!
Description:
We want the
can_redeem
query to return false for a given (user, content key)if the enrollment deadline for the content key is in the past. This is necessary because
some courses have runs with an advertised run for which the deadline is in the future,
but also have available recent runs where the upgrade deadline is in the past.
Depends on openedx/enterprise-catalog#909 and openedx/enterprise-subsidy#286
A
can_redeem
false payload for a passed enroll by date will have areasons
value like this:Jira:
ENT-7472
Merge checklist:
./manage.py makemigrations
has been runPost merge: