major-domo-legacy/salary_cap_refactor_plan.json
Cal Corum bbb4233b45 Replace hardcoded salary cap with dynamic Team.salary_cap
P2 Tasks completed:
- SWAR-002: Update draft.py cap check to use exceeds_salary_cap()
- SWAR-003: Update trade validation in transactions.py
- SWAR-004: Update first drop/add validation
- SWAR-005: Update second drop/add validation
- SWAR-006: Update legal command roster validation

Changes:
- Enhanced helper functions to support both dict and Pydantic models
- All error messages now show actual team cap value
- Added 4 additional tests for Pydantic model support (21 total)
- All salary cap checks now use centralized exceeds_salary_cap()

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-09 17:14:17 -06:00

103 lines
3.8 KiB
JSON

{
"project": "Dynamic Salary Cap Refactor",
"description": "Replace hardcoded salary cap values (32.0/32.001) with Team.salary_cap field",
"created": "2025-12-09",
"tasks": [
{
"id": "SWAR-001",
"name": "Add salary cap helper function",
"description": "Create a helper function in helpers.py that retrieves the salary cap for a team, with fallback to default 32.0 for backwards compatibility",
"files": ["helpers.py"],
"lines": [1215, 1257],
"priority": 1,
"completed": true,
"tested": true,
"notes": "Added get_team_salary_cap() and exceeds_salary_cap() functions with Pydantic model support"
},
{
"id": "SWAR-002",
"name": "Update draft cap space check",
"description": "Replace hardcoded 32.00001 cap check in draft.py with team.salary_cap from the Team model",
"files": ["cogs/draft.py"],
"lines": [442, 447],
"priority": 2,
"completed": true,
"tested": false,
"notes": "Now uses exceeds_salary_cap() and shows actual cap in error message"
},
{
"id": "SWAR-003",
"name": "Update trade validation sWAR check",
"description": "Replace hardcoded 32.001 cap threshold in trade validation with team.salary_cap",
"files": ["cogs/transactions.py"],
"lines": [1281, 1293],
"priority": 2,
"completed": true,
"tested": false,
"notes": "Now uses exceeds_salary_cap() and shows actual cap in error message"
},
{
"id": "SWAR-004",
"name": "Update first drop/add validation",
"description": "Replace hardcoded 32.001 cap threshold in first drop/add validation block with team.salary_cap",
"files": ["cogs/transactions.py"],
"lines": [1768, 1780],
"priority": 2,
"completed": true,
"tested": false,
"notes": "Now uses exceeds_salary_cap() and shows actual cap in error message"
},
{
"id": "SWAR-005",
"name": "Update second drop/add validation",
"description": "Replace hardcoded 32.001 cap threshold in second drop/add validation block with team.salary_cap",
"files": ["cogs/transactions.py"],
"lines": [2072, 2081],
"priority": 2,
"completed": true,
"tested": false,
"notes": "Now uses exceeds_salary_cap() and shows actual cap in error message"
},
{
"id": "SWAR-006",
"name": "Update roster validation error message",
"description": "Replace hardcoded '(cap 32.0)' in error message with actual team salary_cap value",
"files": ["cogs/transactions.py"],
"lines": [2216, 2226],
"priority": 2,
"completed": true,
"tested": false,
"notes": "Now uses exceeds_salary_cap() and shows actual cap in error message"
},
{
"id": "SWAR-007",
"name": "Add default salary cap constant",
"description": "Define DEFAULT_SALARY_CAP = 32.0 constant in helpers.py for use as fallback when team.salary_cap is None",
"files": ["helpers.py"],
"lines": [30, 31],
"priority": 1,
"completed": true,
"tested": true,
"notes": "Added DEFAULT_SALARY_CAP and SALARY_CAP_TOLERANCE constants"
},
{
"id": "SWAR-008",
"name": "Verify Team model salary_cap field",
"description": "Confirm api_calls/team.py has salary_cap field properly defined and API returns this value",
"files": ["api_calls/team.py"],
"lines": [26],
"priority": 1,
"completed": true,
"tested": true,
"notes": "Field exists: salary_cap: Optional[float] = None"
}
],
"completion_checklist": [
"All hardcoded 32.0/32.001 values replaced - DONE",
"Helper function created with fallback logic - DONE",
"All affected cogs tested manually - PENDING",
"Unit tests added for salary cap validation - DONE (21 tests)",
"Error messages display correct cap values - DONE"
]
}