Making ranking seasonId sensitive

This commit is contained in:
Torsten 2017-10-10 11:32:12 +02:00
parent 6309b2b7fa
commit 0d690560ab

View file

@ -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