From b50b4deafa91d8d08b6175f5efe96b6f415c071e Mon Sep 17 00:00:00 2001 From: belthlemar Date: Mon, 9 Oct 2023 17:37:15 +0200 Subject: [PATCH] hotfix(service): simplify code --- antarest/study/service.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/antarest/study/service.py b/antarest/study/service.py index 82b89fd823..6076f9345c 100644 --- a/antarest/study/service.py +++ b/antarest/study/service.py @@ -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"