- Add DEFAULT_SALARY_CAP (32.0) and SALARY_CAP_TOLERANCE (0.001) constants - Add get_team_salary_cap() for retrieving team cap with fallback - Add exceeds_salary_cap() for centralized cap validation - Add 17 unit tests covering all edge cases - Update refactor plan marking P1 tasks complete These helpers will be used by P2 tasks to replace hardcoded 32.0/32.001 values in draft.py and transactions.py 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
103 lines
3.7 KiB
JSON
103 lines
3.7 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, 1248],
|
|
"priority": 1,
|
|
"completed": true,
|
|
"tested": false,
|
|
"notes": "Added get_team_salary_cap() and exceeds_salary_cap() functions"
|
|
},
|
|
{
|
|
"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": [430, 442],
|
|
"priority": 2,
|
|
"completed": false,
|
|
"tested": false,
|
|
"notes": "Used during draft to validate team can afford player being drafted"
|
|
},
|
|
{
|
|
"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": [1283, 1291],
|
|
"priority": 2,
|
|
"completed": false,
|
|
"tested": false,
|
|
"notes": "Validates teams don't exceed cap during trade processing"
|
|
},
|
|
{
|
|
"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, 1776],
|
|
"priority": 2,
|
|
"completed": false,
|
|
"tested": false,
|
|
"notes": "First drop/add sWAR validation block"
|
|
},
|
|
{
|
|
"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": [2069, 2075],
|
|
"priority": 2,
|
|
"completed": false,
|
|
"tested": false,
|
|
"notes": "Second drop/add sWAR validation block"
|
|
},
|
|
{
|
|
"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": [2218, 2219],
|
|
"priority": 2,
|
|
"completed": false,
|
|
"tested": false,
|
|
"notes": "Error message currently shows hardcoded cap value"
|
|
},
|
|
{
|
|
"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": false,
|
|
"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": false,
|
|
"notes": "Field exists: salary_cap: Optional[float] = None"
|
|
}
|
|
],
|
|
"completion_checklist": [
|
|
"All hardcoded 32.0/32.001 values replaced",
|
|
"Helper function created with fallback logic",
|
|
"All affected cogs tested manually",
|
|
"Unit tests added for salary cap validation",
|
|
"Error messages display correct cap values"
|
|
]
|
|
}
|