mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-04-10 21:03:01 +00:00
Fix odds ticker dynamic duration timing issue
- Modified get_dynamic_duration() to trigger update when total_scroll_width is 0 - This ensures the dynamic duration is calculated with actual data before being used - Prevents fallback to minimum duration (30s) when odds ticker hasn't updated yet - Added debug logging to track when updates are triggered for duration calculation
This commit is contained in:
@@ -1251,6 +1251,17 @@ class OddsTickerManager:
|
|||||||
|
|
||||||
def get_dynamic_duration(self) -> int:
|
def get_dynamic_duration(self) -> int:
|
||||||
"""Get the calculated dynamic duration for display"""
|
"""Get the calculated dynamic duration for display"""
|
||||||
|
# If we don't have a valid dynamic duration yet (total_scroll_width is 0),
|
||||||
|
# try to update the data first
|
||||||
|
if self.total_scroll_width == 0 and self.is_enabled:
|
||||||
|
logger.debug("get_dynamic_duration called but total_scroll_width is 0, attempting update...")
|
||||||
|
try:
|
||||||
|
# Force an update to get the data and calculate proper duration
|
||||||
|
self._perform_update()
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(f"Error updating odds ticker for dynamic duration: {e}")
|
||||||
|
|
||||||
|
logger.debug(f"get_dynamic_duration called, returning: {self.dynamic_duration}s")
|
||||||
return self.dynamic_duration
|
return self.dynamic_duration
|
||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user