Add configurable roster limits with offseason support
- 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 <noreply@anthropic.com>
This commit is contained in:
parent
9aba3074c6
commit
55c56bee76
11
config.py
11
config.py
@ -39,6 +39,15 @@ class BotConfig(BaseSettings):
|
|||||||
modern_stats_start_season: int = 8
|
modern_stats_start_season: int = 8
|
||||||
offseason_flag: bool = False # When True, relaxes roster limits and disables weekly freeze/thaw
|
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 Constants
|
||||||
api_version: str = "v3"
|
api_version: str = "v3"
|
||||||
@ -54,7 +63,7 @@ class BotConfig(BaseSettings):
|
|||||||
cap_player_count: int = 26 # Number of players that count toward cap
|
cap_player_count: int = 26 # Number of players that count toward cap
|
||||||
|
|
||||||
# Special Team IDs
|
# Special Team IDs
|
||||||
free_agent_team_id: int = 498
|
free_agent_team_id: int = 547
|
||||||
|
|
||||||
# Role Names
|
# Role Names
|
||||||
help_editor_role_name: str = "Help Editor"
|
help_editor_role_name: str = "Help Editor"
|
||||||
|
|||||||
@ -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 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}")
|
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:
|
try:
|
||||||
current_state = await league_service.get_current_state()
|
current_state = await league_service.get_current_state()
|
||||||
current_week = current_state.week if current_state else 1
|
current_week = current_state.week if current_state else 1
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.warning(f"Could not get current week, using default limits: {e}")
|
logger.warning(f"Could not get current week, using default limits: {e}")
|
||||||
current_week = 1
|
current_week = 1
|
||||||
|
|
||||||
# Determine roster limits based on week
|
# Determine roster limits based on week and offseason flag
|
||||||
# Major league: <=26 if week<=14, <=25 if week>14
|
# During offseason, limits are relaxed to allow roster building
|
||||||
# Minor league: <=6 if week<=14, <=14 if week>14
|
if config.offseason_flag:
|
||||||
if current_week <= 14:
|
ml_limit = config.ml_roster_limit_offseason
|
||||||
ml_limit = 26
|
mil_limit = config.mil_roster_limit_offseason
|
||||||
mil_limit = 6
|
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:
|
else:
|
||||||
ml_limit = 26
|
ml_limit = config.ml_roster_limit_late
|
||||||
mil_limit = 14
|
mil_limit = config.mil_roster_limit_late
|
||||||
|
|
||||||
# Validate roster limits
|
# Validate roster limits
|
||||||
is_legal = True
|
is_legal = True
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user