diff --git a/commands/players/CLAUDE.md b/commands/players/CLAUDE.md index 42c0e48..41a05e2 100644 --- a/commands/players/CLAUDE.md +++ b/commands/players/CLAUDE.md @@ -9,20 +9,28 @@ This directory contains Discord slash commands for player information and statis - **Description**: Display comprehensive player information and statistics - **Parameters**: - `name` (required): Player name to search for - - `season` (optional): Season for statistics (defaults to current season) + - `season` (optional): Season for statistics (defaults to most recent season player appears in) - **Service Dependencies**: - - `player_service.get_players_by_name()` - - `player_service.search_players_fuzzy()` + - `player_service.search_players()` - All-season search with deduplication + - `player_service.get_players_by_name()` - Season-specific search + - `player_service.search_players_fuzzy()` - Fallback fuzzy matching - `player_service.get_player()` - `stats_service.get_player_stats()` ## Key Features +### All-Season Player Search (v2.27.0 - January 2025) +- **Autocomplete**: Searches across ALL 13 seasons, returns deduplicated unique player names +- **Display Format**: `"Player Name (Position) - Team"` showing most recent season's team +- **Deduplication**: Only shows one entry per player name (most recent season takes priority) +- **Minimum Characters**: Requires 2+ characters before autocomplete activates + ### Player Search -- **Exact Name Matching**: Primary search method using player name -- **Fuzzy Search Fallback**: If no exact match, suggests similar player names -- **Multiple Player Handling**: When multiple players match, attempts exact match or asks user to be more specific -- **Suggestion System**: Shows up to 10 suggested players with positions when no exact match found +- **All-Season Default**: When no season specified, searches all seasons and uses most recent +- **Season-Specific**: When `season` parameter provided, searches only that season +- **Fuzzy Search Fallback**: If no exact match, suggests similar player names with season info +- **Multiple Player Handling**: When multiple players match, shows season info to help distinguish +- **Suggestion System**: Shows up to 10 suggested players with positions and seasons ### Player Information Display - **Basic Info**: Name, position(s), team, season, sWAR, injury status @@ -53,11 +61,12 @@ This directory contains Discord slash commands for player information and statis ## Architecture Notes ### Search Logic Flow -1. Search by exact name in specified season -2. If no results, try fuzzy search across all players -3. If single result, display player card -4. If multiple results, attempt exact name match -5. If still multiple, show disambiguation list +1. **Without season parameter**: Search ALL seasons via `search_players(all_seasons=True)`, use most recent match +2. **With season parameter**: Search only specified season via `get_players_by_name()` +3. If no results, try fuzzy search across all seasons +4. If single result, display player card +5. If multiple results, attempt exact name match +6. If still multiple, show disambiguation list with season info ### Performance Optimizations - `asyncio.gather()` for concurrent API calls diff --git a/services/CLAUDE.md b/services/CLAUDE.md index 7a32cc9..23448bd 100644 --- a/services/CLAUDE.md +++ b/services/CLAUDE.md @@ -286,15 +286,43 @@ for txn in created_transactions: print(f"Created transaction {txn.id}: {txn.move_description}") ``` -#### PlayerService Key Methods (October 2025 Update) +#### PlayerService Key Methods (January 2025 Update) ```python class PlayerService(BaseService[Player]): # Player search and retrieval methods async def get_player(...) -> Optional[Player] - async def search_players(...) -> List[Player] + async def get_players_by_name(name: str, season: int) -> List[Player] async def get_players_by_team(...) -> List[Player] - # NEW: Team assignment updates (for /ilmove) + # All-season search (v2.27.0 - January 2025) + async def search_players( + query: str, + limit: int = 10, + season: Optional[int] = None, + all_seasons: bool = False + ) -> List[Player]: + """ + Search for players using the dedicated /v3/players/search endpoint. + + Args: + query: Search query for player name + limit: Maximum number of results to return (1-50) + season: Season to search in (defaults to current season if all_seasons=False) + all_seasons: If True, search across all seasons (ignores season parameter) + + Returns: + List of matching players ordered by most recent season first (when all_seasons=True) + """ + + async def search_players_fuzzy( + query: str, + limit: int = 10, + season: Optional[int] = None, + all_seasons: bool = False + ) -> List[Player]: + """Fuzzy search delegating to search_players().""" + + # Team assignment updates (for /ilmove) async def update_player_team(player_id: int, new_team_id: int) -> Optional[Player]: """ Update a player's team assignment (for real-time IL moves).