From 55c56bee7616dfa9ad67f561458e3a074e605f4a Mon Sep 17 00:00:00 2001 From: Cal Corum Date: Thu, 4 Dec 2025 11:06:36 -0600 Subject: [PATCH] Add configurable roster limits with offseason support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add expand_mil_week config (default: 15) for MiL expansion timing - Add early/late ML and MiL roster limits as config items - Add offseason roster limits (69/69) for relaxed roster building - Fix free_agent_team_id to correct value (547) - Transaction builder now uses config values instead of hard-coded limits 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- config.py | 11 ++++++++++- services/transaction_builder.py | 24 ++++++++++++++---------- 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/config.py b/config.py index 2f7c024..48f46a8 100644 --- a/config.py +++ b/config.py @@ -39,6 +39,15 @@ class BotConfig(BaseSettings): modern_stats_start_season: int = 8 offseason_flag: bool = False # When True, relaxes roster limits and disables weekly freeze/thaw + # Roster Limits + expand_mil_week: int = 15 # Week when MiL roster expands (early vs late limits) + ml_roster_limit_early: int = 26 # ML limit for weeks before expand_mil_week + ml_roster_limit_late: int = 26 # ML limit for weeks >= expand_mil_week + mil_roster_limit_early: int = 6 # MiL limit for weeks before expand_mil_week + mil_roster_limit_late: int = 14 # MiL limit for weeks >= expand_mil_week + ml_roster_limit_offseason: int = 69 # ML limit during offseason + mil_roster_limit_offseason: int = 69 # MiL limit during offseason + # API Constants api_version: str = "v3" @@ -54,7 +63,7 @@ class BotConfig(BaseSettings): cap_player_count: int = 26 # Number of players that count toward cap # Special Team IDs - free_agent_team_id: int = 498 + free_agent_team_id: int = 547 # Role Names help_editor_role_name: str = "Help Editor" diff --git a/services/transaction_builder.py b/services/transaction_builder.py index 7ed344f..af0f6e1 100644 --- a/services/transaction_builder.py +++ b/services/transaction_builder.py @@ -379,23 +379,27 @@ class TransactionBuilder: logger.debug(f"🔍 VALIDATION: Projected roster - ML:{projected_ml_size}, MiL:{projected_mil_size}") logger.debug(f"🔍 VALIDATION: Projected sWAR - ML:{projected_ml_swar:.2f}, MiL:{projected_mil_swar:.2f}") - # Get current week to determine roster limits + # Get current week and config to determine roster limits + config = get_config() try: current_state = await league_service.get_current_state() current_week = current_state.week if current_state else 1 except Exception as e: logger.warning(f"Could not get current week, using default limits: {e}") current_week = 1 - - # Determine roster limits based on week - # Major league: <=26 if week<=14, <=25 if week>14 - # Minor league: <=6 if week<=14, <=14 if week>14 - if current_week <= 14: - ml_limit = 26 - mil_limit = 6 + + # Determine roster limits based on week and offseason flag + # During offseason, limits are relaxed to allow roster building + if config.offseason_flag: + ml_limit = config.ml_roster_limit_offseason + mil_limit = config.mil_roster_limit_offseason + logger.debug("🔍 VALIDATION: Offseason mode - using relaxed roster limits") + elif current_week < config.expand_mil_week: + ml_limit = config.ml_roster_limit_early + mil_limit = config.mil_roster_limit_early else: - ml_limit = 26 - mil_limit = 14 + ml_limit = config.ml_roster_limit_late + mil_limit = config.mil_roster_limit_late # Validate roster limits is_legal = True