From a541996fdf853131d5f38410350c3188c28f3aef Mon Sep 17 00:00:00 2001 From: "UnravelSports [JB]" Date: Tue, 17 Dec 2024 12:38:43 +0100 Subject: [PATCH] resolved Enum and full_name behaviour --- kloppy/domain/models/common.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/kloppy/domain/models/common.py b/kloppy/domain/models/common.py index d042ea07..7b0d667e 100644 --- a/kloppy/domain/models/common.py +++ b/kloppy/domain/models/common.py @@ -119,11 +119,11 @@ def __str__(self): return self.value -class OfficialType: - VideoAssistantReferee = "Video Assistant Referee" - MainReferee = "Main Referee" - AssistantReferee = "Assistant Referee" - FourthOfficial = "Fourth Official" +class OfficialType(Enum): + VideoAssistantReferee = "video_assistant_referee" + MainReferee = "main_referee" + AssistantReferee = "assistant_referee" + FourthOfficial = "fourth_official" @dataclass(frozen=True) @@ -138,11 +138,13 @@ class Official: def full_name(self): if self.name: return self.name - if self.first_name or self.last_name: + if self.first_name and self.last_name: return f"{self.first_name} {self.last_name}" + if self.last_name: + return self.last_name if self.role: return f"{self.role}_{self.official_id}" - return f"referee_{self.official_id}" + return f"official_{self.official_id}" @dataclass(frozen=True)