adjustments made to MLB inning logic

This commit is contained in:
Chuck
2025-07-09 18:42:16 -05:00
parent 21773cd948
commit 180975f452

View File

@@ -353,21 +353,29 @@ class BaseMLBManager:
self.logger.debug(f"[MLB] Raw status short: {event['status'].get('shortDetail')}") self.logger.debug(f"[MLB] Raw status short: {event['status'].get('shortDetail')}")
# Determine inning half from status information # Determine inning half from status information
inning_half = 'top' inning_half = 'top' # Default
if 'mid' in status_detail or 'end' in status_detail or 'mid' in status_short or 'end' in status_short:
inning_half = 'middle' # Handle end of inning: next inning is top
# If we're in the middle of an inning, it means the next one is coming up. if 'end' in status_detail or 'end' in status_short:
inning_half = 'top'
inning += 1 inning += 1
if is_favorite_game: if is_favorite_game:
self.logger.debug("[MLB] Detected middle of inning, incrementing for display.") self.logger.debug(f"[MLB] Detected end of inning. Setting to Top {inning}")
# Handle middle of inning: next is bottom of current inning
elif 'mid' in status_detail or 'mid' in status_short:
inning_half = 'bottom'
if is_favorite_game:
self.logger.debug(f"[MLB] Detected middle of inning. Setting to Bottom {inning}")
# Handle bottom of inning
elif 'bottom' in status_detail or 'bot' in status_detail or 'bottom' in status_short or 'bot' in status_short: elif 'bottom' in status_detail or 'bot' in status_detail or 'bottom' in status_short or 'bot' in status_short:
inning_half = 'bottom' inning_half = 'bottom'
if is_favorite_game: if is_favorite_game:
self.logger.debug("[MLB] Detected bottom of inning") self.logger.debug(f"[MLB] Detected bottom of inning: {inning}")
# Handle top of inning
elif 'top' in status_detail or 'top' in status_short: elif 'top' in status_detail or 'top' in status_short:
inning_half = 'top' inning_half = 'top'
if is_favorite_game: if is_favorite_game:
self.logger.debug("[MLB] Detected top of inning") self.logger.debug(f"[MLB] Detected top of inning: {inning}")
if is_favorite_game: if is_favorite_game:
self.logger.debug(f"[MLB] Status detail: {status_detail}") self.logger.debug(f"[MLB] Status detail: {status_detail}")