diff --git a/pfosten/app/Http/Controllers/UsersController.php b/pfosten/app/Http/Controllers/UsersController.php index 81de80af..6775d281 100755 --- a/pfosten/app/Http/Controllers/UsersController.php +++ b/pfosten/app/Http/Controllers/UsersController.php @@ -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"]; diff --git a/pfosten/app/Tipp.php b/pfosten/app/Tipp.php index 1f2bdcd6..03eaeb27 100755 --- a/pfosten/app/Tipp.php +++ b/pfosten/app/Tipp.php @@ -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']); diff --git a/pfosten/public/img/green_shirt.png b/pfosten/public/img/green_shirt.png new file mode 100644 index 00000000..0fe19462 Binary files /dev/null and b/pfosten/public/img/green_shirt.png differ diff --git a/pfosten/resources/views/users/ranking.blade.php b/pfosten/resources/views/users/ranking.blade.php index aa5757c0..9650e574 100755 --- a/pfosten/resources/views/users/ranking.blade.php +++ b/pfosten/resources/views/users/ranking.blade.php @@ -60,6 +60,12 @@ Tagessieg +

