Working on Case2: New League Creation after Qualification
This commit is contained in:
parent
d8a7f78cbd
commit
66671b1e81
11 changed files with 12726 additions and 40 deletions
|
|
@ -245,10 +245,20 @@ class Tipp extends Model
|
|||
|
||||
|
||||
// TODO: Implement partial caching
|
||||
public static function getRoundTipps($max_round_id=-1) {
|
||||
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();
|
||||
if ($seasonId!=-1) { $currentSeason=Season::where('id','=',$seasonId)->first(); };
|
||||
|
||||
error_log("SeasonId=".$currentSeason->id);
|
||||
|
||||
// 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.
|
||||
|
|
@ -271,10 +281,8 @@ class Tipp extends Model
|
|||
$user_ids=array();
|
||||
$round_ids=array();
|
||||
|
||||
|
||||
|
||||
// Write sql result to roundtipps (score per round & user)
|
||||
if ($max_round_id==-1) { $max_round_id=Round::getLastCompleteRoundId(); }
|
||||
if ($max_round_id==-1) { $max_round_id=Round::getLastCompleteRoundId($currentSeason->id); }
|
||||
foreach ($result as $entry) {
|
||||
$round_id = $entry->round_id;
|
||||
if ($max_round_id >-1 && $round_id>$max_round_id) break;
|
||||
|
|
@ -359,6 +367,7 @@ class Tipp extends Model
|
|||
$userRankings = array();
|
||||
foreach ($user_ids as $user_id) {
|
||||
$key = $max_round_id."_".$user_id;
|
||||
//error_log("Pushing:". $user_id." => ".$key);
|
||||
array_push($userRankings, [$user_id , $roundtipps[$key]['totalRankScore']]);
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue