added espn api logging

This commit is contained in:
ChuckBuilds
2025-04-24 15:22:45 -05:00
parent 190400a0f6
commit bde189eec2
2 changed files with 16 additions and 3 deletions

View File

@@ -217,6 +217,8 @@ class BaseMLBManager:
response.raise_for_status()
data = response.json()
self.logger.debug(f"Raw API response: {data}") # Log raw response
games = {}
for event in data.get('events', []):
@@ -228,6 +230,11 @@ class BaseMLBManager:
home_team = next(c for c in competitors if c['homeAway'] == 'home')
away_team = next(c for c in competitors if c['homeAway'] == 'away')
# Log team abbreviations we're getting
home_abbr = home_team['team']['abbreviation']
away_abbr = away_team['team']['abbreviation']
self.logger.info(f"Found game: {away_abbr} @ {home_abbr} (Status: {status})")
# Get game state information
if status == 'in':
# For live games, get detailed state
@@ -255,8 +262,8 @@ class BaseMLBManager:
bases_occupied = [False, False, False]
games[game_id] = {
'away_team': away_team['team']['abbreviation'],
'home_team': home_team['team']['abbreviation'],
'away_team': away_abbr,
'home_team': home_abbr,
'away_score': away_team['score'],
'home_score': home_team['score'],
'status': status,
@@ -268,6 +275,12 @@ class BaseMLBManager:
'start_time': event['date']
}
# Log what teams we're looking for vs what we found
self.logger.info(f"Looking for favorite teams: {self.favorite_teams}")
found_teams = set([game['home_team'] for game in games.values()] +
[game['away_team'] for game in games.values()])
self.logger.info(f"Found teams in API response: {found_teams}")
# Cache the results with different expiration times based on game status
cache_duration = 300 # 5 minutes for live games
if not any(game['status'] == 'in' for game in games.values()):

View File

@@ -479,7 +479,7 @@ class StockManager:
# Calculate chart dimensions
chart_width = int(width // 2.5) # Reduced from width//2.5 to prevent overlap
chart_height = height // 1.5
chart_x = width - chart_width - 4 # 14px margin from right edge
chart_x = width - chart_width - 4 # 4px margin from right edge
chart_y = (height - chart_height) // 2
# Find min and max prices for scaling