Skip to content

Commit

Permalink
hotfix(service): simplify code
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinBelthle committed Oct 9, 2023
1 parent f5ed7a3 commit b50b4de
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions antarest/study/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -646,11 +646,8 @@ def get_user_name(self, params: RequestParameters) -> str:
Returns: The user's name
"""
if params.user:
if params.user.type == "bots":
curr_user = self.user_service.get_user(params.user.impersonator, params)
else:
curr_user = self.user_service.get_user(params.user.id, params)
if curr_user:
user_id = params.user.impersonator if params.user.type == "bots" else params.user.id
if curr_user := self.user_service.get_user(user_id, params):
return curr_user.to_dto().name
return "Unknown"

Expand Down

0 comments on commit b50b4de

Please sign in to comment.