From 5df4564173d9c36093123d3cbbf7af92ef3617aa Mon Sep 17 00:00:00 2001 From: Ivan Niedielnitsev <81557788+NiedielnitsevIvan@users.noreply.github.com> Date: Wed, 19 Nov 2025 22:24:24 +0200 Subject: [PATCH] fix: use correct full name when emitting COURSE_PASSING_STATUS_UPDATED This commit fixes the incorrect saving of the user's full name in the credentials service by modifying how the COURSE_PASSING_STATUS_UPDATED and CCX_COURSE_PASSING_STATUS_UPDATED events are emitted. Previously, we had been using Django's standard User.get_full_name() to fetch the user's full name. However, Open edX uses the convention of storing the full name in user.profile.name and leaves the User's first and last name fields blank. (This is to better accommodate the wide range of international conventions regarding names.) --- lms/djangoapps/grades/events.py | 4 ++-- lms/djangoapps/grades/tests/test_events.py | 4 ++-- lms/djangoapps/verify_student/signals/signals.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lms/djangoapps/grades/events.py b/lms/djangoapps/grades/events.py index be189a7022..1321b2e51d 100644 --- a/lms/djangoapps/grades/events.py +++ b/lms/djangoapps/grades/events.py @@ -288,7 +288,7 @@ def _emit_course_passing_status_update(user, course_id, is_passing): pii=UserPersonalData( username=user.username, email=user.email, - name=user.get_full_name(), + name=user.get_full_name() or user.profile.name, ), id=user.id, is_active=user.is_active, @@ -309,7 +309,7 @@ def _emit_course_passing_status_update(user, course_id, is_passing): pii=UserPersonalData( username=user.username, email=user.email, - name=user.get_full_name(), + name=user.get_full_name() or user.profile.name, ), id=user.id, is_active=user.is_active, diff --git a/lms/djangoapps/grades/tests/test_events.py b/lms/djangoapps/grades/tests/test_events.py index 4b3063265a..9ef9abfb59 100644 --- a/lms/djangoapps/grades/tests/test_events.py +++ b/lms/djangoapps/grades/tests/test_events.py @@ -164,7 +164,7 @@ class CoursePassingStatusEventsTest(SharedModuleStoreTestCase, OpenEdxEventsTest pii=UserPersonalData( username=self.user.username, email=self.user.email, - name=self.user.get_full_name(), + name=self.user.get_full_name() or self.user.profile.name, ), id=self.user.id, is_active=self.user.is_active, @@ -238,7 +238,7 @@ class CCXCoursePassingStatusEventsTest( pii=UserPersonalData( username=self.user.username, email=self.user.email, - name=self.user.get_full_name(), + name=self.user.get_full_name() or self.user.profile.name, ), id=self.user.id, is_active=self.user.is_active, diff --git a/lms/djangoapps/verify_student/signals/signals.py b/lms/djangoapps/verify_student/signals/signals.py index a2f452e832..9fe47467c9 100644 --- a/lms/djangoapps/verify_student/signals/signals.py +++ b/lms/djangoapps/verify_student/signals/signals.py @@ -27,7 +27,7 @@ def _create_user_data(user): pii=UserPersonalData( username=user.username, email=user.email, - name=user.get_full_name() + name=user.get_full_name() or user.profile.name ) )