From 9a00e92e0963870d6ec5ee061b7611493439e962 Mon Sep 17 00:00:00 2001 From: KyryloKireiev Date: Tue, 19 Mar 2024 11:42:06 +0200 Subject: [PATCH] fix: [AXM-24] Fix student's latest enrollment filter --- lms/djangoapps/mobile_api/users/views.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lms/djangoapps/mobile_api/users/views.py b/lms/djangoapps/mobile_api/users/views.py index f1b1acdd0998..d6d77dc1edf6 100644 --- a/lms/djangoapps/mobile_api/users/views.py +++ b/lms/djangoapps/mobile_api/users/views.py @@ -434,7 +434,10 @@ def get_primary_enrollment_by_latest_enrollment_or_progress(self) -> Optional[Co if not latest_progress: return latest_enrollment - enrollment_with_latest_progress = self.queryset.filter(course_id=latest_progress.course_id).first() + enrollment_with_latest_progress = self.queryset.filter( + course_id=latest_progress.course_id, + user__username=self.kwargs['username'], + ).first() if latest_enrollment.created > latest_progress.modified: return latest_enrollment