Skip to content

Rank best Nth-placed teams across groups (World Cup style) - #48

Merged
ylynfatt merged 2 commits into
mainfrom
best-placed-ranking
Jul 19, 2026
Merged

ylynfatt merged 2 commits into
mainfrom
best-placed-ranking

Conversation

@ylynfatt

Copy link
Copy Markdown
Owner

Summary

Phase ① of World Cup–style advancement: a cross-group ranking of best Nth-placed teams (e.g. the third-place table used by the World Cup, Euro, and AFCON to fill knockout spots), opt-in per stage via config.best_placed_count.

  • BestPlacedCalculator takes each group's Nth-placed row (computed by the existing per-group standings calculator, so in-group tiebreakers incl. head-to-head still apply) and ranks them across groups by points → goal difference → goals for → name. Head-to-head is deliberately excluded across groups — the teams never met — matching FIFA/UEFA cross-group rules.
  • Stage page renders the ranking with a volt cut-line under the qualifying spots when best_placed_count is configured.
  • Create/Edit stage forms gain Advance per group (advances_count) and Best-placed qualifiers fields for grouped formats.
  • Ranked position = advances_count + 1 (default 3rd). Groups too small to have an Nth place are skipped.

Next phases (separate PRs): entrant slot descriptors on knockout stages, SeedStageFromGroups with admin confirm + draw mode, best-thirds allocation tables.

Testing

  • 6 new calculator unit tests (cross-group ordering, skipped short groups, serialization, guards)
  • 7 new feature tests (page prop shape, position derivation, validation incl. format gating)
  • Full suite: 398 passed

🤖 Generated with Claude Code

ylynfatt and others added 2 commits July 19, 2026 10:10
Adds the first phase of stage-to-stage advancement: a cross-group
ranking of the teams finishing just below the automatic qualification
spots (e.g. the best third-placed teams), opt-in per stage via
config.best_placed_count.

- BestPlacedCalculator ranks each group's Nth-placed row across groups
  by points, goal difference, then goals for (h2h is meaningless across
  groups, matching FIFA/UEFA cross-group rules)
- Stage page shows the ranking with a qualifying cut-line when enabled
- Create/Edit stage forms gain "Advance per group" and "Best-placed
  qualifiers" fields for grouped formats
- Ranked position derives from advances_count + 1 (default 3rd)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The best-placed ranking card sits below all the group tables, so an
admin enabling it saw no visible change in the standings themselves.
Group tables now draw World Cup style qualification zones:

- top advances_count rows (automatic qualifiers): volt highlight
- the best-placed candidate row: amber highlight
- zones only appear when the stage sets advances_count, so tables
  without a qualification cut keep the plain leader highlight

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@ylynfatt
ylynfatt merged commit bac364a into main Jul 19, 2026
1 check passed
@ylynfatt
ylynfatt deleted the best-placed-ranking branch July 19, 2026 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant