From 6627af2b4cd67afe1aa0bfa106192c27443fe45f Mon Sep 17 00:00:00 2001 From: belthlemar Date: Mon, 9 Oct 2023 17:34:54 +0200 Subject: [PATCH] fix mypy issue --- antarest/study/service.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/antarest/study/service.py b/antarest/study/service.py index 4c7917240f..82b89fd823 100644 --- a/antarest/study/service.py +++ b/antarest/study/service.py @@ -40,7 +40,7 @@ from antarest.core.utils.fastapi_sqlalchemy import db from antarest.core.utils.utils import StopWatch from antarest.login.model import Group -from antarest.login.service import LoginService, UserNotFoundError +from antarest.login.service import LoginService from antarest.matrixstore.matrix_editor import MatrixEditInstruction from antarest.study.business.adequacy_patch_management import AdequacyPatchManager from antarest.study.business.advanced_parameters_management import AdvancedParamsManager @@ -645,14 +645,14 @@ def get_user_name(self, params: RequestParameters) -> str: Returns: The user's name """ - author = "Unknown" 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) - author = curr_user.to_dto().name - return author + if curr_user: + return curr_user.to_dto().name + return "Unknown" def get_study_synthesis(self, study_id: str, params: RequestParameters) -> FileStudyTreeConfigDTO: """