From 007006feb23df28a68187b1a275ae9fdfca85933 Mon Sep 17 00:00:00 2001 From: Chuck <33324927+ChuckBuilds@users.noreply.github.com> Date: Tue, 16 Sep 2025 22:39:42 -0400 Subject: [PATCH] team record logic update --- src/ncaa_fb_managers.py | 76 ++++++++++++++++++++++++++--------------- 1 file changed, 48 insertions(+), 28 deletions(-) diff --git a/src/ncaa_fb_managers.py b/src/ncaa_fb_managers.py index 8ad04056..ecac8185 100644 --- a/src/ncaa_fb_managers.py +++ b/src/ncaa_fb_managers.py @@ -1271,20 +1271,25 @@ class NCAAFBRecentManager(BaseNCAAFBManager): # Renamed class # Display away team info if away_abbr: - if self.show_ranking: - # Show ranking if available, fall back to record if unranked and show_records is enabled + if self.show_ranking and self.show_records: + # When both rankings and records are enabled, rankings replace records completely + rankings = self._fetch_team_rankings() + away_rank = rankings.get(away_abbr, 0) + if away_rank > 0: + away_text = f"#{away_rank}" + else: + # Show nothing for unranked teams when rankings are prioritized + away_text = '' + elif self.show_ranking: + # Show ranking only if available rankings = self._fetch_team_rankings() away_rank = rankings.get(away_abbr, 0) if away_rank > 0: away_text = f"#{away_rank}" - elif self.show_records: - # Fall back to record if team is unranked and show_records is enabled - away_text = game.get('away_record', '') else: - # Show nothing if unranked and show_records is disabled away_text = '' elif self.show_records: - # Show record only if show_records is enabled and show_ranking is disabled + # Show record only when rankings are disabled away_text = game.get('away_record', '') else: away_text = '' @@ -1296,20 +1301,25 @@ class NCAAFBRecentManager(BaseNCAAFBManager): # Renamed class # Display home team info if home_abbr: - if self.show_ranking: - # Show ranking if available, fall back to record if unranked and show_records is enabled + if self.show_ranking and self.show_records: + # When both rankings and records are enabled, rankings replace records completely + rankings = self._fetch_team_rankings() + home_rank = rankings.get(home_abbr, 0) + if home_rank > 0: + home_text = f"#{home_rank}" + else: + # Show nothing for unranked teams when rankings are prioritized + home_text = '' + elif self.show_ranking: + # Show ranking only if available rankings = self._fetch_team_rankings() home_rank = rankings.get(home_abbr, 0) if home_rank > 0: home_text = f"#{home_rank}" - elif self.show_records: - # Fall back to record if team is unranked and show_records is enabled - home_text = game.get('home_record', '') else: - # Show nothing if unranked and show_records is disabled home_text = '' elif self.show_records: - # Show record only if show_records is enabled and show_ranking is disabled + # Show record only when rankings are disabled home_text = game.get('home_record', '') else: home_text = '' @@ -1616,20 +1626,25 @@ class NCAAFBUpcomingManager(BaseNCAAFBManager): # Renamed class # Display away team info if away_abbr: - if self.show_ranking: - # Show ranking if available, fall back to record if unranked and show_records is enabled + if self.show_ranking and self.show_records: + # When both rankings and records are enabled, rankings replace records completely + rankings = self._fetch_team_rankings() + away_rank = rankings.get(away_abbr, 0) + if away_rank > 0: + away_text = f"#{away_rank}" + else: + # Show nothing for unranked teams when rankings are prioritized + away_text = '' + elif self.show_ranking: + # Show ranking only if available rankings = self._fetch_team_rankings() away_rank = rankings.get(away_abbr, 0) if away_rank > 0: away_text = f"#{away_rank}" - elif self.show_records: - # Fall back to record if team is unranked and show_records is enabled - away_text = game.get('away_record', '') else: - # Show nothing if unranked and show_records is disabled away_text = '' elif self.show_records: - # Show record only if show_records is enabled and show_ranking is disabled + # Show record only when rankings are disabled away_text = game.get('away_record', '') else: away_text = '' @@ -1641,20 +1656,25 @@ class NCAAFBUpcomingManager(BaseNCAAFBManager): # Renamed class # Display home team info if home_abbr: - if self.show_ranking: - # Show ranking if available, fall back to record if unranked and show_records is enabled + if self.show_ranking and self.show_records: + # When both rankings and records are enabled, rankings replace records completely + rankings = self._fetch_team_rankings() + home_rank = rankings.get(home_abbr, 0) + if home_rank > 0: + home_text = f"#{home_rank}" + else: + # Show nothing for unranked teams when rankings are prioritized + home_text = '' + elif self.show_ranking: + # Show ranking only if available rankings = self._fetch_team_rankings() home_rank = rankings.get(home_abbr, 0) if home_rank > 0: home_text = f"#{home_rank}" - elif self.show_records: - # Fall back to record if team is unranked and show_records is enabled - home_text = game.get('home_record', '') else: - # Show nothing if unranked and show_records is disabled home_text = '' elif self.show_records: - # Show record only if show_records is enabled and show_ranking is disabled + # Show record only when rankings are disabled home_text = game.get('home_record', '') else: home_text = ''