2.8 KiB
Debugging Standings Issues
Issue: "No standings data available for this season"
Root Cause
Standings are only created from completed races with results. If a league has:
- No completed races
- Or completed races but no results
Then no standings will be created, and the API will return an empty array.
How Standings Are Created
- During seeding: The
RacingStandingFactory.create()method only creates standings for leagues that have completed races - When races are completed: Standings are recalculated when race results are imported
Debugging Steps
-
Check if the league has any races:
curl http://localhost:3000/api/leagues/{leagueId}/races -
Check if any races are completed:
- Look at the
statusfield in the race data - Completed races have
status: "completed"
- Look at the
-
Check if completed races have results:
- Results are stored separately from races
- Without results, standings cannot be calculated
-
Check if standings exist:
curl http://localhost:3000/api/leagues/{leagueId}/standings- If this returns an empty array
[], no standings exist
- If this returns an empty array
Solutions
Option 1: Add Completed Races with Results
- Create completed races for the league
- Add race results for those races
- Standings will be automatically calculated
Option 2: Use the Recalculate Endpoint (if available)
If there's a standings recalculate endpoint, call it to generate standings from existing race results.
Option 3: Reseed the Database
If the league was created manually and you want to start fresh:
npm run docker:dev:reseed
This will:
- Stop all containers
- Remove the database volume
- Start fresh with seed data
- Create standings for leagues with completed races
Related Issues
Schedule Empty
If the schedule is empty but races exist, it's likely because:
- No seasons are configured for the league
- The season's date window doesn't include the races
Fix: The GetLeagueScheduleUseCase now handles leagues without seasons by showing all races.
Standings Empty
If standings are empty but races exist, it's likely because:
- No completed races exist
- No results exist for completed races
Fix: Add completed races with results, or use the recalculate endpoint.
Example: Creating Standings Manually
If you need to create standings for testing:
- Create completed races with results
- Call the standings endpoint - it will automatically calculate standings from the results
Or, if you have a recalculate endpoint:
curl -X POST http://localhost:3000/api/leagues/{leagueId}/standings/recalculate
Prevention
To avoid this issue in the future:
- Always create seasons when creating leagues
- Add completed races with results
- Use the
docker:dev:reseedcommand to ensure a clean database state