Working on gshirt score calculation
This commit is contained in:
parent
1c0dceb278
commit
86803fa23a
3 changed files with 43 additions and 15 deletions
|
|
@ -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"];
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -169,7 +169,7 @@
|
|||
<td class="table-bordered" align="center"> {{ $entry["totalRankScore"] }} </td>
|
||||
<td class="table-bordered" align="center"> {{ $entry["rankscore"] }} </td>
|
||||
<td class="table-bordered" align="center" style="border: 0px"> </td> <!-- Spacer column -->
|
||||
<td class="table-bordered" align="center" style="{{$entry["trendCol1"]}}"> {{ $entry["gshirt_totalscore"]." (".$entry["gshirt_foulcount"].")" }} </td>
|
||||
<td class="table-bordered" align="center" style="{{$entry["trendCol1"]}}"> {{ $entry["gshirt_score"]." / ".$entry["gshirt_totalscore"]." (".$entry["gshirt_foulcount"].")" }} </td>
|
||||
<td class="table-bordered" align="center" style="border: 0px"> </td> <!-- Spacer column -->
|
||||
<td class="table-bordered" align="center" style="{{$entry["trendCol1"]}}"> {{ str_replace("-1","x",$entry["tipp_score1"]) }} </td>
|
||||
<td class="table-bordered" align="center" style="{{$entry["trendCol1"]}}"> {{ str_replace("-1","x",$entry["tipp_score2"]) }} </td>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue