Working on gshirt payout

This commit is contained in:
Torsten Schneider 2017-12-29 19:08:46 +01:00
parent 16231357b4
commit 9126d54dfb
10 changed files with 507 additions and 108 deletions

View file

@ -206,7 +206,9 @@ class UsersController extends Controller
$season = Season::getCurrent();
if ( $seasonId !=-1 ) {
$season=Season::where('id','=',$seasonId)->first();
$seasinId = $season->id;
$seasonId = $season->id;
} else {
$seasonId = $season->id;
}
// Check ob mindestens eine Runde der Saison gelockt ist angezeigt werden kann
@ -214,11 +216,11 @@ class UsersController extends Controller
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;";
$date = DB::select($sql);
$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;";
$entries = DB::select($sql);
if (count($date)>0) {
$start_date = $date[0]->start_date;
if (count($entries)>0) {
$start_date = $entries[0]->start_date;
return view('users.no_ranking', compact('start_date'));
} else {
return redirect("/");
@ -490,13 +492,29 @@ class UsersController extends Controller
public function money_ranking() {
if (Auth::guest()) { return redirect("/"); }
$currentSeason = Season::getCurrent();
$currentSeason = Season::getCurrent();
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;";
$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("/");
}
}
$response = Tipp::getRoundTipps();
$roundtipps = $response['roundtipps'];
$roundData = $response['roundData'];