Working on Qualification Pairings

This commit is contained in:
Torsten 2017-09-22 17:40:48 +02:00
parent 9c0f94758d
commit a66189ca00
19 changed files with 9005 additions and 237 deletions

View file

@ -328,10 +328,7 @@ class Tipp extends Model
foreach($user_ids as $user_id) {
$totalRankScore=0;
foreach($round_ids as $round_id) {
$key=$round_id."_".$user_id;
// Compute Dayscore values
$dayScore1WithRankScore = Tipp::getDayScoreLocal($roundtipps[$key]['results'][0],$roundtipps[$key]['results'][1],$roundtipps[$key]['tipps'][0],$roundtipps[$key]['tipps'][1],$roundtipps[$key]['joker'][0],$roundtipps[$key]['rankscore']);
$dayScore2WithRankScore = Tipp::getDayScoreLocal($roundtipps[$key]['results'][2],$roundtipps[$key]['results'][3],$roundtipps[$key]['tipps'][2],$roundtipps[$key]['tipps'][3],$roundtipps[$key]['joker'][1],$roundtipps[$key]['rankscore']);
@ -392,54 +389,53 @@ class Tipp extends Model
$round_count=0;
foreach ($round_ids as $round_id) {
$round_count +=1;
$round_count += 1;
$totalDayWinPayout += $payouts["tagessieg"];
$highestDayScore = $highestDayscores[$round_id];
$usersWithHighestDayScore = array();
$round_completed=false;
$round_completed = false;
foreach ($user_ids as $user_id) {
$round_completed = $roundtipps[$key]['round_completed']; // TODO: Separaten info array roundData erzeugen, der Rundenspezifische, SPielerübergreifende Infos enthält, so wie round_completed.
$key = $round_id . "_" . $user_id;
if ($roundtipps[$key]['dayscore'] == $highestDayScore && $roundtipps[$key]['round_completed'] && $highestDayScore>0 ) {
if ($roundtipps[$key]['dayscore'] == $highestDayScore && $roundtipps[$key]['round_completed'] && $highestDayScore > 0) {
array_push($usersWithHighestDayScore, [$user_id, $roundtipps[$key]['dayScoreWithRankScore']]);
}
}
if (sizeof($usersWithHighestDayScore) > 6) {
//usort($usersWithHighestDayScore, 'cmpDayWin');
usort($usersWithHighestDayScore, array('App\Tipp','cmpDayWin'));
}
$count = 0;
$cutOffScore = 0;
$dayScoreWinnersIds = array();
foreach ($usersWithHighestDayScore as $user) { // Feld0: user_id, dayScoreWithRankScore
//ALT
/*
$count += 1;
if ($count > 6) {
if ($user[1] < $cutOffScore) {
$dayScoreWinnersIds = array();
// Bei >6 Tagessiegern über rankscore reduzieren
if (sizeof($usersWithHighestDayScore) > 6) {
usort($usersWithHighestDayScore, array('App\Tipp', 'cmpDayWin'));
$count = 0;
$cutOffScore = 0;
foreach ($usersWithHighestDayScore as $user) { // Feld0: user_id, dayScoreWithRankScore
$key = $max_round_id . "_" . $user[0]; // Hier: $user[0] = user_id, $user[1] = dayScore WithRankScore
$rankscore = $user[1];
$count += 1;
if ($count == 1) {
$cutOffScore = $rankscore;
}
if ($rankscore < $cutOffScore) {
break;
}
array_push($dayScoreWinnersIds, $user[0]);
$key = $round_id . "_" . $user[0];
$roundtipps[$key]['is_dayscorewinner'] = true;
}
array_push($dayScoreWinnersIds, $user[0]);
$key = $round_id . "_" . $user[0];
$roundtipps[$key]['is_dayscorewinner'] = true;
$cutOffScore = $user[1];
*/
// NEU
$key = $max_round_id . "_" . $user[0]; // Hier: $user[0] = user_id, $user[1] = dayScore WithRankScore
$rankscore = $roundtipps[$key]['rankscore'];
$count += 1;
if ($count==1) {$cutOffScore=$rankscore;}
if ($rankscore < $cutOffScore) { break; }
array_push($dayScoreWinnersIds, $user[0]);
$key = $round_id . "_" . $user[0];
$roundtipps[$key]['is_dayscorewinner'] = true;
}
// Bei bis zu 6 Gewinnern normal als Sieger klassifizieren
else {
foreach ($usersWithHighestDayScore as $user) {
array_push($dayScoreWinnersIds, $user[0]);
$key = $round_id . "_" . $user[0];
$roundtipps[$key]['is_dayscorewinner'] = true;
}
}
// Compute Dayscorewin payout (Tagessieg)