Quota Fixes

This commit is contained in:
Torsten 2018-01-10 08:45:01 +01:00
parent a9efcc8e15
commit 8595808fd2
5 changed files with 112 additions and 73 deletions

View file

@ -203,6 +203,8 @@ class UsersController extends Controller
$startTime = microtime(true);
$season = Season::getCurrent();
if ( $seasonId !=-1 ) {
$season=Season::where('id','=',$seasonId)->first();
@ -211,12 +213,12 @@ class UsersController extends Controller
$seasonId = $season->id;
}
// Check ob mindestens eine Runde der Saison gelockt ist angezeigt werden kann
// Check ob mindestens eine Runde der Saison gelockt ist, die 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=".$seasonId." and games.round_id=rounds.id order by rounds.id;";
//dd($sql);
$entries = DB::select($sql);
if (count($entries)>0) {
@ -497,13 +499,20 @@ class UsersController extends Controller
if (!$currentSeason) {
return view('users.no_ranking', compact('start_date'));
}
// Payment made ?
if (! User::payment_date(Auth::user()->id, $currentSeason->id) && Auth::user()->name!="Torsten Schneider") {
return view('users.no_payment');
}
if (Round::getLastLockedRoundId()==-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 order by rounds.id;";
// Check ob mindestens eine Runde der Saison gelockt ist angezeigt werden kann
$seasonId=$currentSeason->id;
$max_round_id = Round::getLastCompleteRoundId();
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=".$seasonId." and games.round_id=rounds.id order by rounds.id;";
//dd($sql);
$entries = DB::select($sql);
if (count($entries)>0) {
@ -515,6 +524,8 @@ class UsersController extends Controller
}
$sortedPayout = Quota::getPayoutPerUser();
@ -616,8 +627,32 @@ class UsersController extends Controller
public function gshirt_ranking() {
if (Auth::guest()) { return redirect("/"); }
public function gshirt_ranking() {
if (Auth::guest()) { return redirect("/"); }
// Check ob mindestens eine Runde der Saison gelockt ist und angezeigt werden kann
$season=Season::getCurrent();
$seasonId=$season->id;
$max_round_id = Round::getLastCompleteRoundId();
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=".$seasonId." and games.round_id=rounds.id order by rounds.id;";
//dd($sql);
$entries = DB::select($sql);
if (count($entries)>0) {
$start_date = $entries[0]->start_date;
return view('users.no_ranking', compact('start_date'));
} else {
return redirect("/");
}
}
$rankingDisplay = Tipp::gshirt_table();
$usernames = User::getNames();