Cached ranking as default, mockup quota editor

This commit is contained in:
Torsten 2017-08-17 17:41:11 +02:00
parent 14698083f8
commit 82d6e6a119
5 changed files with 234 additions and 499 deletions

View file

@ -45,6 +45,11 @@ class UsersController extends Controller
$users = DB::table('users')->where('deleted',null)->orderBy('lastname')->get(); $users = DB::table('users')->where('deleted',null)->orderBy('lastname')->get();
foreach($users as $user) {
Log::info($user->id);
}
return view('users.index', compact('users','active_user_count')); return view('users.index', compact('users','active_user_count'));
} }
@ -112,147 +117,10 @@ class UsersController extends Controller
public function ranking($round_id) {
Log::info("Start ranking");
$currentSeason=Season::getCurrent();
if (!$currentSeason) { return redirect("/"); }
if($round_id==-1) {
$round_id = Round::getLastLockedRoundId();
if ($round_id==-1) {
$sql="select DATE_FORMAT(date_sub(min(games.kickoff), interval 1 hour),'%d.%m.%Y %H:%i') as start_date from rounds,games where rounds.season_id=".$currentSeason->id." and games.round_id=rounds.id;";
$date = DB::select($sql);
if (count($date)>0) {
$start_date = $date[0]->start_date;
return view('users.no_ranking', compact('start_date'));
} else {
return redirect("/");
}
}
}
if (Auth::guest()) { return redirect("/"); }
TippsController::createAllTips();
$users = DB::table('users')->where('deleted',null)->get();
$highestDayScore=0;
// Tagessieg
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
$user->dayWinScore=0; // Tagessieg-Punkte, nur exakte Ergebnisse zählen
$user->dayWinHighestJoker=0; // Tagessieg-Punkte, nur exakte Ergebnisse zählen
$round=Round::where('id','=',$round_id)->first();
$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 = 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);
if ($score > $user->dayWinScore) { public function ranking($max_round_id) {
$user->dayWinScore = $score;
}
if ($score > $highestDayScore) { $highestDayScore = $score; }
} else {
Log::info("No tipp found for game_id=".$game->id.", user_id=".$user->id);
}
}
}
//Tendency Key=UserID_Runde
$tendencies=array('0_0'=>0);
// Punktrangliste
$rounds=Round::where([['season_id','=',$currentSeason->id],['id','<=',$round_id]])->orderBy('id')->get();
foreach($rounds as $round) {
$games=Game::where('round_id','=',$round->id)->orderBy('id')->get();
$index=0;
foreach($games as $game) {
foreach($users as $user) {
$key = $user->id."_".$round->id;
$user->tendencyCount=0;// 4 correct tendencies ==> +2 bonus score
$tipp = Tipp::where('game_id','=',$game->id)->where('user_id','=',$user->id)->first();
if ($tipp) {
// Ranglisten-Punkte berechen
$score = Tipp::getScoreLocal($game->score1,$game->score2,$tipp->score1,$tipp->score2,$tipp->joker);
if ($score>0) {
if (!array_key_exists($key,$tendencies)) { $tendencies[$key]=0; }
$tendencies[$key]+=1;
}
$user->totalScore += $score;
if ($game->round_id == $round_id) {
$user->dayScore += $score;
}
$tippDisplay[$user->id][$game->id][0] = $tipp->score1 ==-1 ? 'x' : $tipp->score1;
$tippDisplay[$user->id][$game->id][1] = $tipp->score2 ==-1 ? 'x' : $tipp->score2;
$tippDisplay[$user->id][$game->id][2] = $tipp->joker;
}
// Increase score here
if (array_key_exists($key,$tendencies)) {
if ($tendencies[$key] == 4) {
//Log::info("Increasing score ! userid=" . $user->id . ", gameid " . $game->id . ", roundid " . $round->id . ", tippid " . $tipp->id . ", tendency=" . $tendencies[$key]);
$user->totalScore += 2;
$user->dayScore+=2;
}
}
}
$index+=1;
}
}
$arr=[];
foreach($users as $user) {
array_push($arr, $user);
}
usort($arr, array($this,"cmp"));
$users=$arr;
$rank=1;
foreach($users as $user) {
$user->rank =$rank;
$rank +=1;
}
$round=Round::where('id','=',$round_id)->first();
$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','highestDayScore'));
}
public function cmp($user1, $user2) {
return ($user1->totalScore < $user2->totalScore);
}
public function ranking2($max_round_id) {
$currentSeason = Season::getCurrent(); $currentSeason = Season::getCurrent();
@ -291,6 +159,9 @@ class UsersController extends Controller
$user_ids=array(); $user_ids=array();
$round_ids=array(); $round_ids=array();
if ($max_round_id==-1) { $max_round_id=Round::getLastLockedRoundId(); } if ($max_round_id==-1) { $max_round_id=Round::getLastLockedRoundId(); }
foreach ($result as $entry) { foreach ($result as $entry) {
@ -339,12 +210,15 @@ class UsersController extends Controller
array_push($roundtipps[$key]['tipps'], $entry->tipp_score1, $entry->tipp_score2, $entry->joker); array_push($roundtipps[$key]['tipps'], $entry->tipp_score1, $entry->tipp_score2, $entry->joker);
array_push($roundtipps[$key]['results'], $entry->game_score1, $entry->game_score2); array_push($roundtipps[$key]['results'], $entry->game_score1, $entry->game_score2);
} }
Log::info("max_round_id=".$max_round_id); Log::info("max_round_id=".$max_round_id);
// Aufbau der Rankingliste in rankingDisplay, sowie aufaddieren der jeweiligen Punkte. // Aufbau der Rankingliste in rankingDisplay, sowie aufaddieren der jeweiligen Punkte.
$rankingDisplay=array(); $rankingDisplay=array();
foreach ($user_ids as $user_id) { foreach ($user_ids as $user_id) {
$rankscore_total= 0; $rankscore_total= 0;
$payout_sum = 0; $payout_sum = 0;
@ -354,6 +228,7 @@ class UsersController extends Controller
$key = $round_id . "_" . $user_id; $key = $round_id . "_" . $user_id;
if ($user_id==1) { Log::info("Dayscore round: ".$round_id." = ".$roundtipps[$key]['dayscore']);} if ($user_id==1) { Log::info("Dayscore round: ".$round_id." = ".$roundtipps[$key]['dayscore']);}
if ($user_id==1) { Log::info("Rankscore round: ".$round_id." = ".$roundtipps[$key]['rankscore']);} if ($user_id==1) { Log::info("Rankscore round: ".$round_id." = ".$roundtipps[$key]['rankscore']);}
if (!array_key_exists($user_id, $rankingDisplay)) { if (!array_key_exists($user_id, $rankingDisplay)) {
$rankingDisplay[$user_id] = array(); $rankingDisplay[$user_id] = array();
@ -374,8 +249,7 @@ class UsersController extends Controller
$rankingDisplay[$user_id]["tipp_score1"] = $roundtipps[$key]["tipps"][0]; $rankingDisplay[$user_id]["tipp_score1"] = $roundtipps[$key]["tipps"][0];
$rankingDisplay[$user_id]["tipp_score2"] = $roundtipps[$key]["tipps"][1]; $rankingDisplay[$user_id]["tipp_score2"] = $roundtipps[$key]["tipps"][1];
$rankingDisplay[$user_id]["joker1"] = $roundtipps[$key]["tipps"][2]; $rankingDisplay[$user_id]["joker1"] = $roundtipps[$key]["tipps"][2];
$rankingDisplay[$user_id]["result_score1"] = $roundtipps[$key]["results"][0];
$rankingDisplay[$user_id]["result_score1"] =
$rankingDisplay[$user_id]["result_score2"] = $roundtipps[$key]["results"][1]; $rankingDisplay[$user_id]["result_score2"] = $roundtipps[$key]["results"][1];
// Determine coloration for Game1 // Determine coloration for Game1
@ -386,6 +260,9 @@ class UsersController extends Controller
$rankingDisplay[$user_id]["tipp_score3"] = $roundtipps[$key]["tipps"][3]; $rankingDisplay[$user_id]["tipp_score3"] = $roundtipps[$key]["tipps"][3];
$rankingDisplay[$user_id]["tipp_score4"] = $roundtipps[$key]["tipps"][4]; $rankingDisplay[$user_id]["tipp_score4"] = $roundtipps[$key]["tipps"][4];
$rankingDisplay[$user_id]["joker2"] = $roundtipps[$key]["tipps"][5]; $rankingDisplay[$user_id]["joker2"] = $roundtipps[$key]["tipps"][5];
$rankingDisplay[$user_id]["result_score3"] = $roundtipps[$key]["results"][2];
$rankingDisplay[$user_id]["result_score4"] = $roundtipps[$key]["results"][3];
// Determine coloration for Game2 // Determine coloration for Game2
$rankingDisplay[$user_id]["trendCol2"] = Tipp::trendCol($roundtipps[$key]["results"][2],$roundtipps[$key]["results"][3], $rankingDisplay[$user_id]["trendCol2"] = Tipp::trendCol($roundtipps[$key]["results"][2],$roundtipps[$key]["results"][3],
$roundtipps[$key]["tipps"][3],$roundtipps[$key]["tipps"][4], $roundtipps[$key]["tipps"][3],$roundtipps[$key]["tipps"][4],
@ -394,6 +271,8 @@ class UsersController extends Controller
$rankingDisplay[$user_id]["tipp_score5"] = $roundtipps[$key]["tipps"][6]; $rankingDisplay[$user_id]["tipp_score5"] = $roundtipps[$key]["tipps"][6];
$rankingDisplay[$user_id]["tipp_score6"] = $roundtipps[$key]["tipps"][7]; $rankingDisplay[$user_id]["tipp_score6"] = $roundtipps[$key]["tipps"][7];
$rankingDisplay[$user_id]["joker3"] = $roundtipps[$key]["tipps"][8]; $rankingDisplay[$user_id]["joker3"] = $roundtipps[$key]["tipps"][8];
$rankingDisplay[$user_id]["result_score5"] = $roundtipps[$key]["results"][4];
$rankingDisplay[$user_id]["result_score6"] = $roundtipps[$key]["results"][5];
// Determine coloration for Game3 // Determine coloration for Game3
$rankingDisplay[$user_id]["trendCol3"] = Tipp::trendCol($roundtipps[$key]["results"][4],$roundtipps[$key]["results"][5], $rankingDisplay[$user_id]["trendCol3"] = Tipp::trendCol($roundtipps[$key]["results"][4],$roundtipps[$key]["results"][5],
$roundtipps[$key]["tipps"][6],$roundtipps[$key]["tipps"][7], $roundtipps[$key]["tipps"][6],$roundtipps[$key]["tipps"][7],
@ -402,6 +281,8 @@ class UsersController extends Controller
$rankingDisplay[$user_id]["tipp_score7"] = $roundtipps[$key]["tipps"][9]; $rankingDisplay[$user_id]["tipp_score7"] = $roundtipps[$key]["tipps"][9];
$rankingDisplay[$user_id]["tipp_score8"] = $roundtipps[$key]["tipps"][10]; $rankingDisplay[$user_id]["tipp_score8"] = $roundtipps[$key]["tipps"][10];
$rankingDisplay[$user_id]["joker4"] = $roundtipps[$key]["tipps"][11]; $rankingDisplay[$user_id]["joker4"] = $roundtipps[$key]["tipps"][11];
$rankingDisplay[$user_id]["result_score7"] = $roundtipps[$key]["results"][6];
$rankingDisplay[$user_id]["result_score8"] = $roundtipps[$key]["results"][7];
// Determine coloration for Game4 // Determine coloration for Game4
$rankingDisplay[$user_id]["trendCol4"] = Tipp::trendCol($roundtipps[$key]["results"][6],$roundtipps[$key]["results"][7], $rankingDisplay[$user_id]["trendCol4"] = Tipp::trendCol($roundtipps[$key]["results"][6],$roundtipps[$key]["results"][7],
$roundtipps[$key]["tipps"][9],$roundtipps[$key]["tipps"][10], $roundtipps[$key]["tipps"][9],$roundtipps[$key]["tipps"][10],
@ -417,7 +298,7 @@ class UsersController extends Controller
// Sortieren nach Rankscore // Sortieren nach Rankscore
$entries = array(); $entries = array();
usort($rankingDisplay, array($this,"cmp2")); usort($rankingDisplay, array($this,"cmp"));
foreach($rankingDisplay as $entry) { foreach($rankingDisplay as $entry) {
array_push($entries, $entry); array_push($entries, $entry);
@ -442,17 +323,25 @@ class UsersController extends Controller
Log::info("Searching for dayscore winners. Highest dayscore=".$highest_dayscore); Log::info("Searching for dayscore winners. Highest dayscore=".$highest_dayscore);
// is_dayscorewinner setzen (Tagessieg) // is_dayscorewinner setzen (Tagessieg)
// Nur wenn alle Spiele eingetragen=gespielt sind !
$round_completed = Round::isCompleted($max_round_id);
foreach($rankingDisplay as $key => $user) { foreach($rankingDisplay as $key => $user) {
if ($user["dayscore"]>0 && $user["dayscore"]==$highest_dayscore) { if ($user["dayscore"]>0 && $user["dayscore"]==$highest_dayscore && $round_completed) {
$rankingDisplay[$key]["is_dayscorewinner"]=1; $rankingDisplay[$key]["is_dayscorewinner"]=1;
Log::info("Setting dayscorewin for player:".$user["user_name"]); Log::info("Setting dayscorewin for player:".$user["user_name"]);
} }
} }
return view('users.ranking2', compact('all_rounds','rankingDisplay','userids','round','games')); // 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"]);
return view('users.ranking', compact('all_rounds','rankingDisplay','userids','round','games','game_results'));
} }
public function cmp2($user1, $user2) { public function cmp($user1, $user2) {
return ($user1['rankscore_total'] < $user2['rankscore_total']); return ($user1['rankscore_total'] < $user2['rankscore_total']);
} }

View file

@ -19,6 +19,27 @@
<div><a href="/seasons/create" class="btn btn-primary">Neue anlegen</a></div> <div><a href="/seasons/create" class="btn btn-primary">Neue anlegen</a></div>
@if ($activeSeason)
<div>
<h3>Spielquoten</h3>
<h4>Spielmodus: Tagessieg 50%</h4>
<h4>Spielmodus: Platzierung 50%</h4>
<p>&nbsp;</p>
<h3>Platzierungsquoten:</h3>
<h4>Platz 1: 21 %</h4>
<h4>Platz 2: 17 %</h4>
<h4>Platz 3: 13 %</h4>
<h4>Platz 4: 10 %</h4>
<h4>Platz 5: 9%</h4>
<h4>Platz 6: 8%</h4>
<h4>Platz 7: 7%</h4>
<h4>Platz 8: 6%</h4>
<h4>Platz 9: 5%</h4>
<h4>Platz 10: 4%</h4>
</div>
@endif
</div> </div>

View file

@ -17,170 +17,201 @@
@endforeach @endforeach
</div> </div>
<div style="float:left; position:relative;left:47%">
<div style="float:left; position:relative; left:-50%;">
<h3>Saison: {{ App\Season::getCurrent()->name }}</h3>
<h4>Runde: {{ $round->name }}</h4> <div style="float:left; position:relative;left:47%">
<h4>Rangliste und Tippübersicht</h4> <div style="float:left; position:relative; left:-50%;">
<table>
<tr> <h3>{{ App\Season::getCurrent()->name }}</h3>
<td style="width:50px;background-color:grey"></td> <h4>{{ $round->name }}</h4>
<td style="width:250px;">=richtige Tendenz</td> <h4>Rangliste und Tippübersicht</h4>
</tr> <table>
<tr> <tr>
<td style="width:50px;background-color:orange"></td> <td style="width:50px;background-color:grey"></td>
<td style="width:250px;">=richtiges Ergebnis</td> <td style="width:250px;">=richtige Tendenz</td>
</tr> </tr>
<tr> <tr>
<td style="width:50px;background-color:red"></td> <td style="width:50px;background-color:orange"></td>
<td style="width:250px;">=richtiges Ergebnis mit Joker</td> <td style="width:250px;">=richtiges Ergebnis</td>
</tr> </tr>
</table> <tr>
<td style="width:50px;background-color:red"></td>
<td style="width:250px;">=richtiges Ergebnis mit Joker</td>
</tr>
</table>
<p>&nbsp;</p> <p>&nbsp;</p>
<table> <table>
<th style="height:140px;white-space: nowrap;"> <th style="height:140px;white-space: nowrap;">
<div style="transform:translate(25px, 51px) rotate(315deg);width:30px;"> <div style="transform:translate(25px, 51px) rotate(315deg);width:30px;">
<span style="border-bottom: 1px solid #ccc; padding: 5px 10px;width:50px;">Rang</span> <span style="border-bottom: 1px solid #ccc; padding: 5px 10px;width:50px;">Rang</span>
</div> </div>
</th> </th>
<th style="height:140px;white-space: nowrap;"> <th style="height:140px;white-space: nowrap;">
<div style="transform:translate(25px, 51px) rotate(315deg);width:30px;"> <div style="transform:translate(25px, 51px) rotate(315deg);width:30px;">
<span style="border-bottom: 1px solid #ccc; padding: 5px 10px;width:50px;">Tagessieg</span> <span style="border-bottom: 1px solid #ccc; padding: 5px 10px;width:50px;">Tagessieg</span>
</div> </div>
</th> </th>
<th style="height:140px;white-space: nowrap;"> <th style="height:140px;white-space: nowrap;">
<div style="transform:translate(25px, 51px) rotate(315deg);width:30px;"> <div style="transform:translate(25px, 51px) rotate(315deg);width:30px;">
<span style="border-bottom: 1px solid #ccc; padding: 5px 10px;width:150px;">Spieler</span> <span style="border-bottom: 1px solid #ccc; padding: 5px 10px;width:150px;">Spieler</span>
</div> </div>
</th> </th>
<th style="height:140px;white-space: nowrap;"> <th style="height:140px;white-space: nowrap;">
<div style="transform:translate(25px, 51px) rotate(315deg);width:30px;"> <div style="transform:translate(25px, 51px) rotate(315deg);width:30px;">
<span style="border-bottom: 1px solid #ccc; padding: 5px 10px;">Punkte Gesamt</span> <span style="border-bottom: 1px solid #ccc; padding: 5px 10px;">Punkte Gesamt</span>
</div> </div>
</th> </th>
<th style="height:140px;white-space: nowrap;"> <th style="height:140px;white-space: nowrap;">
<div style="transform:translate(25px, 51px) rotate(315deg);width:30px;"> <div style="transform:translate(25px, 51px) rotate(315deg);width:30px;">
<span style="border-bottom: 1px solid #ccc; padding: 5px 10px;">Punkte Tag</span> <span style="border-bottom: 1px solid #ccc; padding: 5px 10px;">Punkte Tag</span>
</div> </div>
</th> </th>
<th style="height:140px;white-space: nowrap;"> <th style="height:140px;white-space: nowrap;">
<div style="transform:translate(25px, 51px) rotate(315deg);width:30px;"> <div style="transform:translate(25px, 51px) rotate(315deg);width:30px;">
<span style="border-bottom: 1px solid #ccc; padding: 5px 10px;">{{$games[0]->team1}}</span> <span style="border-bottom: 1px solid #ccc; padding: 5px 10px;">{{$games[0]->team1}}</span>
</div> </div>
</th> </th>
<th style="height:140px;white-space: nowrap;"> <th style="height:140px;white-space: nowrap;">
<div style="transform:translate(25px, 51px) rotate(315deg);width:30px;"> <div style="transform:translate(25px, 51px) rotate(315deg);width:30px;">
<span style="border-bottom: 1px solid #ccc; padding: 5px 10px;">{{$games[0]->team2}}</span> <span style="border-bottom: 1px solid #ccc; padding: 5px 10px;">{{$games[0]->team2}}</span>
</div> </div>
</th> </th>
<th style="height:140px;white-space: nowrap;"> <th style="height:140px;white-space: nowrap;">
<div style="transform:translate(25px, 51px) rotate(315deg);width:30px;"> <div style="transform:translate(25px, 51px) rotate(315deg);width:30px;">
<span style="border-bottom: 1px solid #ccc; padding: 5px 10px;">Joker</span> <span style="border-bottom: 1px solid #ccc; padding: 5px 10px;">Joker</span>
</div> </div>
</th> </th>
<th style="height:140px;white-space: nowrap;"> <th style="height:140px;white-space: nowrap;">
<div style="transform:translate(25px, 51px) rotate(315deg);width:30px;"> <div style="transform:translate(25px, 51px) rotate(315deg);width:30px;">
<span style="border-bottom: 1px solid #ccc; padding: 5px 10px;">{{$games[1]->team1}}</span> <span style="border-bottom: 1px solid #ccc; padding: 5px 10px;">{{$games[1]->team1}}</span>
</div> </div>
</th> </th>
<th style="height:140px;white-space: nowrap;"> <th style="height:140px;white-space: nowrap;">
<div style="transform:translate(25px, 51px) rotate(315deg);width:30px;"> <div style="transform:translate(25px, 51px) rotate(315deg);width:30px;">
<span style="border-bottom: 1px solid #ccc; padding: 5px 10px;">{{$games[1]->team2}}</span> <span style="border-bottom: 1px solid #ccc; padding: 5px 10px;">{{$games[1]->team2}}</span>
</div> </div>
</th> </th>
<th style="height:140px;white-space: nowrap;"> <th style="height:140px;white-space: nowrap;">
<div style="transform:translate(25px, 51px) rotate(315deg);width:30px;"> <div style="transform:translate(25px, 51px) rotate(315deg);width:30px;">
<span style="border-bottom: 1px solid #ccc; padding: 5px 10px;">Joker</span> <span style="border-bottom: 1px solid #ccc; padding: 5px 10px;">Joker</span>
</div> </div>
</th> </th>
<th style="height:140px;white-space: nowrap;"> <th style="height:140px;white-space: nowrap;">
<div style="transform:translate(25px, 51px) rotate(315deg);width:30px;"> <div style="transform:translate(25px, 51px) rotate(315deg);width:30px;">
<span style="border-bottom: 1px solid #ccc; padding: 5px 10px;">{{$games[2]->team1}}</span> <span style="border-bottom: 1px solid #ccc; padding: 5px 10px;">{{$games[2]->team1}}</span>
</div> </div>
</th> </th>
<th style="height:140px;white-space: nowrap;"> <th style="height:140px;white-space: nowrap;">
<div style="transform:translate(25px, 51px) rotate(315deg);width:30px;"> <div style="transform:translate(25px, 51px) rotate(315deg);width:30px;">
<span style="border-bottom: 1px solid #ccc; padding: 5px 10px;">{{$games[2]->team2}}</span> <span style="border-bottom: 1px solid #ccc; padding: 5px 10px;">{{$games[2]->team2}}</span>
</div> </div>
</th> </th>
<th style="height:140px;white-space: nowrap;"> <th style="height:140px;white-space: nowrap;">
<div style="transform:translate(25px, 51px) rotate(315deg);width:30px;"> <div style="transform:translate(25px, 51px) rotate(315deg);width:30px;">
<span style="border-bottom: 1px solid #ccc; padding: 5px 10px;">Joker</span> <span style="border-bottom: 1px solid #ccc; padding: 5px 10px;">Joker</span>
</div> </div>
</th> </th>
<th style="height:140px;white-space: nowrap;"> <th style="height:140px;white-space: nowrap;">
<div style="transform:translate(25px, 51px) rotate(315deg);width:30px;"> <div style="transform:translate(25px, 51px) rotate(315deg);width:30px;">
<span style="border-bottom: 1px solid #ccc; padding: 5px 10px;">{{$games[3]->team1}}</span> <span style="border-bottom: 1px solid #ccc; padding: 5px 10px;">{{$games[3]->team1}}</span>
</div> </div>
</th> </th>
<th style="height:140px;white-space: nowrap;"> <th style="height:140px;white-space: nowrap;">
<div style="transform:translate(25px, 51px) rotate(315deg);width:30px;"> <div style="transform:translate(25px, 51px) rotate(315deg);width:30px;">
<span style="border-bottom: 1px solid #ccc; padding: 5px 10px;">{{$games[3]->team2}}</span> <span style="border-bottom: 1px solid #ccc; padding: 5px 10px;">{{$games[3]->team2}}</span>
</div> </div>
</th> </th>
<th style="height:140px;white-space: nowrap;"> <th style="height:140px;white-space: nowrap;">
<div style="transform:translate(25px, 51px) rotate(315deg);width:30px;"> <div style="transform:translate(25px, 51px) rotate(315deg);width:30px;">
<span style="border-bottom: 1px solid #ccc; padding: 5px 10px;">Joker</span> <span style="border-bottom: 1px solid #ccc; padding: 5px 10px;">Joker</span>
</div> </div>
</th> </th>
<th style="height:140px;white-space: nowrap;">
<div style="transform:translate(25px, 51px) rotate(315deg);width:30px;">
<span style="border-bottom: 1px solid #ccc; padding: 5px 10px;">Debug (DayWinScore)</span>
</div>
</th>
<!-- Spielergebnis als erste Zeile -->
<tr>
<td></td>
<td></td>
<td>Spiel-Ergebnis</td>
<td></td>
<td></td>
<td align="center">{{ ($game_results[0]==-1? "" : $game_results[0]) }}</td>
<td align="center">{{ ($game_results[1]==-1? "" : $game_results[1]) }}</td>
<td></td>
<td align="center">{{ ($game_results[2]==-1? "" : $game_results[2]) }}</td>
<td align="center">{{ ($game_results[3]==-1? "" : $game_results[3]) }}</td>
<td></td>
<td align="center">{{ ($game_results[4]==-1? "" : $game_results[4]) }}</td>
<td align="center">{{ ($game_results[5]==-1? "" : $game_results[5]) }}</td>
<td></td>
<td align="center">{{ ($game_results[6]==-1? "" : $game_results[6]) }}</td>
<td align="center">{{ ($game_results[7]==-1? "" : $game_results[7]) }}</td>
<td></td>
<td></td>
</tr>
@foreach($rankingDisplay as $entry)
@foreach($users as $user)
@if (App\User::is_season_paid($user->id)=="Ja")
<tr>
<td class="table-bordered">&nbsp;<span class="text list-unstyled" href="#" >&nbsp;{{ $user->rank }}&nbsp;</span></td>
<td class="table-bordered"><div style="margin: 0 auto; width: 32px;"><img src="/img/crown.png" style="{{ ($user->dayWinScore == $highestDayScore ? 'float:left;width:32px;height:32px' : 'display: none;') }}"></div></td>
<td class="table-bordered">&nbsp;<a class="text list-unstyled" href="#" style="vertical-align: middle;">{{ $user->name }} &nbsp;</a></td>
<td class="table-bordered" align="center">&nbsp;{{ $user->totalScore }}&nbsp;</td>
<td class="table-bordered" align="center">&nbsp;{{ $user->dayScore }}&nbsp;</td>
<td class="table-bordered" align="center" style="{{App\Tipp::getCol($user->id,$games[0]->id)}}">&nbsp;{{ $tippDisplay[$user->id][$games[0]->id][0] }}&nbsp;</td>
<td class="table-bordered" align="center" style="{{App\Tipp::getCol($user->id,$games[0]->id)}}">&nbsp;{{ $tippDisplay[$user->id][$games[0]->id][1] }}&nbsp;</td>
<td class="table-bordered"><div style="margin: 0 auto; width: 32px;"><img src="/img/joker.png" style="{{ ($tippDisplay[$user->id][$games[0]->id][2]==true ? 'float:left;width:32px;height:32px' : 'display: none;') }}"></div></td>
<td class="table-bordered" align="center" style="{{App\Tipp::getCol($user->id,$games[1]->id)}}">&nbsp;{{$tippDisplay[$user->id][$games[1]->id][0] }}&nbsp;</td>
<td class="table-bordered" align="center" style="{{App\Tipp::getCol($user->id,$games[1]->id)}}">&nbsp;{{$tippDisplay[$user->id][$games[1]->id][1] }}&nbsp;</td>
<td class="table-bordered"><div style="margin: 0 auto; width: 32px;"><img src="/img/joker.png" style="{{ ($tippDisplay[$user->id][$games[1]->id][2]==true ? 'float:left;width:32px;height:32px' : 'display: none;') }}"></div></td>
<td class="table-bordered" align="center" style="{{App\Tipp::getCol($user->id,$games[2]->id)}}">&nbsp;{{$tippDisplay[$user->id][$games[2]->id][0] }}&nbsp;</td>
<td class="table-bordered" align="center" style="{{App\Tipp::getCol($user->id,$games[2]->id)}}">&nbsp;{{$tippDisplay[$user->id][$games[2]->id][1] }}&nbsp;</td>
<td class="table-bordered"><div style="margin: 0 auto; width: 32px;"><img src="/img/joker.png" style="{{ ($tippDisplay[$user->id][$games[2]->id][2]==true ? 'float:left;width:32px;height:32px' : 'display: none;') }}"></div></td>
<td class="table-bordered" align="center" style="{{App\Tipp::getCol($user->id,$games[3]->id)}}">&nbsp;{{$tippDisplay[$user->id][$games[3]->id][0] }}&nbsp;</td>
<td class="table-bordered" align="center" style="{{App\Tipp::getCol($user->id,$games[3]->id)}}">&nbsp;{{$tippDisplay[$user->id][$games[3]->id][1] }}&nbsp;</td>
<td class="table-bordered"><div style="margin: 0 auto; width: 32px;"><img src="/img/joker.png" style="{{ ($tippDisplay[$user->id][$games[3]->id][2]==true ? 'float:left;width:32px;height:32px' : 'display: none;') }}"></div></td>
</tr>
@endif
@endforeach
<!-- Control Cell width -->
<tr> <tr>
<td> <div></div></td> <td class="table-bordered">&nbsp;<span class="text list-unstyled" href="#" >&nbsp;{{ $entry["rank"] }}&nbsp;</span></td>
<td> <div></div></td> <td class="table-bordered"><div style="margin: 0 auto; width: 32px;"><img src="/img/crown.png" style="{{ ($entry["is_dayscorewinner"] ? 'float:left;width:32px;height:32px' : 'display: none;') }}"></div></td>
<td style="width:50px;"> <div></div></td> <td class="table-bordered">&nbsp;<a class="text list-unstyled" href="#" style="vertical-align: middle;">{{ $entry["user_name"] }} &nbsp;</a></td>
<td style="width:50px;"> <div></div></td> <td class="table-bordered" align="center">&nbsp;{{ $entry["rankscore_total"] }}&nbsp;</td>
<td style="width:50px;"> <div></div></td> <td class="table-bordered" align="center">&nbsp;{{ $entry["rankscore"] }}&nbsp;</td>
<td style="width:50px;"> <div></div></td> <td class="table-bordered" align="center" style="{{$entry["trendCol1"]}}">&nbsp;{{ str_replace("-1","x",$entry["tipp_score1"]) }}&nbsp;</td>
<td style="width:50px;"> <div></div></td> <td class="table-bordered" align="center" style="{{$entry["trendCol1"]}}">&nbsp;{{ str_replace("-1","x",$entry["tipp_score2"]) }}&nbsp;</td>
<td style="width:50px;"> <div></div></td> <td class="table-bordered"><div style="margin: 0 auto; width: 32px;"><img src="/img/joker.png" style="{{ ($entry["joker1"] ? 'float:left;width:32px;height:32px' : 'display: none;') }}"></div></td>
<td style="width:50px;"> <div></div></td> <td class="table-bordered" align="center" style="{{$entry["trendCol2"]}}">&nbsp;{{ str_replace("-1","x",$entry["tipp_score3"]) }}&nbsp;</td>
<td style="width:50px;"> <div></div></td> <td class="table-bordered" align="center" style="{{$entry["trendCol2"]}}">&nbsp;{{ str_replace("-1","x",$entry["tipp_score4"]) }}&nbsp;</td>
<td style="width:50px;"> <div></div></td> <td class="table-bordered"><div style="margin: 0 auto; width: 32px;"><img src="/img/joker.png" style="{{ ($entry["joker2"]? 'float:left;width:32px;height:32px' : 'display: none;') }}"></div></td>
<td style="width:50px;"> <div></div></td> <td class="table-bordered" align="center" style="{{$entry["trendCol3"]}}">&nbsp;{{ str_replace("-1","x",$entry["tipp_score5"]) }}&nbsp;</td>
<td style="width:50px;"> <div></div></td> <td class="table-bordered" align="center" style="{{$entry["trendCol3"]}}">&nbsp;{{ str_replace("-1","x",$entry["tipp_score6"]) }}&nbsp;</td>
<td style="width:50px;"> <div></div></td> <td class="table-bordered"><div style="margin: 0 auto; width: 32px;"><img src="/img/joker.png" style="{{ ($entry["joker3"] ? 'float:left;width:32px;height:32px' : 'display: none;') }}"></div></td>
<td style="width:50px;"> <div></div></td> <td class="table-bordered" align="center" style="{{$entry["trendCol4"]}}">&nbsp;{{ str_replace("-1","x",$entry["tipp_score7"]) }}&nbsp;</td>
<td style="width:50px;"> <div></div></td> <td class="table-bordered" align="center" style="{{$entry["trendCol4"]}}">&nbsp;{{ str_replace("-1","x",$entry["tipp_score8"]) }}&nbsp;</td>
<td class="table-bordered"><div style="margin: 0 auto; width: 32px;"><img src="/img/joker.png" style="{{ ($entry["joker4"] ? 'float:left;width:32px;height:32px' : 'display: none;') }}"></div></td>
<td class="table-bordered" align="center" >&nbsp;{{ $entry["dayscore"] }}&nbsp;</td>
</tr> </tr>
</table>
<p>&nbsp;</p> @endforeach
<!-- Control Cell width -->
<tr>
<td> <div></div></td>
<td> <div></div></td>
<td style="width:50px;"> <div></div></td>
<td style="width:50px;"> <div></div></td>
<td style="width:50px;"> <div></div></td>
<td style="width:50px;"> <div></div></td>
<td style="width:50px;"> <div></div></td>
<td style="width:50px;"> <div></div></td>
<td style="width:50px;"> <div></div></td>
<td style="width:50px;"> <div></div></td>
<td style="width:50px;"> <div></div></td>
<td style="width:50px;"> <div></div></td>
<td style="width:50px;"> <div></div></td>
<td style="width:50px;"> <div></div></td>
<td style="width:50px;"> <div></div></td>
<td style="width:50px;"> <div></div></td>
</tr>
</table>
</div> <p>&nbsp;</p>
</div> </div>
</div>
@endsection @endsection

View file

@ -1,205 +0,0 @@
@extends('layouts.layout')
@section('content')
<div style="float:left;left:10%">
@foreach($all_rounds as $r)
@if (App\Round::hasLockedGame($r->id) )
<div>
@if ($r->id == $round->id)
<label>{{$r->name}}</label>
@else
<a href="/users/ranking2/{{$r->id}}">{{$r->name}}</a>
@endif
</div>
@endif
@endforeach
</div>
<div style="float:left; position:relative;left:47%">
<div style="float:left; position:relative; left:-50%;">
<h3>Saison: {{ App\Season::getCurrent()->name }}</h3>
<h4>Runde: {{ $round->name }}</h4>
<h4>Rangliste und Tippübersicht</h4>
<table>
<tr>
<td style="width:50px;background-color:grey"></td>
<td style="width:250px;">=richtige Tendenz</td>
</tr>
<tr>
<td style="width:50px;background-color:orange"></td>
<td style="width:250px;">=richtiges Ergebnis</td>
</tr>
<tr>
<td style="width:50px;background-color:red"></td>
<td style="width:250px;">=richtiges Ergebnis mit Joker</td>
</tr>
</table>
<p>&nbsp;</p>
<table>
<th style="height:140px;white-space: nowrap;">
<div style="transform:translate(25px, 51px) rotate(315deg);width:30px;">
<span style="border-bottom: 1px solid #ccc; padding: 5px 10px;width:50px;">Rang</span>
</div>
</th>
<th style="height:140px;white-space: nowrap;">
<div style="transform:translate(25px, 51px) rotate(315deg);width:30px;">
<span style="border-bottom: 1px solid #ccc; padding: 5px 10px;width:50px;">Tagessieg</span>
</div>
</th>
<th style="height:140px;white-space: nowrap;">
<div style="transform:translate(25px, 51px) rotate(315deg);width:30px;">
<span style="border-bottom: 1px solid #ccc; padding: 5px 10px;width:150px;">Spieler</span>
</div>
</th>
<th style="height:140px;white-space: nowrap;">
<div style="transform:translate(25px, 51px) rotate(315deg);width:30px;">
<span style="border-bottom: 1px solid #ccc; padding: 5px 10px;">Punkte Gesamt</span>
</div>
</th>
<th style="height:140px;white-space: nowrap;">
<div style="transform:translate(25px, 51px) rotate(315deg);width:30px;">
<span style="border-bottom: 1px solid #ccc; padding: 5px 10px;">Punkte Tag</span>
</div>
</th>
<th style="height:140px;white-space: nowrap;">
<div style="transform:translate(25px, 51px) rotate(315deg);width:30px;">
<span style="border-bottom: 1px solid #ccc; padding: 5px 10px;">{{$games[0]->team1}}</span>
</div>
</th>
<th style="height:140px;white-space: nowrap;">
<div style="transform:translate(25px, 51px) rotate(315deg);width:30px;">
<span style="border-bottom: 1px solid #ccc; padding: 5px 10px;">{{$games[0]->team2}}</span>
</div>
</th>
<th style="height:140px;white-space: nowrap;">
<div style="transform:translate(25px, 51px) rotate(315deg);width:30px;">
<span style="border-bottom: 1px solid #ccc; padding: 5px 10px;">Joker</span>
</div>
</th>
<th style="height:140px;white-space: nowrap;">
<div style="transform:translate(25px, 51px) rotate(315deg);width:30px;">
<span style="border-bottom: 1px solid #ccc; padding: 5px 10px;">{{$games[1]->team1}}</span>
</div>
</th>
<th style="height:140px;white-space: nowrap;">
<div style="transform:translate(25px, 51px) rotate(315deg);width:30px;">
<span style="border-bottom: 1px solid #ccc; padding: 5px 10px;">{{$games[1]->team2}}</span>
</div>
</th>
<th style="height:140px;white-space: nowrap;">
<div style="transform:translate(25px, 51px) rotate(315deg);width:30px;">
<span style="border-bottom: 1px solid #ccc; padding: 5px 10px;">Joker</span>
</div>
</th>
<th style="height:140px;white-space: nowrap;">
<div style="transform:translate(25px, 51px) rotate(315deg);width:30px;">
<span style="border-bottom: 1px solid #ccc; padding: 5px 10px;">{{$games[2]->team1}}</span>
</div>
</th>
<th style="height:140px;white-space: nowrap;">
<div style="transform:translate(25px, 51px) rotate(315deg);width:30px;">
<span style="border-bottom: 1px solid #ccc; padding: 5px 10px;">{{$games[2]->team2}}</span>
</div>
</th>
<th style="height:140px;white-space: nowrap;">
<div style="transform:translate(25px, 51px) rotate(315deg);width:30px;">
<span style="border-bottom: 1px solid #ccc; padding: 5px 10px;">Joker</span>
</div>
</th>
<th style="height:140px;white-space: nowrap;">
<div style="transform:translate(25px, 51px) rotate(315deg);width:30px;">
<span style="border-bottom: 1px solid #ccc; padding: 5px 10px;">{{$games[3]->team1}}</span>
</div>
</th>
<th style="height:140px;white-space: nowrap;">
<div style="transform:translate(25px, 51px) rotate(315deg);width:30px;">
<span style="border-bottom: 1px solid #ccc; padding: 5px 10px;">{{$games[3]->team2}}</span>
</div>
</th>
<th style="height:140px;white-space: nowrap;">
<div style="transform:translate(25px, 51px) rotate(315deg);width:30px;">
<span style="border-bottom: 1px solid #ccc; padding: 5px 10px;">Joker</span>
</div>
</th>
<th style="height:140px;white-space: nowrap;">
<div style="transform:translate(25px, 51px) rotate(315deg);width:30px;">
<span style="border-bottom: 1px solid #ccc; padding: 5px 10px;">Debug (DayWinScore)</span>
</div>
</th>
@foreach($rankingDisplay as $entry)
<tr>
<td class="table-bordered">&nbsp;<span class="text list-unstyled" href="#" >&nbsp;{{ $entry["rank"] }}&nbsp;</span></td>
<td class="table-bordered"><div style="margin: 0 auto; width: 32px;"><img src="/img/crown.png" style="{{ ($entry["is_dayscorewinner"] ? 'float:left;width:32px;height:32px' : 'display: none;') }}"></div></td>
<td class="table-bordered">&nbsp;<a class="text list-unstyled" href="#" style="vertical-align: middle;">{{ $entry["user_name"] }} &nbsp;</a></td>
<td class="table-bordered" align="center">&nbsp;{{ $entry["rankscore_total"] }}&nbsp;</td>
<td class="table-bordered" align="center">&nbsp;{{ $entry["rankscore"] }}&nbsp;</td>
<td class="table-bordered" align="center" style="{{$entry["trendCol1"]}}">&nbsp;{{ $entry["tipp_score1"] }}&nbsp;</td>
<td class="table-bordered" align="center" style="{{$entry["trendCol1"]}}">&nbsp;{{ $entry["tipp_score2"] }}&nbsp;</td>
<td class="table-bordered"><div style="margin: 0 auto; width: 32px;"><img src="/img/joker.png" style="{{ ($entry["joker1"] ? 'float:left;width:32px;height:32px' : 'display: none;') }}"></div></td>
<td class="table-bordered" align="center" style="{{$entry["trendCol2"]}}">&nbsp;{{$entry["tipp_score3"] }}&nbsp;</td>
<td class="table-bordered" align="center" style="{{$entry["trendCol2"]}}">&nbsp;{{$entry["tipp_score4"] }}&nbsp;</td>
<td class="table-bordered"><div style="margin: 0 auto; width: 32px;"><img src="/img/joker.png" style="{{ ($entry["joker2"]? 'float:left;width:32px;height:32px' : 'display: none;') }}"></div></td>
<td class="table-bordered" align="center" style="{{$entry["trendCol3"]}}">&nbsp;{{$entry["tipp_score5"] }}&nbsp;</td>
<td class="table-bordered" align="center" style="{{$entry["trendCol3"]}}">&nbsp;{{$entry["tipp_score6"] }}&nbsp;</td>
<td class="table-bordered"><div style="margin: 0 auto; width: 32px;"><img src="/img/joker.png" style="{{ ($entry["joker3"] ? 'float:left;width:32px;height:32px' : 'display: none;') }}"></div></td>
<td class="table-bordered" align="center" style="{{$entry["trendCol4"]}}">&nbsp;{{$entry["tipp_score7"] }}&nbsp;</td>
<td class="table-bordered" align="center" style="{{$entry["trendCol4"]}}">&nbsp;{{$entry["tipp_score8"] }}&nbsp;</td>
<td class="table-bordered"><div style="margin: 0 auto; width: 32px;"><img src="/img/joker.png" style="{{ ($entry["joker4"] ? 'float:left;width:32px;height:32px' : 'display: none;') }}"></div></td>
<td class="table-bordered" align="center" >&nbsp;{{ $entry["dayscore"] }}&nbsp;</td>
</tr>
@endforeach
<!-- Control Cell width -->
<tr>
<td> <div></div></td>
<td> <div></div></td>
<td style="width:50px;"> <div></div></td>
<td style="width:50px;"> <div></div></td>
<td style="width:50px;"> <div></div></td>
<td style="width:50px;"> <div></div></td>
<td style="width:50px;"> <div></div></td>
<td style="width:50px;"> <div></div></td>
<td style="width:50px;"> <div></div></td>
<td style="width:50px;"> <div></div></td>
<td style="width:50px;"> <div></div></td>
<td style="width:50px;"> <div></div></td>
<td style="width:50px;"> <div></div></td>
<td style="width:50px;"> <div></div></td>
<td style="width:50px;"> <div></div></td>
<td style="width:50px;"> <div></div></td>
</tr>
</table>
<p>&nbsp;</p>
</div>
</div>
@endsection

View file

@ -43,7 +43,6 @@ Route::get('/users','UsersController@index');
Route::get('/users/edit/{user_id}','UsersController@edit'); Route::get('/users/edit/{user_id}','UsersController@edit');
Route::post('/users/store','UsersController@store'); Route::post('/users/store','UsersController@store');
Route::get('/users/ranking/{round_id}','UsersController@ranking'); Route::get('/users/ranking/{round_id}','UsersController@ranking');
Route::get('/users/ranking2/{round_id}','UsersController@ranking2');
Route::get('/tipps','TippsController@index'); Route::get('/tipps','TippsController@index');
Route::get('/tipps/edit/{tipp_id}','TippsController@edit'); Route::get('/tipps/edit/{tipp_id}','TippsController@edit');