diff --git a/pfosten/app/Http/Controllers/UsersController.php b/pfosten/app/Http/Controllers/UsersController.php index 47dbc65b..9bee9313 100755 --- a/pfosten/app/Http/Controllers/UsersController.php +++ b/pfosten/app/Http/Controllers/UsersController.php @@ -187,17 +187,21 @@ class UsersController extends Controller } - public function ranking($max_round_id) { + public function ranking($max_round_id, $seasonId=-1) { $startTime = microtime(true); - $currentSeason = Season::getCurrent(); + $season = Season::getCurrent(); + if ( $seasonId !=-1 ) { + $season=Season::where('id','=',$seasonId)->first(); + $seasinId = $season->id; + } // Check ob mindestens eine Runde der Saison gelockt ist angezeigt werden kann if($max_round_id==-1) { $max_round_id = Round::getLastLockedRoundId(); if ($max_round_id==-1) { - $sql="select DATE_FORMAT(date_sub(min(games.kickoff), interval 1 hour),'%d.%m.%Y %H:%i') as start_date from rounds,games where rounds.season_id=".$currentSeason->id." and games.round_id=rounds.id;"; + $sql="select DATE_FORMAT(date_sub(min(games.kickoff), interval 1 hour),'%d.%m.%Y %H:%i') as start_date from rounds,games where rounds.season_id=".$season->id." and games.round_id=rounds.id;"; dd($sql); $date = DB::select($sql); @@ -215,7 +219,7 @@ class UsersController extends Controller // Payment made ? - if (! User::payment_date(Auth::user()->id, $currentSeason->id) && Auth::user()->name!="Torsten Schneider") { + if (! User::payment_date(Auth::user()->id, $season->id) && Auth::user()->name!="Torsten Schneider") { return view('users.no_payment'); } @@ -321,7 +325,7 @@ class UsersController extends Controller $userids = array_keys($rankingDisplay); $round=Round::where('id','=',$max_round_id)->first(); $games=Game::where('round_id','=',$max_round_id)->get(); - $all_rounds=Round::where('season_id','=',$currentSeason->id)->get(); + $all_rounds=Round::where('season_id','=',$season->id)->get(); // Sortieren nach Rankscore