diff --git a/pfosten/app/Http/Controllers/UsersController.php b/pfosten/app/Http/Controllers/UsersController.php index 8ad0386f..b96628c5 100755 --- a/pfosten/app/Http/Controllers/UsersController.php +++ b/pfosten/app/Http/Controllers/UsersController.php @@ -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) { diff --git a/pfosten/app/Tipp.php b/pfosten/app/Tipp.php index e99cd1ce..e6937867 100755 --- a/pfosten/app/Tipp.php +++ b/pfosten/app/Tipp.php @@ -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; diff --git a/pfosten/resources/views/users/ranking.blade.php b/pfosten/resources/views/users/ranking.blade.php index 7a275672..dee03b8d 100755 --- a/pfosten/resources/views/users/ranking.blade.php +++ b/pfosten/resources/views/users/ranking.blade.php @@ -75,6 +75,14 @@ Punkte Tag +   + + +
+ grünes Trikot +
+ +  
@@ -161,6 +169,8 @@  {{ $entry["totalRankScore"] }}   {{ $entry["rankscore"] }}      +  {{ $entry["gshirt_totalscore"]." (".$entry["gshirt_foulcount"].")" }}  +      {{ str_replace("-1","x",$entry["tipp_score1"]) }}   {{ str_replace("-1","x",$entry["tipp_score2"]) }}