Sunday, April 12, 2026

Balance Subs Across Courts

Balance Subs Across Courts

Canadian Elite Volleyball Academy — Development Update • April 10, 2026

Balance Subs Across Courts

What & Why

After the coordinator completes attendance check-in, absences may be unevenly distributed across the 3 courts. For example, Court 1 might have 4 absent players while Court 3 has none. This creates an unfair situation where one court has many more subs than another. The coordinator needs a one-click "Balance Subs Across Courts" button that redistributes players so each court has roughly the same number of subs.

Rules for moving players

  • Moving UP (lower court → higher court): pick the highest-ranked present players from the lower court
  • Moving DOWN (higher court → lower court): pick the lowest-ranked present players from the higher court
  • This preserves competitive integrity — the best available players stay on the top court

Done looks like

  • After attendance is taken, the coordinator sees a summary showing how many present players are on each court
  • A "Balance Subs Across Courts" button appears when the courts are unbalanced
  • Pressing the button redistributes present players across courts so each court has an equal (or near-equal) number of subs
  • The redistribution updates both schedule_assignments and game_rosters seamlessly (no re-initialization needed)
  • Player rank determines who moves: highest-ranked move up, lowest-ranked move down
  • The coordinator sees a confirmation of what changed (e.g., "Moved Player #12 from Court 3 → Court 1, Player #45 from Court 1 → Court 3")
  • Works correctly with any number of absences (0-12+)

Relevant files

  • — new endpoint (near line 8723 sync-rosters)
  • — button UI (near line 1399 in attendance section)
  • — existing methods: , , , plus may need a new method
  • — reference for how assignments are structured
  • — scheduleAssignments and gameRosters table definitions

Technical notes

  • has: sessionId, gameNumber, courtNumber, playerId, side, position, seedRank
  • has: gameId, playerId, side, position, isPresent, movedFromOriginal
  • Player ranking: (updated each session) or (initial)
  • Each player appears in exactly 6 assignments (one per game) and 6 roster entries
  • When swapping two players between courts, ALL 6 of each player's assignments change courtNumber
  • The game_rosters reference gameId (not courtNumber directly), so need to map gameNumber+newCourtNumber → gameId
  • Storage may need: or a bulk update method
  • Existing endpoint can serve as a pattern for roster rebuilding

Canadian Elite Volleyball Academy
elitevolleyball.training

No comments:

Post a Comment