From 0dec5c8e8239485cab51508f9b808cda07ee3be6 Mon Sep 17 00:00:00 2001 From: Adam Stankiewicz Date: Tue, 29 Oct 2024 08:48:44 -0400 Subject: [PATCH] chore: no longer create local var for user_for_learner_status --- .../api/v1/views/default_enterprise_enrollments.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/enterprise/api/v1/views/default_enterprise_enrollments.py b/enterprise/api/v1/views/default_enterprise_enrollments.py index dddbd6657..0edcd72fa 100644 --- a/enterprise/api/v1/views/default_enterprise_enrollments.py +++ b/enterprise/api/v1/views/default_enterprise_enrollments.py @@ -106,7 +106,7 @@ def learner_status(self, request): # Validate the user for learner status exists and is associated # with the enterprise customer. - if not (user_for_learner_status := self.user_for_learner_status): + if not self.user_for_learner_status: return Response( {'detail': f'User with lms_user_id {self.requested_lms_user_id} not found.'}, status=status.HTTP_400_BAD_REQUEST, @@ -114,14 +114,14 @@ def learner_status(self, request): try: enterprise_customer_user = models.EnterpriseCustomerUser.objects.get( - user_id=user_for_learner_status.id, + user_id=self.user_for_learner_status.id, enterprise_customer=enterprise_customer_uuid, ) except models.EnterpriseCustomerUser.DoesNotExist: return Response( { 'detail': ( - f'User with lms_user_id {user_for_learner_status.id} is not associated with ' + f'User with lms_user_id {self.user_for_learner_status.id} is not associated with ' f'the enterprise customer {enterprise_customer_uuid}.' ), }, @@ -139,8 +139,8 @@ def learner_status(self, request): ) serializer_data = { - 'lms_user_id': user_for_learner_status.id, - 'user_email': user_for_learner_status.email, + 'lms_user_id': self.user_for_learner_status.id, + 'user_email': self.user_for_learner_status.email, 'enterprise_customer_uuid': enterprise_customer_uuid, } serializer = serializers.DefaultEnterpriseEnrollmentIntentionLearnerStatusSerializer(