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: can-redeem user message for no/cancelled/errored assignments #361

Merged
merged 1 commit into from
Dec 11, 2023

Conversation

iloveagent57
Copy link
Contributor

@iloveagent57 iloveagent57 commented Dec 11, 2023

ENT-8114 | The can-redeem endpoint now returns a reason and user message related to policies that are unredeemable due to a lack of allocated LearnerContentAssignment record for the requesting user, or the existence of an assignment in a CANCELLED or ERRORED state.

Sample response payload for my local policy that does not have an assignment for the requesting test user:

[
    {
        "content_key": "course-v1:edX+DemoX+Demo_Course",
        "list_price": null,
        "redemptions": [],
        "has_successful_redemption": false,
        "redeemable_subsidy_access_policy": null,
        "can_redeem": false,
        "reasons": [
            {
                "reason": "reason_learner_not_assigned_content",
                "user_message": "You can't enroll right now because this course is not assigned to you.",
                "policy_uuids": [
                    "3cc0ad2c-ede1-476c-8271-97683855e41d"
                ],
                "metadata": {
                    "enterprise_administrators": [
                        {
                            "email": "[email protected]",
                            "lms_user_id": 145
                        }
                    ]
                }
            }
        ]
    }
]

Assignment does not exist:

image

Assignment exists but canceled

image

Errored assignment

I re-used the "no assignment exists" message here, since there was no pre-defined spec for the message to show in this case. This is still better than the current state of things, where we'd show a message about a missing code if the requesting learner had an errored assignment for the requested content.
image

@iloveagent57 iloveagent57 force-pushed the aed/no-assignment-error-reason branch from 1308d35 to b8d2547 Compare December 11, 2023 16:18
@iloveagent57 iloveagent57 changed the title feat: can-redeem user message for no assignments feat: can-redeem user message for no/cancelled assignments Dec 11, 2023
@iloveagent57 iloveagent57 force-pushed the aed/no-assignment-error-reason branch from b8d2547 to 1e1a76f Compare December 11, 2023 16:29
@iloveagent57 iloveagent57 changed the title feat: can-redeem user message for no/cancelled assignments feat: can-redeem user message for no/cancelled/errored assignments Dec 11, 2023
@ddt.data(
# Only a cancelled assignment exists.
{'has_cancelled_assignment': True, 'has_failed_assignment': False},
# Only an erroed assignment exists.
Copy link
Member

Choose a reason for hiding this comment

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

nit/typo:

Suggested change
# Only an erroed assignment exists.
# Only an errored assignment exists.

@adamstankiewicz
Copy link
Member

@iloveagent57 Just to verify/confirm, there were no associated changes necessary in frontend-app-learner-portal-enterprise to ensure the message appears and/or the "Contact administrator" CTA appears?

@iloveagent57
Copy link
Contributor Author

Correct, no local changes to the learner-portal required to get those screenshots as above.

ENT-8114 | The can-redeem endpoint now returns a reason and
user message related to policies that are unredeemable due
to a lack of allocated `LearnerContentAssignment` record
for the requesting user, or an assignment in a cancelled or errored state.
@iloveagent57 iloveagent57 force-pushed the aed/no-assignment-error-reason branch from 1e1a76f to 9c476d2 Compare December 11, 2023 18:34
@iloveagent57 iloveagent57 merged commit 5cdc4eb into main Dec 11, 2023
4 checks passed
@iloveagent57 iloveagent57 deleted the aed/no-assignment-error-reason branch December 11, 2023 18:41
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.

2 participants