Leaderboard hangs at end due to overestimate of time (#53)

* Leaderboard overestimates time


---------

Co-authored-by: Alex Resnick <adr8282@gmail.com>
This commit is contained in:
Alex Resnick
2025-09-22 09:31:13 -05:00
committed by GitHub
parent b0b5af8e21
commit 569576d4e8
2 changed files with 17 additions and 4 deletions

View File

@@ -75,6 +75,7 @@ class DisplayController:
logger.info(f"News Manager initialized: {'Object' if self.news_manager else 'None'}")
logger.info("Display modes initialized in %.3f seconds", time.time() - init_time)
self.force_change = False
# Initialize Music Manager
music_init_time = time.time()
self.music_manager = None
@@ -1248,7 +1249,8 @@ class DisplayController:
# Reset logged duration when mode changes
if hasattr(self, '_last_logged_duration'):
delattr(self, '_last_logged_duration')
elif current_time - self.last_switch >= self.get_current_duration():
elif current_time - self.last_switch >= self.get_current_duration() or self.force_change:
self.force_change = False
if self.current_display_mode == 'calendar' and self.calendar:
self.calendar.advance_event()
elif self.current_display_mode == 'of_the_day' and self.of_the_day:
@@ -1397,8 +1399,11 @@ class DisplayController:
manager_to_display.display_stocks(force_clear=self.force_clear)
elif self.current_display_mode == 'stock_news':
manager_to_display.display_news() # Assumes internal clearing
elif self.current_display_mode == 'odds_ticker':
manager_to_display.display(force_clear=self.force_clear)
elif self.current_display_mode in {'odds_ticker', 'leaderboard'}:
try:
manager_to_display.display(force_clear=self.force_clear)
except StopIteration:
self.force_change = True
elif self.current_display_mode == 'calendar':
manager_to_display.display(force_clear=self.force_clear)
elif self.current_display_mode == 'youtube':