From 1bf4faeda3a5ba91e8df7bfe825e42f5f9c6f2ce Mon Sep 17 00:00:00 2001 From: "manoj.p3" Date: Thu, 22 Aug 2024 12:15:31 +0530 Subject: [PATCH] Removed get_user_first_name function --- lms/djangoapps/discussion/rest_api/api.py | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/lms/djangoapps/discussion/rest_api/api.py b/lms/djangoapps/discussion/rest_api/api.py index d7f3af134986..076c518eef2f 100644 --- a/lms/djangoapps/discussion/rest_api/api.py +++ b/lms/djangoapps/discussion/rest_api/api.py @@ -1882,7 +1882,7 @@ def get_course_discussion_user_stats( course_stats_response = get_course_user_stats(course_key, params) for user_stat in course_stats_response["user_stats"]: - user_stat["user_first_name"] = get_user_first_name(user_stat["username"]) + user_stat["user_first_name"] = User.objects.get(user_stat["username"]).first_name if comma_separated_usernames: updated_course_stats = add_stats_for_users_with_no_discussion_content( @@ -1907,13 +1907,6 @@ def get_course_discussion_user_stats( "results": serializer.data, }) -def get_user_first_name(username: str) -> str: - try: - user = User.objects.get(username=username) - return user.first_name - except User.DoesNotExist: - return "" - def get_users_without_stats( username_search_string, course_key,