Final Roundmail system, show users with missing tips/jokers in playerlist as well.

This commit is contained in:
Torsten 2017-08-24 11:47:16 +02:00
parent 6d7ee1a47c
commit 70e28110cb
19 changed files with 3700 additions and 66 deletions

View file

@ -132,13 +132,20 @@ class User extends Authenticatable
public static function hasMissingTipp($user_id) {
$round_id = Round::getFirstIncompleteRound();
$games = Game::where('round_id','=',$round_id);
$games = Game::where('round_id','=',$round_id)->get();
foreach ($games as $game) {
$tipp = Tipp::where('game_id','=',$game->id)->first();
$tipp = Tipp::where([['game_id','=',$game->id],['user_id','=',$user_id]])->first();
if ($tipp->score1 == -1 || $tipp->score2 == -1) {
Log::info("!!! User ".$user_id." has a missing tipp for game_id ".$game->id.", round = ".$round_id);
return 1;
} else {
if ($user_id==2) {
}
}
}
return 0;
@ -146,17 +153,26 @@ class User extends Authenticatable
public static function hasMissingJoker($user_id) {
$round_id = Round::getFirstIncompleteRound();
$games = Game::where('round_id','=',$round_id);
//Log::info("round_id for jokercheck=".$round_id);
$games = Game::where('round_id','=',$round_id." user_id=".$user_id)->get();
$joker=0;
foreach ($games as $game) {
$tipp = Tipp::where('game_id','=',$game->id)->first();
$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);
}
if ($tipp->joker == true) { $joker=1; }
//Log::info("!!! Joker for user_id ".$user_id.", round_id=".$round_id.", game_id=".$game->id." was found.");
}
if ($joker==1) {
return false;
}
Log::info("!!! Joker is missing for user_id=".$user_id." round_id=".$round_id);
return true;
}