Fix Spieleranzeige
This commit is contained in:
parent
0cd764cc0e
commit
21c5278270
3 changed files with 22 additions and 17 deletions
|
|
@ -144,28 +144,35 @@ class User extends Authenticatable
|
|||
public static function getMissingTippsAndJokers($users) {
|
||||
$round = Round::getFirstTippableRound();
|
||||
|
||||
|
||||
|
||||
if (!$round) {
|
||||
|
||||
Log::info("User::getMissingTippsandJokers(users) => no tippable round exists");
|
||||
|
||||
$result=array();
|
||||
$result["MISSING_TIPP"]=array();
|
||||
$result["MISSING_JOKER"]=array();
|
||||
return $result;
|
||||
}
|
||||
|
||||
Log::info("User::getMissingTippsandJokers(users) => first tippable round= [".$round->id."] ".$round->name);
|
||||
|
||||
$tippClock=new TimeLogger("User::getMissingTippsAndJokers()");
|
||||
Log::info($tippClock->getStartMessage());
|
||||
// expecting collection of user db objects like: $users = DB::table('users')->where('deleted',null)->orderBy('lastname')->get();
|
||||
$idlist = array();
|
||||
|
||||
$usersWithoutJoker=array();
|
||||
foreach($users as $key => $user) {
|
||||
array_push($idlist,$key);
|
||||
array_push($usersWithoutJoker,$key);
|
||||
//array_push($usersWithoutJoker,$user->id);
|
||||
$usersWithoutJoker[$user->id]="";
|
||||
}
|
||||
|
||||
$games = Game::where('round_id','=',$round->id)->get();
|
||||
$gameIds=array();
|
||||
foreach ($games as $key => $game) {
|
||||
array_push($gameIds,$key);
|
||||
Log::info("GAME_ID:".$key);
|
||||
foreach ($games as $key => $game) { // Vorsicht: $key ist nur der Array index, nicht die game id
|
||||
array_push($gameIds,$game->id);
|
||||
Log::info("GAME_ID:".$game->id);
|
||||
}
|
||||
|
||||
$tipps = Tipp::whereIn('game_id', $gameIds)->get();
|
||||
|
|
@ -175,26 +182,22 @@ class User extends Authenticatable
|
|||
foreach($tipps as $tipp) {
|
||||
if ($tipp->score1 == -1 || $tipp->score2 == -1) {
|
||||
$usersWithoutTipps[$tipp->user_id]="no_tipp";
|
||||
Log::info("UserId ".$tipp->user_id." is missing a tipp!");
|
||||
//Log::info("UserId ".$tipp->user_id." is missing a tipp!");
|
||||
}
|
||||
if ($tipp->joker == true) {
|
||||
Log::info("Removing from jokerlist: ".$tipp->user_id);
|
||||
Log::info("Removing from usersWithoutJokerlist: ".$tipp->user_id);
|
||||
unset($usersWithoutJoker[$tipp->user_id]);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($usersWithoutJoker as $id) {
|
||||
Log::info("Jokerless:".$id);
|
||||
foreach ($usersWithoutJoker as $key => $id) {
|
||||
Log::info("Jokerless:".$key);
|
||||
}
|
||||
|
||||
$result=array();
|
||||
$result["MISSING_TIPP"]=$usersWithoutTipps;
|
||||
$result["MISSING_JOKER"]=$usersWithoutJoker;
|
||||
|
||||
Log::info("USERLIST: ".implode(",",$idlist));
|
||||
Log::info($tippClock->getEndMessage());
|
||||
|
||||
|
||||
foreach(array_keys($result) as $key => $value) {
|
||||
Log::info("Main key: ".$key.", value=".$value);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue