diff --git a/src/Models/Ranking.php b/src/Models/Ranking.php index cfec527..fc486dc 100644 --- a/src/Models/Ranking.php +++ b/src/Models/Ranking.php @@ -59,9 +59,13 @@ class Ranking { // 4. Hole die Spiele der ausgewählten Runde $gamesOfSelectedRound = Game::getGamesByRound($selectedRound['id']); - // 5. Hole ALLE beendeten Spiele der Saison für die Gesamtpunktzahl - $stmt_finished_games = $db->prepare("SELECT g.id, g.score1, g.score2 FROM games g JOIN rounds r ON g.round_id = r.id WHERE r.season_id = ? AND g.score1 > -1"); - $stmt_finished_games->execute([$seasonId]); + // 5. Hole die beendeten Spiele für die Gesamtpunktzahl (bis zur ausgewählten Runde) + $stmt_finished_games = $db->prepare(" + SELECT g.id, g.score1, g.score2 FROM games g + JOIN rounds r ON g.round_id = r.id + WHERE r.season_id = ? AND g.score1 > -1 AND r.id <= ? + "); + $stmt_finished_games->execute([$seasonId, $selectedRound['id']]); $finished_games_all = $stmt_finished_games->fetchAll(\PDO::FETCH_ASSOC); $finished_games_map = array_column($finished_games_all, null, 'id');