Fixed new player bug

This commit is contained in:
Torsten 2017-11-13 17:22:28 +01:00
parent 622ecaf97c
commit 25cd90a1fb
5 changed files with 93 additions and 17 deletions

View file

@ -144,10 +144,12 @@ class User extends Authenticatable
foreach ($games as $game) {
$tipp = Tipp::where([['game_id','=',$game->id],['user_id','=',$user_id]])->first();
//if(!$tipp) { Log::info("Tipp doesnt exist: game_id=".$game->id.", user_id=".$user_id); }
if(!$tipp) {
Log::info("Tipp doesnt exist: game_id=".$game->id.", user_id=".$user_id);
return 1;
}
if ($tipp->score1 == -1 || $tipp->score2 == -1) {
//Log::info("!!! User ".$user_id." has a missing tipp for game_id ".$game->id.", round = ".$round_id);
@ -169,7 +171,8 @@ class User extends Authenticatable
$tipp = Tipp::where([['game_id','=',$game->id],['user_id','=',$user_id]])->first();
if(!$tipp) {
//Log::info("tipp is null! OMG! // Infos: user_id=".$user_id.", game_id=".$game->id.", round_id=".$round_id);
Log::info("tipp is null! OMG! // Infos: user_id=".$user_id.", game_id=".$game->id.", round_id=".$round_id);
return true;
}
if ($tipp->joker == true) { $joker=1; }
@ -186,12 +189,14 @@ class User extends Authenticatable
// aktiv = hat die Saison bezahlt.
public static function getActives($seasonId=-1) {
$currentSeason=Season::getCurrent();
if ($seasonId != -1) { $currentSeason = Season::where('id','=',$seasonId); }
if (!$currentSeason) return array();
$season=Season::getCurrent();
if (!$season) return array();
if ($seasonId != -1) { $season = Season::where('id','=',$seasonId)->first(); }
$seasonId = $season->id;
$users = User::all();
$payments = Payment::where('season_id','=',$currentSeason->id)->get();
$payments = Payment::where('season_id','=',$seasonId)->get();
$payref = array();
foreach($payments as $payment) {
@ -216,6 +221,9 @@ class User extends Authenticatable
$user = User::where('id','=',$user_id)->first();
if ($user) { $user->deleted = Carbon\Carbon::now();}
$user->save();
$season = Season::getCurrent();
Payment::set_payment_date($user_id,$season->id,null);
}