Skip to content

Commit

Permalink
Removed get_user_first_name function
Browse files Browse the repository at this point in the history
  • Loading branch information
manojp3 committed Aug 22, 2024
1 parent 360fabd commit 1bf4fae
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions lms/djangoapps/discussion/rest_api/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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,
Expand Down

0 comments on commit 1bf4fae

Please sign in to comment.