diff --git a/pfosten/app/Http/Controllers/UsersController.php b/pfosten/app/Http/Controllers/UsersController.php index b96628c5..4bd8b06e 100755 --- a/pfosten/app/Http/Controllers/UsersController.php +++ b/pfosten/app/Http/Controllers/UsersController.php @@ -271,6 +271,7 @@ class UsersController extends Controller $rankingDisplay[$user_id]["user_name"] = $roundtipps[$key]["user_name"]; $rankingDisplay[$user_id]["is_dayscorewinner"] = $roundtipps[$key]["is_dayscorewinner"]; + $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"]; diff --git a/pfosten/app/Tipp.php b/pfosten/app/Tipp.php index 490347da..e21d7472 100755 --- a/pfosten/app/Tipp.php +++ b/pfosten/app/Tipp.php @@ -305,6 +305,7 @@ class Tipp extends Model $roundtipps[$key]['hits']=0; // Wenigstens Tendenz getroffen. Wenn 4, dann 2 Punkte Bonus auf rankscore $roundtipps[$key]['is_dayscorewinner']=0; $roundtipps[$key]["ranking_payout"]=0; // Existiert nur in der letzten Runde + } if (!array_key_exists('is_completed',$roundData[$round_id])) { $roundData[$round_id]['is_completed'] = true; @@ -363,14 +364,6 @@ class Tipp extends Model $totalRankScore += $roundtipps[$key]["rankscore"]; $roundtipps[$key]['totalRankScore'] = $totalRankScore; - // - // ADD-ON: Foul-Detection for GreenShirt(grĂ¼nes Trikot) - // - $isFoul = ( $roundtipps[$key]["rankscore"] == 0 ); - if ( $isFoul ) { $foulCount += 1; } - $roundtipps[$key]['gshirt_foulcount'] = $foulCount; - if ($foulCount==3) $foulCount=0; - } } @@ -451,22 +444,56 @@ class Tipp extends Model $rank= $roundtipps[$key]["rank"]; if ($rank<=5) { $roundtipps[$key]["gshirt_score"] = $scoreGain[$rank] / $members[$rank]; + } else { + $roundtipps[$key]["gshirt_score"]=0; } } } // B) SET GSCORE TOTAL EVERY ROUND ( and take fouls into consideration ) - foreach ($round_ids as $round_id) { - foreach($user_ids as $user_id) { - $key = $round_id . "_" . $user_id; - $roundtipps[$key]['gshirt_totalscore']=0; - $roundtipps[$key]['gshirt_foulcount']=0; + + + +foreach($user_ids as $user_id) { + foreach($round_ids as $round_id) { + $key=$round_id."_".$user_id; + $roundtipps[$key]['gshirt_totalscore']=-1; + $roundtipps[$key]['gshirt_foulcount']=-1; + } +} + + +/* FIND BUG ! + foreach($user_ids as $user_id) { + $foulCount=0; + $totalScore=0; + foreach ($round_ids as $round_id) { + $key = $round_id . "_" . $user_id; + $score = $roundtipps[$key]['gshirt_score']; + $isFoul = ( $roundtipps[$key]["rankscore"] == 0 ); + if ($isFoul) { + $foulCount+=1; + if ($foulCount==3) { + $foulCount=0; + $totalScore=0; + } + } + $totalScore+=$score; + $roundtipps[$key]['gshirt_totalscore']=$totalScore; + $roundtipps[$key]['gshirt_foulcount']=$foulCount; + + if ($user_id==14) { + error_log("round_id=" . $round_id .",gshirt_score=".$roundtipps[$key]['gshirt_score'].", score=" . $score.", totalScore=".$totalScore); + } + + error_log("Test: key=".$key.", ".$roundtipps[$key]['gshirt_score']); } } - + //dd("stop"); +*/ ////////////////////////////// // START OF HURTFUL 6 PLACE RESTRICTION IF DAYSCORE WIN (exception: completely even scores) diff --git a/pfosten/resources/views/users/ranking.blade.php b/pfosten/resources/views/users/ranking.blade.php index dee03b8d..bff47e62 100755 --- a/pfosten/resources/views/users/ranking.blade.php +++ b/pfosten/resources/views/users/ranking.blade.php @@ -169,7 +169,7 @@  {{ $entry["totalRankScore"] }}   {{ $entry["rankscore"] }}      -  {{ $entry["gshirt_totalscore"]." (".$entry["gshirt_foulcount"].")" }}  +  {{ $entry["gshirt_score"]." / ".$entry["gshirt_totalscore"]." (".$entry["gshirt_foulcount"].")" }}       {{ str_replace("-1","x",$entry["tipp_score1"]) }}   {{ str_replace("-1","x",$entry["tipp_score2"]) }}