Fixing creation of new player league

This commit is contained in:
Torsten 2018-01-01 18:25:56 +01:00
parent 9126d54dfb
commit d6a51ea2c6
16 changed files with 154 additions and 507 deletions

View file

@ -247,13 +247,6 @@ class Tipp extends Model
// TODO: Implement partial caching
public static function getRoundTipps($max_round_id=-1, $seasonId=-1)
{
$currentSeason = null;
if ($seasonId == null) {
$currentSeason = Season::getCurrent();
} else {
$currentSeason = Season::where('id', '=', $seasonId)->first();
}
$startTime = microtime(true);
$currentSeason = Season::getCurrent();
@ -261,7 +254,10 @@ class Tipp extends Model
$currentSeason = Season::where('id', '=', $seasonId)->first();
};
if (Round::getLastLockedRoundId()==-1) return null;
if (Round::getLastCompleteRoundId($seasonId)==-1) {
error_log("Tipp::getRoundTipps returns null, because there is no completeRoundId");
return null;
}
// Hier werden _alle_ Tipps der aktuellen Saison ausgerechnet, die $round_id Begrenzung wird erst später ausgewertet.
// TODO: Nur die Runden durchrechnen, die aktuell sind, oder round_incomplete, alle anderen Runden (bis zur ersten unvollständigen) sollen in eine Cachetabelle gespeichert werden.
@ -500,6 +496,9 @@ class Tipp extends Model
$grank= $roundtipps[$key]["grank"];
if ($grank<=5) {
$gain = round($scoreGain[$grank] / $members[$grank], 2);
if ($gain>0) {
$gain+=$roundtipps[$key]["rankscore"]; // Gemachte Punkte draufrechnen
}
$roundtipps[$key]["gshirt_score"] = $gain;
} else {
$roundtipps[$key]["gshirt_score"]=0;
@ -518,7 +517,7 @@ class Tipp extends Model
$score = $roundtipps[$key]['gshirt_score'];
$isFoul = ( $roundtipps[$key]['rankscore'] == 0 && $totalScore > 0 );
if ($isFoul) {
Log::info("Foul => round_id _ user_id=".$key." / totalRankScore=".$roundtipps[$key]["totalRankScore"]);
//Log::info("Foul => round_id _ user_id=".$key." / totalRankScore=".$roundtipps[$key]["totalRankScore"]);
$foulCount+=1;
if ($foulCount==3) {
$foulCount=0;