TimeLogger moved, League ranking also for not completed but started rounds
This commit is contained in:
parent
78a4a04cdf
commit
90c6d60ecd
26 changed files with 692 additions and 376 deletions
|
|
@ -6,6 +6,7 @@ use Illuminate\Database\Eloquent\Model;
|
|||
use DB;
|
||||
use Carbon;
|
||||
use Log;
|
||||
use App\MyClasses\TimeLogger;
|
||||
|
||||
class Tipp extends Model
|
||||
{
|
||||
|
|
@ -177,6 +178,10 @@ class Tipp extends Model
|
|||
}
|
||||
|
||||
public static function createTipps($user_id) {
|
||||
|
||||
$a=new TimeLogger("Tipp::createTipps()");
|
||||
Log::info($a->getStartMessage());
|
||||
|
||||
$activeSeason = Season::getCurrent();
|
||||
|
||||
$rounds = Round::all()->where('season_id', '=', $activeSeason->id);
|
||||
|
|
@ -202,14 +207,21 @@ class Tipp extends Model
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
Log::info($a->getEndMessage());
|
||||
|
||||
}
|
||||
|
||||
public static function createAllTips() {
|
||||
$a=new TimeLogger("Tipp::createAllTipps()");
|
||||
Log::info($a->getStartMessage());
|
||||
|
||||
$users = DB::table('users')->where('deleted',null)->get();
|
||||
foreach($users as $user) {
|
||||
Log::info("Creating tipps for userid ".$user->id);
|
||||
Tipp::createTipps($user->id);
|
||||
}
|
||||
Log::info($a->getEndMessage());
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -247,6 +259,9 @@ class Tipp extends Model
|
|||
// TODO: Implement partial caching
|
||||
public static function getRoundTipps($max_round_id=-1, $seasonId=-1)
|
||||
{
|
||||
$a=new TimeLogger("getRoundTipps max_round_id=".$max_round_id.", seasonId=".$seasonId);
|
||||
Log::info($a->getStartMessage());
|
||||
|
||||
$startTime = microtime(true);
|
||||
|
||||
$currentSeason = Season::getCurrent();
|
||||
|
|
@ -353,6 +368,7 @@ class Tipp extends Model
|
|||
/////////////////////////////////////////////////////////////////////
|
||||
// CALCULATION OF SCORES, RANKS, ETC. (COMPUTE AGGREGATED VALUES) EXCEPT GREENSHIRT, ARGH !!
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
$highestDayscores = array();
|
||||
foreach ($user_ids as $user_id) {
|
||||
$totalRankScore = 0;
|
||||
|
|
@ -383,6 +399,7 @@ class Tipp extends Model
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
// Sortier-Array nach Rang (nur für max_round_id)
|
||||
$userRankings = array();
|
||||
|
|
@ -509,6 +526,7 @@ class Tipp extends Model
|
|||
|
||||
// B) SET GSCORE TOTAL EVERY ROUND ( and take fouls into consideration )
|
||||
$maxScorePerRound=array();
|
||||
|
||||
foreach($user_ids as $user_id) {
|
||||
$foulCount=0;
|
||||
$totalScore=0;
|
||||
|
|
@ -558,7 +576,6 @@ class Tipp extends Model
|
|||
|
||||
//dd("User 11 Round 1 gshirt_score =".$roundtipps['1_11']['gshirt_score'].", totalscore=".$roundtipps['1_11']['gshirt_totalscore']);
|
||||
|
||||
|
||||
//////////////////////////////
|
||||
// START OF HURTFUL 6 PLACE RESTRICTION IF DAYSCORE WIN (exception: completely even scores)
|
||||
// If more than 6 DayScoreWinners: Restrict by dayscore (rank)
|
||||
|
|
@ -642,9 +659,11 @@ class Tipp extends Model
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
///// END OF HURTFUL 6 PLACE RESTRICTION
|
||||
|
||||
|
||||
/// CALCULATE RANK AND PAYOUT QUOTAS
|
||||
|
||||
$quotas=Quota::getQuotas();
|
||||
|
||||
error_log("Round-Count=".$round_count);
|
||||
|
|
@ -687,7 +706,6 @@ class Tipp extends Model
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////// END OF ROUNDTIPPS CREATION ///////////////////
|
||||
|
||||
$response = array();
|
||||
|
|
@ -698,6 +716,8 @@ class Tipp extends Model
|
|||
|
||||
Log::info("Tipp::getRoundTipps: ExecutionTime: " . number_format(( microtime(true) - $startTime), 4) . " Seconds\n");
|
||||
|
||||
Log::info($a->getEndMessage());
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
|
|
@ -722,6 +742,9 @@ class Tipp extends Model
|
|||
}
|
||||
|
||||
public static function gshirt_table() {
|
||||
$a=new TimeLogger("Tipp::gshirt_table()");
|
||||
Log::info($a->getStartMessage());
|
||||
|
||||
$rt = Tipp::getRoundTipps();
|
||||
$roundtipps = $rt['roundtipps'];
|
||||
$round_ids = $rt['round_ids'];
|
||||
|
|
@ -760,6 +783,8 @@ class Tipp extends Model
|
|||
array_push($rankingDisplay2,$rankingDisplay[$user_id]);
|
||||
}
|
||||
|
||||
Log::info($a->getEndMessage());
|
||||
|
||||
return $rankingDisplay2;
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue