fix(TournamentService): move bracketSize calculation to avoid redundancy in knockout pairing logic
All checks were successful
Deploy tt-tagebuch / deploy (push) Successful in 55s

This commit is contained in:
Torsten Schulz (local)
2026-09-16 09:37:42 +02:00
parent b90c9a8639
commit a01ec6487b

View File

@@ -603,6 +603,7 @@ class TournamentService {
}
uniqueEntrants.sort(compareKnockoutEntrants);
const bracketSize = nextPowerOfTwo(uniqueEntrants.length);
// Standardsetzung für zwei Gruppen mit je zwei Qualifikanten:
// A1 gegen B2 und B1 gegen A2. Die reine Leistungsreihenfolge
@@ -653,7 +654,6 @@ class TournamentService {
// Paare: Bester gegen Schlechtesten, Zweiter gegen Vorletzten, etc.
// Reverse die zweite Hälfte, um das gewünschte Pairing zu erreichen
const bracketSize = nextPowerOfTwo(uniqueEntrants.length);
const byes = bracketSize - uniqueEntrants.length;
const playersNeeded = bracketSize - byes;