From e3122fa23a2092fecc8884bb9c6cf5305f777010 Mon Sep 17 00:00:00 2001 From: Cal Corum Date: Fri, 12 Dec 2025 18:41:46 -0600 Subject: [PATCH] Fix sWAR display precision and draft team role pings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Change sWAR formatting from 1 decimal to 2 decimal places across all displays - Draft on-clock announcements now ping team role (via team.lname) instead of GM 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- commands/examples/enhanced_player.py | 2 +- commands/teams/info.py | 2 +- commands/transactions/management.py | 4 ++-- services/roster_service.py | 4 ++-- tasks/draft_monitor.py | 13 ++++++++----- tasks/transaction_freeze.py | 2 +- utils/transaction_logging.py | 2 +- views/common.py | 2 +- views/embeds.py | 2 +- views/players.py | 2 +- 10 files changed, 19 insertions(+), 16 deletions(-) diff --git a/commands/examples/enhanced_player.py b/commands/examples/enhanced_player.py index f1568c8..693b510 100644 --- a/commands/examples/enhanced_player.py +++ b/commands/examples/enhanced_player.py @@ -113,7 +113,7 @@ class EnhancedPlayerCommands(commands.Cog): for player in players: results.append({ 'name': player.name, - 'detail': f"{player.primary_position} • WARA: {player.wara:.1f}", + 'detail': f"{player.primary_position} • WARA: {player.wara:.2f}", 'player_obj': player }) diff --git a/commands/teams/info.py b/commands/teams/info.py index ab0b457..dde01f3 100644 --- a/commands/teams/info.py +++ b/commands/teams/info.py @@ -179,7 +179,7 @@ class TeamInfoCommands(commands.Cog): # Format: Position - Name (WARA) position = getattr(player, 'pos_1', 'N/A') or 'N/A' wara = getattr(player, 'wara', 0.0) or 0.0 - core_text += f"{i}. {position} - {player.name} ({wara:.1f})\n" + core_text += f"{i}. {position} - {player.name} ({wara:.2f})\n" if core_text: embed.add_field(name="Core Players", value=core_text, inline=False) diff --git a/commands/transactions/management.py b/commands/transactions/management.py index ccf3fee..b740b03 100644 --- a/commands/transactions/management.py +++ b/commands/transactions/management.py @@ -452,7 +452,7 @@ class TransactionCommands(commands.Cog): if current_roster and current_validation: current_lines = [] current_lines.append(f"**Players:** {current_validation.active_players} active, {current_validation.il_players} IL") - current_lines.append(f"**sWAR:** {current_validation.total_sWAR:.1f}") + current_lines.append(f"**sWAR:** {current_validation.total_sWAR:.2f}") if current_validation.errors: current_lines.append(f"**❌ Errors:** {len(current_validation.errors)}") @@ -480,7 +480,7 @@ class TransactionCommands(commands.Cog): if next_roster and next_validation: next_lines = [] next_lines.append(f"**Players:** {next_validation.active_players} active, {next_validation.il_players} IL") - next_lines.append(f"**sWAR:** {next_validation.total_sWAR:.1f}") + next_lines.append(f"**sWAR:** {next_validation.total_sWAR:.2f}") if next_validation.errors: next_lines.append(f"**❌ Errors:** {len(next_validation.errors)}") diff --git a/services/roster_service.py b/services/roster_service.py index 3eeb2a0..6b88454 100644 --- a/services/roster_service.py +++ b/services/roster_service.py @@ -124,9 +124,9 @@ class RosterService: # WARA validation (if there are limits) if validation.total_wara > 100: # Adjust based on league rules - validation.warnings.append(f"High WARA total: {validation.total_wara:.1f}") + validation.warnings.append(f"High WARA total: {validation.total_wara:.2f}") elif validation.total_wara < 20: - validation.warnings.append(f"Low WARA total: {validation.total_wara:.1f}") + validation.warnings.append(f"Low WARA total: {validation.total_wara:.2f}") logger.debug(f"Validated roster: legal={validation.is_legal}, {len(validation.errors)} errors, {len(validation.warnings)} warnings") return validation diff --git a/tasks/draft_monitor.py b/tasks/draft_monitor.py index 28d1684..3473734 100644 --- a/tasks/draft_monitor.py +++ b/tasks/draft_monitor.py @@ -439,12 +439,15 @@ class DraftMonitorTask: sheet_url=sheet_url ) - # Mention the team's GM if available - gm_mention = "" - if next_pick.owner.gmid: - gm_mention = f"<@{next_pick.owner.gmid}> " + # Mention the team's role (using team.lname) + team_mention = "" + team_role = discord.utils.get(guild.roles, name=next_pick.owner.lname) + if team_role: + team_mention = f"{team_role.mention} " + else: + self.logger.warning(f"Could not find role for team {next_pick.owner.lname}") - await ping_channel.send(content=gm_mention, embed=embed) + await ping_channel.send(content=team_mention, embed=embed) self.logger.info(f"Posted on-clock announcement for pick #{updated_draft_data.currentpick}") # Reset poll interval to 30s for new pick diff --git a/tasks/transaction_freeze.py b/tasks/transaction_freeze.py index 8183fc0..349f586 100644 --- a/tasks/transaction_freeze.py +++ b/tasks/transaction_freeze.py @@ -707,7 +707,7 @@ class TransactionFreezeTask: for move in moves: move_string += ( - f'**{move.player.name}** ({move.player.wara:.1f}) ' + f'**{move.player.name}** ({move.player.wara:.2f}) ' f'from {move.oldteam.abbrev} to {move.newteam.abbrev}\n' ) diff --git a/utils/transaction_logging.py b/utils/transaction_logging.py index a0e958d..d6eed24 100644 --- a/utils/transaction_logging.py +++ b/utils/transaction_logging.py @@ -216,7 +216,7 @@ async def post_trade_to_log( sending_abbrev = txn.oldteam.abbrev moves_by_receiver[receiving_abbrev].append( - f"**{txn.player.name}** ({txn.player.wara:.1f}) from {sending_abbrev}" + f"**{txn.player.name}** ({txn.player.wara:.2f}) from {sending_abbrev}" ) # Add a field for each team receiving players diff --git a/views/common.py b/views/common.py index e6d9c8a..f4aee72 100644 --- a/views/common.py +++ b/views/common.py @@ -94,7 +94,7 @@ class PlayerSelectionView(SelectMenuView): # Add WARA if available if player.wara is not None: - description += f" • WARA: {player.wara:.1f}" + description += f" • WARA: {player.wara:.2f}" options.append(discord.SelectOption( label=label, diff --git a/views/embeds.py b/views/embeds.py index 9abc712..52e2218 100644 --- a/views/embeds.py +++ b/views/embeds.py @@ -151,7 +151,7 @@ class SBAEmbedTemplate(EmbedTemplate): embed.add_field(name="Team", value=team_abbrev, inline=True) if wara is not None: - embed.add_field(name="WARA", value=f"{wara:.1f}", inline=True) + embed.add_field(name="WARA", value=f"{wara:.2f}", inline=True) embed.add_field( name="Season", diff --git a/views/players.py b/views/players.py index 584eb24..1c0eafe 100644 --- a/views/players.py +++ b/views/players.py @@ -212,7 +212,7 @@ class PlayerStatsView(BaseView): embed.add_field( name="sWAR", - value=f"{player.wara:.1f}", + value=f"{player.wara:.2f}", inline=True )