working on gshirt

This commit is contained in:
Torsten 2017-12-11 08:47:56 +01:00
parent 0cef6e7747
commit a41157ea5b
3 changed files with 18 additions and 31 deletions

View file

@ -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]["grank"] = $roundtipps[$key]["grank"];
$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"];

View file

@ -442,16 +442,11 @@ class Tipp extends Model
}
}
////////////////////////////////////////////////////////
// Greenshirt Score Determination
// Loop again over roundtipps, sort each round, give/write forth greenshirt score
$userList=array(); // Only to detect ranks 1-5; score results will get written to roundtipps[$key]['...']
// (A) SET GSCORE EVERY ROUND
@ -476,18 +471,28 @@ class Tipp extends Model
$members[$grank]=0;
}
$members[$grank]+=1;
}
// A-2 compute gain
$scoreGain=[0,10,5,3,2,1]; // Rank 0 existiert nicht
// Move gain out of empty ranks into the upper ones.
foreach ([5,4,3,2,1] as $grank) {
if (!array_key_exists($grank,$members)) {
$scoreGain[$grank-1]+= $scoreGain[$grank];
$scoreGain[$grank]=0; // Shouldnt be needed, but makes movement of gain explicit
} else {
}
}
//dd($log."Rank gain: ".$scoreGain[1].", ".$scoreGain[2].", ".$scoreGain[3].", ",$scoreGain[4].", ".$scoreGain[5]);
// Distribute gain
foreach($user_ids as $user_id) {
$key = $round_id . "_" . $user_id;
@ -498,31 +503,11 @@ class Tipp extends Model
} else {
$roundtipps[$key]["gshirt_score"]=0;
}
if ($user_id==11) {
Log::info("round_id ".$round_id." grank=".$grank.", gshirt_score= ".$roundtipps[$key]["gshirt_score"]);
}
}
}
// B) SET GSCORE TOTAL EVERY ROUND ( and take fouls into consideration )
/*
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;
@ -542,10 +527,6 @@ foreach($user_ids as $user_id) {
$roundtipps[$key]['gshirt_totalscore']=$totalScore;
$roundtipps[$key]['gshirt_foulcount']=$foulCount;
if ($user_id==11) {
//error_log("round_id=" . $round_id .",gshirt_score=".$roundtipps[$key]['gshirt_score'].", score=" . $score.", totalScore=".$totalScore);
Log::info("round_id=" . $round_id .",gshirt_score=".$roundtipps[$key]['gshirt_score'].", score=" . $score.", totalScore=".$totalScore);
}
//error_log("Test: key=".$key.", ".$roundtipps[$key]['gshirt_score']);
//Log::info("Test: key=".$key.", ".$roundtipps[$key]['gshirt_score']);

View file

@ -76,7 +76,11 @@
</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;">G-Rang</span>
</div>
</th>
<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>
@ -169,6 +173,7 @@
<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["grank"] }}&nbsp;</td>
<td class="table-bordered" align="center" style="{{$entry["trendCol1"]}}">&nbsp;{{ $entry["gshirt_score"]." / ".$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>