Performance improvement PayoutPerUserDetails, using cached Quota::getPayoutList
This commit is contained in:
parent
52aacdc76f
commit
45259cbd4a
3 changed files with 127 additions and 28 deletions
|
|
@ -255,6 +255,8 @@ class UsersController extends Controller
|
|||
|
||||
$isFinalRound=false;
|
||||
|
||||
$payoutList = Quota::getPayoutList($response);
|
||||
|
||||
Log::info("Starting Display Loop");
|
||||
|
||||
foreach ($user_ids as $user_id) {
|
||||
|
|
@ -281,10 +283,6 @@ class UsersController extends Controller
|
|||
$rankingDisplay[$user_id]["gshirt_foulcount"] = $roundtipps[$key]["gshirt_foulcount"];
|
||||
$rankingDisplay[$user_id]["gshirt_leader"] = $roundtipps[$key]["gshirt_leader"];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$rankingDisplay[$user_id]["ranking_payout"] = $roundtipps[$key]["ranking_payout"];
|
||||
if ($roundtipps[$key]["ranking_payout"]>0) {
|
||||
$isFinalRound=true;
|
||||
|
|
@ -338,8 +336,22 @@ class UsersController extends Controller
|
|||
$rankingDisplay[$user_id]["trendCol4"] = Tipp::trendCol($roundtipps[$key]["results"][6],$roundtipps[$key]["results"][7],
|
||||
$roundtipps[$key]["tipps"][6],$roundtipps[$key]["tipps"][7],
|
||||
$roundtipps[$key]["joker"][3]);
|
||||
|
||||
// Add GShirt payout
|
||||
if (Season::hasGreenShirtGame()) {
|
||||
$rankingDisplay[$user_id]['gshirt_payout']=0;
|
||||
$userPayouts = $payoutList[$user_id];
|
||||
|
||||
foreach ($userPayouts as $payoutItem) {
|
||||
if ($payoutItem['roundname']=="Grünes Trikot") {
|
||||
$rankingDisplay[$user_id]["gshirt_payout"] = $payoutItem['payout'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
$userids = array_keys($rankingDisplay);
|
||||
$round=Round::where('id','=',$max_round_id)->first();
|
||||
$games=Game::where('round_id','=',$max_round_id)->get();
|
||||
|
|
@ -357,11 +369,10 @@ class UsersController extends Controller
|
|||
|
||||
// Store game results as separate array. Wir nutzen aus, dass die Ergebnisse in jeder Zeile
|
||||
// von Rankingdisplay abgespeichert sind.
|
||||
|
||||
$game_results=array(); // 4 Spielergebnisse der angezeigten Runde
|
||||
array_push($game_results,$rankingDisplay[0]["result_score1"],$rankingDisplay[0]["result_score2"],$rankingDisplay[0]["result_score3"],$rankingDisplay[0]["result_score4"],$rankingDisplay[0]["result_score5"],$rankingDisplay[0]["result_score6"],$rankingDisplay[0]["result_score7"],$rankingDisplay[0]["result_score8"]);
|
||||
|
||||
//Log::info("UserController::ranking: ExecutionTime: " . number_format(( microtime(true) - $startTime), 4) . " Seconds\n");
|
||||
Log::info("UserController::ranking: ExecutionTime: " . number_format(( microtime(true) - $startTime), 4) . " Seconds\n");
|
||||
return view('users.ranking', compact('all_rounds','rankingDisplay','userids','round','games','game_results','isFinalRound'));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue