GreenShirt Display in Ranking

This commit is contained in:
Torsten 2018-01-12 08:40:42 +01:00
parent 8595808fd2
commit 08ffdf5609
4 changed files with 29 additions and 14 deletions

View file

@ -279,6 +279,7 @@ class UsersController extends Controller
$rankingDisplay[$user_id]["gshirt_score"] = $roundtipps[$key]["gshirt_score"];
$rankingDisplay[$user_id]["gshirt_totalscore"] = $roundtipps[$key]["gshirt_totalscore"];
$rankingDisplay[$user_id]["gshirt_foulcount"] = $roundtipps[$key]["gshirt_foulcount"];
$rankingDisplay[$user_id]["gshirt_leader"] = $roundtipps[$key]["gshirt_leader"];

View file

@ -507,6 +507,7 @@ class Tipp extends Model
}
// B) SET GSCORE TOTAL EVERY ROUND ( and take fouls into consideration )
$maxScorePerRound=array();
foreach($user_ids as $user_id) {
$foulCount=0;
$totalScore=0;
@ -514,6 +515,8 @@ class Tipp extends Model
foreach ($round_ids as $round_id) {
$key = $round_id . "_" . $user_id;
if (!array_key_exists($round_id, $maxScorePerRound)) { $maxScorePerRound[$round_id]=0; }
$score = $roundtipps[$key]['gshirt_score'];
$isFoul = ( $roundtipps[$key]['rankscore'] == 0 && $totalScore > 0 );
if ($isFoul) {
@ -522,10 +525,14 @@ class Tipp extends Model
if ($foulCount==3) {
$foulCount=0;
$totalScore=0;
$roundtipps[$key]['gshirt_foul_reset']=1;
} else {
$roundtipps[$key]['gshirt_foul_reset']=0;
}
}
$lastTotalRankScore=
$totalScore += $score;
if ($totalScore > $maxScorePerRound[$round_id]) { $maxScorePerRound[$round_id]=$totalScore; }
$roundtipps[$key]['gshirt_totalscore']=$totalScore;
$roundtipps[$key]['gshirt_foulcount']=$foulCount;
@ -534,6 +541,19 @@ class Tipp extends Model
}
}
// C) Set gscore_leader
foreach ($round_ids as $round_id) {
foreach($user_ids as $user_id) {
$key = $round_id . "_" . $user_id;
if ($roundtipps[$key]['gshirt_totalscore'] == $maxScorePerRound[$round_id] && $maxScorePerRound[$round_id]>0 ) {
$roundtipps[$key]['gshirt_leader'] =1;
} else {
$roundtipps[$key]['gshirt_leader'] =0;
}
}
}
//dd("User 11 Round 1 gshirt_score =".$roundtipps['1_11']['gshirt_score'].", totalscore=".$roundtipps['1_11']['gshirt_totalscore']);

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

View file

@ -60,6 +60,12 @@
<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(10px, 51px) rotate(270deg);width:30px;">
<span style="border-bottom: 1px solid #ccc; padding: 5px 10px;width:50px;">Grünes Trikot</span>
</div>
</th>
<th style="height:140px;white-space: nowrap;">
<div style="transform:translate(10px, 51px) rotate(270deg);width:30px;">
<span style="border-bottom: 1px solid #ccc; padding: 5px 10px;width:150px;">Spieler</span>
@ -75,17 +81,6 @@
<span style="border-bottom: 1px solid #ccc; padding: 5px 10px;">Punkte Tag</span>
</div>
</th>
<th>&nbsp;</th><!-- Spacer Column -->
<th style="height:140px;white-space: nowrap;">
<div style="transform:translate(10px, 51px) rotate(270deg);width:30px;">
<span style="border-bottom: 1px solid #ccc; padding: 5px 10px;">G-Rang</span>
</div>
</th>
<th style="height:140px;white-space: nowrap;">
<div style="transform:translate(10px, 51px) rotate(270deg);width:30px;">
<span style="border-bottom: 1px solid #ccc; padding: 5px 10px;">grünes Trikot</span>
</div>
</th>
<th>&nbsp;</th><!-- Spacer Column -->
<th style="height:140px;white-space: nowrap;">
@ -169,13 +164,12 @@
<td class="table-bordered" >&nbsp;<span class="text list-unstyled" href="#" >&nbsp;{{ $entry["rank"] }}&nbsp;</span></td>
<!-- <td class="table-bordered" align="center">&nbsp; $entry["dayScoreWithRankScore"] &nbsp;</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" align="center" style="">&nbsp;<img src="/img/green_shirt.png"/>&nbsp;</td>-->
<td class="table-bordered" align="center">&nbsp; <img src="/img/green_shirt.png" style="{{ ($entry["gshirt_leader"] ? 'width:32px;height:32px' : 'display: none;') }}"/> &nbsp;</td>
<td class="table-bordered">&nbsp;<a class="text list-unstyled {{ $entry['user_id']==Auth::user()->id ? 'blink_text' : '' }}" name="playerid_{{$entry['user_id']}}" href="#" style="vertical-align: middle;">{{ $entry["user_name"] }} &nbsp;</a></td>
<td class="table-bordered" align="center">&nbsp;{{ $entry["totalRankScore"] }}&nbsp;</td>
<td class="table-bordered" align="center">&nbsp;{{ $entry["rankscore"] }}&nbsp;</td>
<td class="table-bordered" align="center" style="border: 0px">&nbsp;&nbsp;&nbsp;</td> <!-- Spacer column -->
<td class="table-bordered" align="center" style="">&nbsp;{{ $entry["grank"] }}&nbsp;</td>
<td class="table-bordered" align="center" style="width:75px;">&nbsp;(+{{ $entry["gshirt_score"]}}) <br/>{{$entry["gshirt_totalscore"]}}<br/> {{$entry["gshirt_foulcount"]." Fouls" }}&nbsp;</td>
<td class="table-bordered" align="center" style="border: 0px">&nbsp;&nbsp;&nbsp;</td> <!-- Spacer column -->
<td class="table-bordered" align="center" style="{{$entry["trendCol1"]}}">&nbsp;{{ str_replace("-1","x",$entry["tipp_score1"]) }}&nbsp;</td>
<td class="table-bordered" align="center" style="{{$entry["trendCol1"]}}">&nbsp;{{ str_replace("-1","x",$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>