TimeLogger moved, League ranking also for not completed but started rounds

This commit is contained in:
Torsten 2018-08-17 17:16:01 +02:00
parent 78a4a04cdf
commit 90c6d60ecd
26 changed files with 692 additions and 376 deletions

View file

@ -13,6 +13,8 @@ use App\Leagues\LeagueMember;
use DB;
use Log;
use App\MyClasses;
class League extends Model
{
@ -159,9 +161,12 @@ class League extends Model
$memberScores[$memberId] = $tpl;
}
$lastLockedRoundId=Round::getLastLockedRoundId();
Log::info("LASTLOCKKEDROUNDID=".$lastLockedRoundId);
$matches=Match::getMatchResults($league->id,-1);
foreach ($matches as $match) {
if (Round::isCompleted($match->round_id)) {
if (Round::isCompleted($match->round_id) || $match->round_id==$lastLockedRoundId ) {
$memberScores[$match->user1_id][1] += $match->user1_league_score;
error_log("+++ ".$match->user1_id." +".$match->user1_league_score);
$memberScores[$match->user1_id][2] += $match->user1_rankscore; // goals
@ -215,6 +220,9 @@ class League extends Model
// Nur für Auf und Abstiegsberechnung.
// Schreibt den zukünftigen Rank auf Index4
public static function getTotalRankingOverall($seasonId=-1) {
$a=new MyClasses\TimeLogger("League::getTotalRankingOverall (seasonId=".$seasonId.")");
Log::info($a->getStartMessage());
$userNames = User::getNames();
$totalRanking=array();
@ -386,7 +394,10 @@ class League extends Model
Log::info($a->getEndMessage());
//error_log($a->getEndMessage());
return $totalRanking;
}

View file

@ -258,14 +258,18 @@ class Match extends Model
$roundtipps = $roundtipps["roundtipps"];
$matches = Match::getLeagueMatches($leagueId, $maxRoundId);
if ($maxRoundId==-1) { $maxRoundId = Round::getLastRoundId($season->id); }
if ($maxRoundId==-1) {
//$maxRoundId = Round::getLastRoundId($season->id);
$maxRoundId = Round::getLastLockedRoundId($season->id);
Log::info("LASTLOCKEDROUND_ID=".$maxRoundId);
}
foreach($matches as $key => $match) {
$user1_key = $match->round_id."_".$match->user1_id;
$user2_key = $match->round_id."_".$match->user2_id;
if (Round::isCompleted($match->round_id)) {
if (array_key_exists($user1_key,$roundtipps ) && array_key_exists($user2_key,$roundtipps) ) {
$user1_score = $roundtipps[$user1_key]["rankscore"];
$user2_score = $roundtipps[$user2_key]["rankscore"];