Rangliste standardmaessig zur aktuellen gesperrten Runde oeffnen

This commit is contained in:
torsten 2026-11-03 20:49:11 +01:00
parent c554ce8f08
commit 9df54016df

View file

@ -908,24 +908,19 @@ if ($page === 'reminder') {
}
// Auswählbar sind nur gesperrte Runden (erstes Spiel angepfiffen),
// Standard ist die letzte Runde mit Ergebnis
// Standard ist die zuletzt gesperrte Runde (Legacy Round::getLastLockedRoundId).
// Nicht die letzte Runde mit Ergebnis: Bei laufender Runde ohne Ergebnis
// würde sonst die vorherige, bereits abgeschlossene Runde erscheinen.
$allRounds = [];
$defaultRound = null;
foreach (Round::getBySeason($currentSeason['id']) as $round) {
$roundGames = Game::getGamesByRound($round['id']);
if (empty($roundGames) || !Game::isLocked($roundGames[0]['kickoff'])) {
continue;
}
$allRounds[] = $round;
foreach ($roundGames as $game) {
if ((int)$game['score1'] > -1) {
$defaultRound = $round;
break;
}
}
}
$selectedRound = $defaultRound ?? ($allRounds[0] ?? null);
$selectedRound = !empty($allRounds) ? $allRounds[count($allRounds) - 1] : null;
if (isset($_GET['round_id'])) {
foreach ($allRounds as $round) {
if ((int)$round['id'] === (int)$_GET['round_id']) {