mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-04-10 13:02:59 +00:00
Fix ncaafb ranking display (#45)
* Fix NCAAFB ranking display issue - Remove duplicate ranking system that was drawing rankings behind team logos - Old system (_get_rank) was drawing rankings at top of logos - New system (_fetch_team_rankings) correctly draws rankings in bottom corners - Remove old ranking calls from live, recent, and upcoming game drawing functions - Remove unnecessary _fetch_rankings() calls from update methods - Rankings now only appear in designated corner positions, not overlapping logos Fixes issue where team rankings/betting lines were being drawn behind team logos instead of replacing team records in the corners. * Add missing show_ranking and show_records options to NCAAFB web UI - Add show_ranking option to NCAAFB scoreboard config template - Add show_records and show_ranking toggle switches to NCAAFB web UI - Update JavaScript form collection to include new fields - Users can now control whether to show team records or rankings via web interface This completes the fix for NCAAFB ranking display - users can now enable show_ranking in the web UI to see AP Top 25 rankings instead of team records.
This commit is contained in:
@@ -305,6 +305,7 @@
|
||||
],
|
||||
"logo_dir": "assets/sports/ncaa_logos",
|
||||
"show_records": true,
|
||||
"show_ranking": true,
|
||||
"display_modes": {
|
||||
"ncaa_fb_live": true,
|
||||
"ncaa_fb_recent": true,
|
||||
|
||||
@@ -870,9 +870,6 @@ class NCAAFBLiveManager(BaseNCAAFBManager): # Renamed class
|
||||
self.logger.warning("[NCAAFB] Test mode: Could not parse clock") # Changed log prefix
|
||||
# No actual display call here, let main loop handle it
|
||||
else:
|
||||
# Fetch rankings
|
||||
self._fetch_rankings()
|
||||
|
||||
# Fetch live game data
|
||||
data = self._fetch_data()
|
||||
new_live_games = []
|
||||
@@ -1000,23 +997,7 @@ class NCAAFBLiveManager(BaseNCAAFBManager): # Renamed class
|
||||
main_img.paste(away_logo, (away_x, away_y), away_logo)
|
||||
|
||||
# --- Draw Text Elements on Overlay ---
|
||||
# Ranking (if ranked)
|
||||
home_rank = self._get_rank(game["home_abbr"])
|
||||
away_rank = self._get_rank(game["away_abbr"])
|
||||
|
||||
if home_rank > 0:
|
||||
rank_text = str(home_rank)
|
||||
rank_width = draw_overlay.textlength(rank_text, font=self.fonts['rank'])
|
||||
rank_x = home_x - 8
|
||||
rank_y = 2
|
||||
self._draw_text_with_outline(draw_overlay, rank_text, (rank_x, rank_y), self.fonts['rank'])
|
||||
|
||||
if away_rank > 0:
|
||||
rank_text = str(away_rank)
|
||||
rank_width = draw_overlay.textlength(rank_text, font=self.fonts['rank'])
|
||||
rank_x = away_x + away_logo.width + 8
|
||||
rank_y = 2
|
||||
self._draw_text_with_outline(draw_overlay, rank_text, (rank_x, rank_y), self.fonts['rank'])
|
||||
# Note: Rankings are now handled in the records/rankings section below
|
||||
|
||||
# Scores (centered, slightly above bottom)
|
||||
home_score = str(game.get("home_score", "0"))
|
||||
@@ -1161,9 +1142,6 @@ class NCAAFBRecentManager(BaseNCAAFBManager): # Renamed class
|
||||
self.last_update = current_time # Update time even if fetch fails
|
||||
|
||||
try:
|
||||
# Fetch rankings
|
||||
self._fetch_rankings()
|
||||
|
||||
data = self._fetch_data() # Uses shared cache
|
||||
if not data or 'events' not in data:
|
||||
self.logger.warning("[NCAAFB Recent] No events found in shared data.") # Changed log prefix
|
||||
@@ -1297,23 +1275,7 @@ class NCAAFBRecentManager(BaseNCAAFBManager): # Renamed class
|
||||
main_img.paste(away_logo, (away_x, away_y), away_logo)
|
||||
|
||||
# Draw Text Elements on Overlay
|
||||
# Ranking (if ranked)
|
||||
home_rank = self._get_rank(game["home_abbr"])
|
||||
away_rank = self._get_rank(game["away_abbr"])
|
||||
|
||||
if home_rank > 0:
|
||||
rank_text = str(home_rank)
|
||||
rank_width = draw_overlay.textlength(rank_text, font=self.fonts['rank'])
|
||||
rank_x = home_x - 8
|
||||
rank_y = 2
|
||||
self._draw_text_with_outline(draw_overlay, rank_text, (rank_x, rank_y), self.fonts['rank'])
|
||||
|
||||
if away_rank > 0:
|
||||
rank_text = str(away_rank)
|
||||
rank_width = draw_overlay.textlength(rank_text, font=self.fonts['rank'])
|
||||
rank_x = away_x + away_logo.width - 8
|
||||
rank_y = 2
|
||||
self._draw_text_with_outline(draw_overlay, rank_text, (rank_x, rank_y), self.fonts['rank'])
|
||||
# Note: Rankings are now handled in the records/rankings section below
|
||||
|
||||
# Final Scores (Centered, same position as live)
|
||||
home_score = str(game.get("home_score", "0"))
|
||||
@@ -1479,9 +1441,6 @@ class NCAAFBUpcomingManager(BaseNCAAFBManager): # Renamed class
|
||||
self.last_update = current_time
|
||||
|
||||
try:
|
||||
# Fetch rankings
|
||||
self._fetch_rankings()
|
||||
|
||||
data = self._fetch_data() # Uses shared cache
|
||||
if not data or 'events' not in data:
|
||||
self.logger.warning("[NCAAFB Upcoming] No events found in shared data.") # Changed log prefix
|
||||
@@ -1669,24 +1628,7 @@ class NCAAFBUpcomingManager(BaseNCAAFBManager): # Renamed class
|
||||
game_date = game.get("game_date", "")
|
||||
game_time = game.get("game_time", "")
|
||||
|
||||
# Ranking (if ranked)
|
||||
home_rank = self._get_rank(game["home_abbr"])
|
||||
away_rank = self._get_rank(game["away_abbr"])
|
||||
|
||||
if home_rank > 0:
|
||||
rank_text = str(home_rank)
|
||||
rank_width = draw_overlay.textlength(rank_text, font=self.fonts['rank'])
|
||||
rank_x = home_x - 8
|
||||
rank_y = 2
|
||||
self._draw_text_with_outline(draw_overlay, rank_text, (rank_x, rank_y), self.fonts['rank'])
|
||||
|
||||
if away_rank > 0:
|
||||
rank_text = str(away_rank)
|
||||
rank_width = draw_overlay.textlength(rank_text, font=self.fonts['rank'])
|
||||
rank_x = away_x + away_logo.width - 8
|
||||
rank_y = 2
|
||||
self._draw_text_with_outline(draw_overlay, rank_text, (rank_x, rank_y), self.fonts['rank'])
|
||||
|
||||
# Note: Rankings are now handled in the records/rankings section below
|
||||
|
||||
# "Next Game" at the top (use smaller status font)
|
||||
status_text = "Next Game"
|
||||
|
||||
@@ -1277,6 +1277,26 @@
|
||||
</div>
|
||||
<div class="description">Only display games involving your favorite teams</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="ncaa_fb_show_records">Show Team Records:</label>
|
||||
<div class="toggle-container">
|
||||
<label class="toggle-switch">
|
||||
<input type="checkbox" id="ncaa_fb_show_records" name="ncaa_fb_show_records" {% if main_config.ncaa_fb_scoreboard.show_records %}checked{% endif %}>
|
||||
<span class="slider"></span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="description">Display team win-loss records in bottom corners</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="ncaa_fb_show_ranking">Show Team Rankings:</label>
|
||||
<div class="toggle-container">
|
||||
<label class="toggle-switch">
|
||||
<input type="checkbox" id="ncaa_fb_show_ranking" name="ncaa_fb_show_ranking" {% if main_config.ncaa_fb_scoreboard.show_ranking %}checked{% endif %}>
|
||||
<span class="slider"></span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="description">Display AP Top 25 rankings instead of records for ranked teams</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="config-section">
|
||||
@@ -2894,7 +2914,9 @@
|
||||
live_priority: document.getElementById('ncaa_fb_live_priority').checked,
|
||||
live_game_duration: parseInt(document.getElementById('ncaa_fb_live_game_duration').value),
|
||||
show_odds: document.getElementById('ncaa_fb_show_odds').checked,
|
||||
show_favorite_teams_only: document.getElementById('ncaa_fb_show_favorite_teams_only').checked
|
||||
show_favorite_teams_only: document.getElementById('ncaa_fb_show_favorite_teams_only').checked,
|
||||
show_records: document.getElementById('ncaa_fb_show_records').checked,
|
||||
show_ranking: document.getElementById('ncaa_fb_show_ranking').checked
|
||||
},
|
||||
ncaa_baseball_scoreboard: {
|
||||
enabled: document.getElementById('ncaa_baseball_enabled').checked,
|
||||
|
||||
Reference in New Issue
Block a user