This commit is contained in:
Torsten 2017-12-04 10:20:12 +01:00
parent abf66ea3c9
commit 71280dcd66
3 changed files with 52 additions and 7 deletions

View file

@ -271,12 +271,12 @@ class UsersController extends Controller
$rankingDisplay[$user_id]["user_name"] = $roundtipps[$key]["user_name"];
$rankingDisplay[$user_id]["is_dayscorewinner"] = $roundtipps[$key]["is_dayscorewinner"];
if ($round_id=="13") {
Log::info('userid '.$user_id." [".$key."]");
Log::info($roundtipps[$key]["is_dayscorewinner"]);
Log::info($roundtipps[$key]["payout"]);
$rankingDisplay[$user_id]["gshirt_totalscore"] = $roundtipps[$key]["gshirt_totalscore"];
$rankingDisplay[$user_id]["gshirt_foulcount"] = $roundtipps[$key]["gshirt_foulcount"];
}
$rankingDisplay[$user_id]["ranking_payout"] = $roundtipps[$key]["ranking_payout"];
if ($roundtipps[$key]["ranking_payout"]>0) {

View file

@ -332,11 +332,21 @@ class Tipp extends Model
}
// NOW ALL KEYS FOR ROUNDTIPPS (ROUND & USER) EXIST
// CALCULATION OF SCORES, RANKS, ETC. (COMPUTE AGGREGATED VALUES)
/////////////////////////////////////////////////////////////////////
// CALCULATION OF SCORES, RANKS, ETC. (COMPUTE AGGREGATED VALUES)
/////////////////////////////////////////////////////////////////////
$highestDayscores=array();
foreach($user_ids as $user_id) {
$totalRankScore=0;
$totalGShirtScore=0; // Green Shirt Score Accumulator
$foulCount=0; // Green Shirt Foul Counter
foreach($round_ids as $round_id) {
$key=$round_id."_".$user_id;
// Compute Dayscore values
@ -356,6 +366,31 @@ class Tipp extends Model
$totalRankScore += $roundtipps[$key]["rankscore"];
$roundtipps[$key]['totalRankScore'] = $totalRankScore;
//
// ADD-ON: Scores für GreenShirt(grünes Trikot)
$dayScore1 = Tipp::getScoreLocal($roundtipps[$key]['results'][0],$roundtipps[$key]['results'][1],$roundtipps[$key]['tipps'][0],$roundtipps[$key]['tipps'][1],$roundtipps[$key]['joker'][0]);
$dayScore2 = Tipp::getScoreLocal($roundtipps[$key]['results'][2],$roundtipps[$key]['results'][3],$roundtipps[$key]['tipps'][2],$roundtipps[$key]['tipps'][3],$roundtipps[$key]['joker'][1]);
$dayScore3 = Tipp::getScoreLocal($roundtipps[$key]['results'][4],$roundtipps[$key]['results'][5],$roundtipps[$key]['tipps'][4],$roundtipps[$key]['tipps'][5],$roundtipps[$key]['joker'][2]);
$dayScore4 = Tipp::getScoreLocal($roundtipps[$key]['results'][6],$roundtipps[$key]['results'][7],$roundtipps[$key]['tipps'][6],$roundtipps[$key]['tipps'][7],$roundtipps[$key]['joker'][3], false);
$dayScoreValue = $dayScore1 + $dayScore2 + $dayScore3 + $dayScore4;
$isFoul = ( $dayScoreValue == 0 );
if ( $isFoul ) { $foulCount += 1; }
if ( $foulCount > 2 ) {
$totalGShirtScore = 0;
$foulCount = 0;
} else {
$totalGShirtScore += $dayScoreValue;
Log::info("!!!!> Adding score: ".$dayScoreValue);
}
$roundtipps[$key]['gshirt_totalscore'] = $totalGShirtScore;
$roundtipps[$key]['gshirt_foulcount'] = $foulCount;
}
}
@ -400,7 +435,7 @@ class Tipp extends Model
$round_count=0;
error_log("Round ids: ".implode(",",$round_ids));
//error_log("Round ids: ".implode(",",$round_ids));
foreach ($round_ids as $round_id) {
$round_count += 1;

View file

@ -75,6 +75,14 @@
<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;">grünes Trikot</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;">
@ -161,6 +169,8 @@
<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="{{$entry["trendCol1"]}}">&nbsp;{{ $entry["gshirt_totalscore"]." (".$entry["gshirt_foulcount"].")" }}&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>