Tagessieger Auswertung
This commit is contained in:
parent
bc5ec5edce
commit
0512bde392
6032 changed files with 674969 additions and 33 deletions
|
|
@ -64,16 +64,7 @@ class UsersController extends Controller
|
|||
|
||||
public function store() {
|
||||
if (Auth::guest()) { return redirect("/"); }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$season_id = Season::getCurrent()->id;
|
||||
|
||||
|
||||
|
||||
// Validate form
|
||||
$this->validate(request(), [
|
||||
'id' => 'required',
|
||||
|
|
@ -82,8 +73,6 @@ class UsersController extends Controller
|
|||
'email'=> 'required'
|
||||
]);
|
||||
|
||||
|
||||
|
||||
$user=User::where('id', request('id'))->first();
|
||||
|
||||
$user->name=request('name');
|
||||
|
|
@ -96,24 +85,16 @@ class UsersController extends Controller
|
|||
} else {
|
||||
$user->admin=false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
|
||||
$user->save();
|
||||
|
||||
//dd(request('id'), $season_id, request('paid'));
|
||||
Payment::set_payment_date(request('id'), $season_id, request('paid'));
|
||||
|
||||
|
||||
// Redirect to the home page
|
||||
return redirect('/users');
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function ranking($round_id) {
|
||||
Log::info("Start ranking");
|
||||
|
||||
$currentSeason=Season::getCurrent();
|
||||
if (!$currentSeason) { return redirect("/"); }
|
||||
|
||||
|
|
@ -128,7 +109,10 @@ class UsersController extends Controller
|
|||
|
||||
$users = DB::table('users')->where('deleted',null)->get();
|
||||
|
||||
$highestDayScore=0;
|
||||
|
||||
foreach($users as $user) {
|
||||
Log::info("User: ".$user->id.", ".$user->fullname);
|
||||
$user->totalScore=0; // Summe Ranglisten-Punkte bis heute
|
||||
$user->dayScore=0; // Heute gemachte Ranglisten-Punkte
|
||||
|
||||
|
|
@ -136,18 +120,18 @@ class UsersController extends Controller
|
|||
$user->dayWinHighestJoker=0; // Tagessieg-Punkte, nur exakte Ergebnisse zählen
|
||||
|
||||
$round=Round::where('id','=',$round_id)->first();
|
||||
$games=Game::where('round_id','=',$round->id);
|
||||
$games=Game::where('round_id','=',$round->id)->get();
|
||||
//Log::info('Nr of games found: '.count($games)." game->id=".$round->id." user->id=".$user->id );
|
||||
|
||||
foreach($games as $game) {
|
||||
$tipp = Tipps::where([['game_id','=',$game->id],['user_id','=',$user->id]])->first();
|
||||
//Log::info("game->id=".$game->id.", $user->id=".$user->id);
|
||||
$tipp = Tipp::where([['game_id','=',$game->id],['user_id','=',$user->id]])->first();
|
||||
if ($tipp) {
|
||||
$score = Tipp::getDayScoreLocal($game->score1,$game->score2,$tipp->score1,$tipp->score2,$tipp->joker);
|
||||
$scorevalue = intdiv($score,100); // Jokeranteil herausrechnen
|
||||
$jokervalue = $score - $scorevalue*100;
|
||||
$user->dayWinScore+=$scorevalue;
|
||||
//Log::info("Tipp=".$tipp->id." score=".$score);
|
||||
if ($score > $user->dayWinScore) { $user->dayWinScore=$score; }
|
||||
if ($score > $highestDayScore) { $highestDayScore=$score;}
|
||||
|
||||
if ( $jokervalue > $user->dayWinHighestJoker ) {
|
||||
$user->dayWinHighestJoker=$jokervalue;
|
||||
}
|
||||
} else {
|
||||
Log::info("No tipp found for game_id=".$game->id.", user_id=".$user->id);
|
||||
}
|
||||
|
|
@ -198,7 +182,7 @@ class UsersController extends Controller
|
|||
$games=Game::where('round_id','=',$round->id)->get();
|
||||
|
||||
$all_rounds=Round::where('season_id','=',$currentSeason->id)->get();
|
||||
return view('users.ranking', compact('users','round','all_rounds','games','tippDisplay'));
|
||||
return view('users.ranking', compact('users','round','all_rounds','games','tippDisplay','highestDayScore'));
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue