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

fix: forced assignment redemption assigns course run key #570

Merged
merged 1 commit into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions enterprise_access/apps/subsidy_access_policy/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1744,19 +1744,19 @@ def create_assignment(self):
before redemption can occur.
"""
assignment_configuration = self.subsidy_access_policy.assignment_configuration
content_metadata = get_and_cache_content_metadata(
# Ensure that the requested content key is available for the related customer.
_ = get_and_cache_content_metadata(
assignment_configuration.enterprise_customer_uuid,
self.course_run_key,
)
content_key = content_metadata.get('content_key')
user_record = User.objects.filter(lms_user_id=self.lms_user_id).first()
if not user_record:
raise Exception(f'No email could be found for lms_user_id {self.lms_user_id}')

return assignments_api.allocate_assignments(
assignment_configuration,
[user_record.email],
content_key,
self.course_run_key,
self.content_price_cents,
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,5 +254,6 @@ def test_force_redemption_with_assignment_happy_path(self, mock_pending_learner_
)

assignment = LearnerContentAssignment.objects.filter(lms_user_id=user.lms_user_id).first()
self.assertEqual(assignment.content_key, self.course_run_key)
mock_send_email.delay.assert_called_once_with(assignment.uuid)
mock_pending_learner_task.delay.assert_called_once_with(assignment.uuid)
Loading