From 3457a0d1606b5e7f89b7d62ec3037d3c7a29dacd Mon Sep 17 00:00:00 2001 From: uberfastman <4575707+uberfastman@users.noreply.github.com> Date: Wed, 9 Oct 2024 04:32:17 -0400 Subject: [PATCH] fixed handling of managers for ESPN public leagues --- compose.yaml | 2 +- dao/platforms/espn.py | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/compose.yaml b/compose.yaml index 677e9ef..30a9ec2 100644 --- a/compose.yaml +++ b/compose.yaml @@ -2,7 +2,7 @@ services: app: - image: ghcr.io/uberfastman/fantasy-football-metrics-weekly-report:19.0.2 + image: ghcr.io/uberfastman/fantasy-football-metrics-weekly-report:19.0.3 platform: linux/amd64 ports: - "5001:5000" diff --git a/dao/platforms/espn.py b/dao/platforms/espn.py index 4b7b7e9..08113ac 100644 --- a/dao/platforms/espn.py +++ b/dao/platforms/espn.py @@ -389,8 +389,15 @@ def map_data_to_base(self): base_manager.manager_id = manager["id"] base_manager.email = None - base_manager.name = re.sub(r"\W+", " ", f"{manager['firstName']} {manager['lastName']}") - base_manager.nickname = manager["displayName"] + manager_first_name = manager.get( + "firstName", + f"Manager {matchup_team.team_id}" + ) + manager_last_name = manager.get("lastName", "") + base_manager.name = re.sub( + r"\W+", " ", f"{manager_first_name} {manager_last_name}" + ).strip() + base_manager.nickname = manager.get("displayName", None) base_team.managers.append(base_manager)