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

@ -9,7 +9,7 @@ use Carbon\Carbon;
use Auth; use Auth;
use App\User; use App\User;
use Log; use Log;
use App\MyClasses\TimeLogger;
class GamesController extends Controller class GamesController extends Controller
{ {
@ -23,8 +23,11 @@ class GamesController extends Controller
public function store() { public function store() {
if (Auth::guest()) { return redirect("/login"); } if (Auth::guest()) { return redirect("/login"); }
// Validate form
$a=new TimeLogger("GamesController::store");
Log::info($a->getStartMessage());
// Validate form
Log::info("Starting validation"); Log::info("Starting validation");
$this->validate(request(), [ $this->validate(request(), [
'id' => 'required', 'id' => 'required',
@ -60,6 +63,8 @@ class GamesController extends Controller
$game->kickoff=User::toDBDate(request('kickoff')); $game->kickoff=User::toDBDate(request('kickoff'));
$game->save(); $game->save();
Log::info($a->getEndMessage());
// Redirect to the Rounds Index // Redirect to the Rounds Index
return redirect('/rounds#'.$game->round_id); return redirect('/rounds#'.$game->round_id);
} }

View file

@ -20,9 +20,14 @@ use App\Leagues\Match;
use Log; use Log;
use DB; use DB;
use App\MyClasses\TimeLogger;
class LeaguesController extends Controller class LeaguesController extends Controller
{ {
public function index() { public function index() {
$a=new TimeLogger("LeaguesController.index");
Log::info($a->getStartMessage());
$season=Season::getCurrent(); $season=Season::getCurrent();
if (Auth::guest()) { return redirect("/"); } if (Auth::guest()) { return redirect("/"); }
@ -62,14 +67,18 @@ class LeaguesController extends Controller
// //
Log::info($a->getEndMessage());
return view('leagues.index', compact('season','rounds','start_round_id','start_round_name','league_mode','round_count')); return view('leagues.index', compact('season','rounds','start_round_id','start_round_name','league_mode','round_count'));
} }
public function createLeagues($start_round_id, $round_count) { public function createLeagues($start_round_id, $round_count) {
$a=new TimeLogger("LeaguesController::createLeagues()");
Log::info($a->getStartMessage());
$users=User::getActives(); $users=User::getActives();
if (sizeof($users)==0){ if (sizeof($users)==0){
Log::info($a->getEndMessage());
return view("leagues.no_users"); return view("leagues.no_users");
} }
@ -79,12 +88,16 @@ class LeaguesController extends Controller
Match::createMatchups(); Match::createMatchups();
Log::info($a->getEndMessage());
return redirect("/seasons"); return redirect("/seasons");
} }
public function showLeagueRounds() { public function showLeagueRounds() {
if (Auth::guest()) { return redirect("/"); } if (Auth::guest()) { return redirect("/"); }
$a=new TimeLogger("LeaguesController::showLeagueRounds()");
Log::info($a->getStartMessage());
$season=Season::getCurrent(); $season=Season::getCurrent();
$roundNames = Round::getNames(); $roundNames = Round::getNames();
@ -106,18 +119,26 @@ class LeaguesController extends Controller
$matchesTotal[$match->round_id][$league->id] = $lg; $matchesTotal[$match->round_id][$league->id] = $lg;
} }
} }
Log::info($a->getEndMessage());
return view ('leagues.matches', compact('season', 'matchesTotal','leagues','leagueNames','roundNames')); return view ('leagues.matches', compact('season', 'matchesTotal','leagues','leagueNames','roundNames'));
} }
public static function showLeagueRanking() { public static function showLeagueRanking() {
$a=new TimeLogger("LeaguesController::showLeagueRanking()");
Log::info($a->getStartMessage());
$season = Season::getCurrent(); $season = Season::getCurrent();
//$leagues = array_reverse(League::getRanking($rank)); //$leagues = array_reverse(League::getRanking($rank));
$leagueNames = League::getNames(); $leagueNames = League::getNames();
$userNames = User::getNames(); $userNames = User::getNames();
$leagues = League::where('season_id','=',$season->id)->where('rank','<=', 4)->orderBy('id')->get(); $leagues = League::where('season_id','=',$season->id)->where('rank','<=', 4)->orderBy('id')->get();
if (!sizeof($leagues)) return redirect("/"); if (!sizeof($leagues)) {
Log::info($a->getEndMessage());
return redirect("/");
}
$totalRanking = League::getTotalRankingOverall(); // Nur für Auf/Abstiegsinfo benötigt. $totalRanking = League::getTotalRankingOverall(); // Nur für Auf/Abstiegsinfo benötigt.
$rankInfo=array(); $rankInfo=array();
@ -138,6 +159,9 @@ class LeaguesController extends Controller
$leagueScores[$rank] = League::getRanking($rank); $leagueScores[$rank] = League::getRanking($rank);
} }
Log::info($a->getEndMessage());
//error_log($a->getEndMessage());
return view ('leagues.chart',compact('season', 'leagueNames', 'userNames','leagueScores','rankInfo','rank','cols')); return view ('leagues.chart',compact('season', 'leagueNames', 'userNames','leagueScores','rankInfo','rank','cols'));
} }

View file

@ -13,6 +13,7 @@ use Auth;
use DB; use DB;
use Log; use Log;
use Carbon; use Carbon;
use App\MyClasses\TimeLogger;
class RoundmailController extends Controller class RoundmailController extends Controller
{ {
@ -22,6 +23,9 @@ class RoundmailController extends Controller
if (Auth::guest()) { return redirect("/"); } if (Auth::guest()) { return redirect("/"); }
if (!Auth::user()->admin) { return redirect("/"); } if (!Auth::user()->admin) { return redirect("/"); }
$a=new TimeLogger("RoundmailController::index()");
Log::info($a->getStartMessage());
$mails_db = Roundmail::all(); $mails_db = Roundmail::all();
$mails=array(); $mails=array();
foreach($mails_db as $mail_db) { foreach($mails_db as $mail_db) {
@ -39,6 +43,8 @@ class RoundmailController extends Controller
} }
$mails=array_reverse($mails); $mails=array_reverse($mails);
Log::info($a->getEndMessage());
return view('roundmails.index',compact('mails')); return view('roundmails.index',compact('mails'));
} }
@ -46,6 +52,9 @@ class RoundmailController extends Controller
if (Auth::guest()) { return redirect("/"); } if (Auth::guest()) { return redirect("/"); }
if (!Auth::user()->admin) { return redirect("/"); } if (!Auth::user()->admin) { return redirect("/"); }
$a=new TimeLogger("RoundmailController::show start");
Log::info($a->getStartMessage());
$user_id=Auth::user()->id; $user_id=Auth::user()->id;
$users = DB::table('users')->where('deleted',null)->orderBy('lastname')->get(); $users = DB::table('users')->where('deleted',null)->orderBy('lastname')->get();
@ -124,6 +133,8 @@ class RoundmailController extends Controller
if ($sender) {$sender_name = $sender->name;} if ($sender) {$sender_name = $sender->name;}
} }
Log::info($a->getEndMessage());
return view('roundmails.show',compact('mail_id','activeMailList','inactiveMailList','missingTippMailList','missingJokerMailList','adminMailList','send_date','user_id','topic', 'mail_message', 'recipients', 'sender_name','viewmode','tippSpielLink')); return view('roundmails.show',compact('mail_id','activeMailList','inactiveMailList','missingTippMailList','missingJokerMailList','adminMailList','send_date','user_id','topic', 'mail_message', 'recipients', 'sender_name','viewmode','tippSpielLink'));
} }

View file

@ -12,6 +12,7 @@ use App\Quota;
use DB; use DB;
use Auth; use Auth;
use Log; use Log;
use App\MyClasses\TimeLogger;
class RoundsController extends Controller class RoundsController extends Controller
{ {
@ -19,6 +20,9 @@ class RoundsController extends Controller
if (Auth::guest()) { return redirect("/"); } if (Auth::guest()) { return redirect("/"); }
if (!Auth::user()->admin) { return redirect("/"); } if (!Auth::user()->admin) { return redirect("/"); }
$a=new TimeLogger("RoundsController::index()");
Log::info($a->getStartMessage());
$activeSeason=Season::getCurrent(); $activeSeason=Season::getCurrent();
$rounds =null; $rounds =null;
@ -30,6 +34,8 @@ class RoundsController extends Controller
$quotas = Quota::getQuotas(); $quotas = Quota::getQuotas();
$round_count = Round::getCount(); $round_count = Round::getCount();
Log::info($a->getEndMessage());
return view('rounds.index', compact('rounds','activeSeason', 'round_count')); return view('rounds.index', compact('rounds','activeSeason', 'round_count'));
} }
@ -51,6 +57,9 @@ class RoundsController extends Controller
if (Auth::guest()) { return redirect("/"); } if (Auth::guest()) { return redirect("/"); }
if (!Auth::user()->admin) { return redirect("/"); } if (!Auth::user()->admin) { return redirect("/"); }
$a=new TimeLogger("RoundsController::store() start");
Log::info($a->getStartMessage());
// Validate form // Validate form
$this->validate(request(), [ $this->validate(request(), [
'name' => 'required', 'name' => 'required',
@ -108,6 +117,8 @@ class RoundsController extends Controller
Tipp::createAllTips(); Tipp::createAllTips();
Log::info($a->getEndMessage());
// Redirect to the home page // Redirect to the home page
return redirect('/rounds'); return redirect('/rounds');
} }
@ -116,6 +127,9 @@ class RoundsController extends Controller
if (Auth::guest()) { return redirect("/"); } if (Auth::guest()) { return redirect("/"); }
if (!Auth::user()->admin) { return redirect("/"); } if (!Auth::user()->admin) { return redirect("/"); }
$a=new TimeLogger("RoundsController::store_report()");
Log::info($a->getStartMessage());
// Validate form // Validate form
$this->validate(request(), [ $this->validate(request(), [
'round_id' => 'required' 'round_id' => 'required'
@ -133,6 +147,7 @@ class RoundsController extends Controller
} }
$round->save(); $round->save();
Log::info($a->getEndMessage());
// Redirect to the home page // Redirect to the home page
return redirect('/rounds'); return redirect('/rounds');
@ -150,6 +165,9 @@ class RoundsController extends Controller
if (Auth::guest()) { return redirect("/"); } if (Auth::guest()) { return redirect("/"); }
if (!Auth::user()->admin) { return redirect("/"); } if (!Auth::user()->admin) { return redirect("/"); }
$a=new TimeLogger("RoundsController::storename()");
Log::info($a->getStartMessage());
// Validate form // Validate form
$this->validate(request(), [ $this->validate(request(), [
'round_id' => 'required', 'round_id' => 'required',
@ -160,6 +178,8 @@ class RoundsController extends Controller
$round->name = request('name'); $round->name = request('name');
$round->save(); $round->save();
Log::info($a->getEndMessage());
return redirect('/rounds'); return redirect('/rounds');
} }
} }

View file

@ -13,12 +13,17 @@ use Auth;
use Log; use Log;
use DB; use DB;
use App\MyClasses\TimeLogger;
class TippsController extends Controller class TippsController extends Controller
{ {
//Duplicate from Tipps model //Duplicate from Tipps model
//TODO: Refactor usage to use only the Tipps version //TODO: Refactor usage to use only the Tipps version
public static function createTipps($user_id) { public static function createTipps($user_id) {
$a=new TimeLogger("TippsController::createTipps()");
Log::info($a->getStartMessage());
$activeSeason = Season::getCurrent(); $activeSeason = Season::getCurrent();
$rounds = Round::all()->where('season_id', '=', $activeSeason->id); $rounds = Round::all()->where('season_id', '=', $activeSeason->id);
@ -44,15 +49,22 @@ class TippsController extends Controller
} }
} }
} }
Log::info($a->getEndMessage());
} }
//Duplicate from Tipps model //Duplicate from Tipps model
//TODO: Refactor usage to use only the Tipps version //TODO: Refactor usage to use only the Tipps version
public static function createAllTips(){ public static function createAllTips(){
$a=new TimeLogger("TippsController::createAllTipps()");
Log::info($a->getStartMessage());
$users = DB::table('users')->where('deleted',null)->get(); $users = DB::table('users')->where('deleted',null)->get();
foreach($users as $user) { foreach($users as $user) {
TippsController::createTipps($user->id); TippsController::createTipps($user->id);
} }
Log::info($a->getEndMessage());
} }
public function index() public function index()

View file

@ -22,10 +22,15 @@ use Auth;
use Log; use Log;
use Carbon; use Carbon;
use App\MyClasses\TimeLogger;
class UsersController extends Controller class UsersController extends Controller
{ {
public function main() { public function main() {
$a=new TimeLogger("UsersController::main()");
Log::info($a->getStartMessage());
//error_log($a->getStartMessage());
$currentSeason=Season::getCurrent(); $currentSeason=Season::getCurrent();
$roundname=""; $roundname="";
$report=""; $report="";
@ -90,15 +95,30 @@ class UsersController extends Controller
} }
} }
Log::info($a->getEndMessage());
//error_log($a->getEndMessage());
return view('main',compact('roundname','display_rounds','message_text_joker','message_text_tipps','nextRoundName','nextRoundLockTime', 'hourDiffToLock')); return view('main',compact('roundname','display_rounds','message_text_joker','message_text_tipps','nextRoundName','nextRoundLockTime', 'hourDiffToLock'));
} }
public function index() { public function index() {
$a=new TimeLogger("UserController::index()");
Log::info($a->getStartMessage());
//error_log($a->getStartMessage());
if (Auth::guest()) { return redirect("/"); } if (Auth::guest()) { return redirect("/"); }
if (!Auth::user()->admin) { return redirect("/"); } if (!Auth::user()->admin) { return redirect("/"); }
$activeUsers = User::getActives(); $activeUsers = User::getActives();
$b=new TimeLogger("UsersController::index-db_subqueries");
Log::info($b->getStartMessage());
$currentSeason=Season::getCurrent(); $currentSeason=Season::getCurrent();
if (!$currentSeason) { return redirect('/'); } if (!$currentSeason) { return redirect('/'); }
@ -107,28 +127,45 @@ class UsersController extends Controller
$users = DB::table('users')->where('deleted',null)->orderBy('lastname')->get(); $users = DB::table('users')->where('deleted',null)->orderBy('lastname')->get();
foreach($users as $key => $user) { Log::info($b->getEndMessage());
if (User::hasMissingTipp($user->id)) {
$users[$key]->missingTippText="Tipps fehlen";
$users[$key]->tippStyling="red"; Log::info($a->getStartMessage());
$missingTipps = User::getMissingTippsAndJokers($users);
$c=new TimeLogger("UsersController::index-missingTipp Loop");
Log::info($c->getStartMessage());
foreach($users as $user_id => $user) {
if (array_key_exists($user_id, $missingTipps["MISSING_TIPP"])) {
$users[$user_id]->missingTippText = "Tipps fehlen";
$users[$user_id]->tippStyling = "red";
} else { } else {
$users[$key]->missingTippText="Runde getippt"; $users[$user_id]->missingTippText = "Runde getippt";
$users[$key]->tippStyling="green"; $users[$user_id]->tippStyling = "green";
} }
if (User::hasMissingJoker($user->id)) {
$users[$key]->missingJokerText="Joker fehlt";
$users[$key]->jokerStyling="red"; if (array_key_exists($user_id, $missingTipps["MISSING_JOKER"])) {
$users[$user_id]->missingJokerText = "Joker fehlt";
$users[$user_id]->jokerStyling = "red";
} else { } else {
$users[$key]->missingJokerText="Joker gesetzt"; $users[$user_id]->missingJokerText = "Joker gesetzt";
$users[$key]->jokerStyling="green"; $users[$user_id]->jokerStyling = "green";
} }
} }
Log::info($c->getEndMessage());
$round = Round::getFirstTippableRound(); $round = Round::getFirstTippableRound();
$firstTippableRound=new Round(); $firstTippableRound=new Round();
$firstTippableRound->name="-"; $firstTippableRound->name="-";
if ($round) { $firstTippableRound = $round; } if ($round) { $firstTippableRound = $round; }
Log::info($a->getEndMessage());
//error_log($a->getEndMessage());
return view('users.index', compact('users','active_user_count','total_user_count', 'firstTippableRound')); return view('users.index', compact('users','active_user_count','total_user_count', 'firstTippableRound'));
} }
/* /*
@ -160,6 +197,11 @@ class UsersController extends Controller
public function store() { public function store() {
if (Auth::guest()) { return redirect("/"); } if (Auth::guest()) { return redirect("/"); }
$a=new TimeLogger("UsersController::store()");
Log::info($a->getStartMessage());
//error_log($a->getStartMessage());
$season_id = Season::getCurrent()->id; $season_id = Season::getCurrent()->id;
// Validate form // Validate form
$this->validate(request(), [ $this->validate(request(), [
@ -194,6 +236,9 @@ class UsersController extends Controller
Tipp::createAllTips(); Tipp::createAllTips();
Log::info($a->getEndMessage());
//error_log($a->getEndMessage());
return redirect('/users'); return redirect('/users');
} }
@ -657,28 +702,28 @@ class UsersController extends Controller
public function gshirt_ranking() { public function gshirt_ranking() {
if (Auth::guest()) { return redirect("/"); } if (Auth::guest()) { return redirect("/"); }
// Check ob mindestens eine Runde der Saison gelockt ist und angezeigt werden kann // Check ob mindestens eine Runde der Saison gelockt ist und angezeigt werden kann
$season=Season::getCurrent(); $season=Season::getCurrent();
$seasonId=$season->id; $seasonId=$season->id;
$max_round_id = Round::getLastCompleteRoundId(); $max_round_id = Round::getLastCompleteRoundId();
if ($max_round_id==-1) { if ($max_round_id==-1) {
$sql="select DATE_FORMAT(date_sub(min(games.kickoff), interval 1 hour),'%d.%m.%Y %H:%i') as start_date from rounds,games where rounds.season_id=".$seasonId." and games.round_id=rounds.id order by rounds.id;"; $sql="select DATE_FORMAT(date_sub(min(games.kickoff), interval 1 hour),'%d.%m.%Y %H:%i') as start_date from rounds,games where rounds.season_id=".$seasonId." and games.round_id=rounds.id order by rounds.id;";
//dd($sql); //dd($sql);
$entries = DB::select($sql); $entries = DB::select($sql);
if (count($entries)>0) { if (count($entries)>0) {
$start_date = $entries[0]->start_date; $start_date = $entries[0]->start_date;
return view('users.no_ranking', compact('start_date')); return view('users.no_ranking', compact('start_date'));
} else { } else {
return redirect("/"); return redirect("/");
}
} }
}

View file

@ -1,23 +0,0 @@
<?php
namespace App\MyClasses;
class TimeLogger
{
public $startTime;
public $pkey;
public $functionName;
public function __construct($_functionName) {
$this->startTime = microtime(true);
$this->functionName =$_functionName;
$this->pkey="".rand(1000,9999);
}
public function getStartMessage() {
return "[CLOCK] [".$this->pkey."-".$this->functionName."] [started]";
}
public function getEndMessage() {
return "[CLOCK] [".$this->pkey."-". $this->functionName."] [ended] [elapsed: ".number_format( ( microtime(true) - $this->startTime), 4)."]";
}
}

View file

@ -0,0 +1,44 @@
<?php
namespace App\MyClasses;
/* USAGE IN CLASS
--START OF FILE
use App\MyClasses\TimeLogger;
--START OF METHOD
$a=new TimeLogger("method XXX start");
Log::info($a->getStartMessage());
--END OF METHOD
Log::info($a->getEndMessage());
*/
class TimeLogger
{
public $startTime;
public $pkey;
public $functionName;
public function __construct($_functionName) {
$this->startTime = microtime(true);
$this->functionName =$_functionName;
$this->pkey="".rand(1000,9999);
}
public function getStartMessage() {
return "[CLOCK] [".$this->pkey."-".$this->functionName."] [started]";
}
public function getEndMessage() {
$time= ( microtime(true) - $this->startTime);
$timestr=number_format( $time, 4);
$retval="[CLOCK] [".$this->pkey."-". $this->functionName."] [ended] [elapsed: ".$timestr."]";
if ($time > 1.5) {
$retval=$retval." [PERFORMANCE_WARNING]";
}
return $retval;
}
}

View file

@ -9,6 +9,7 @@ use App\Season;
use Log; use Log;
use DB; use DB;
use Carbon; use Carbon;
use App\MyClasses\TimeLogger;
class Round extends Model class Round extends Model
{ {
@ -127,22 +128,28 @@ class Round extends Model
} }
public static function getFirstTippableRound($seasonId=-1) { public static function getFirstTippableRound($seasonId=-1) {
$season=null; $season=null;
if ($seasonId==-1) { if ($seasonId==-1) {
$season=Season::getCurrent(); $season=Season::getCurrent();
} else { } else {
$season=Season::where('id','=', $seasonId)->first(); $season=Season::where('id','=', $seasonId)->first();
} }
if (!$season) return null; if (!$season) {
return null;
}
$rounds=Round::where('season_id','=',$season->id)->orderBy('id')->get(); $rounds=Round::where('season_id','=',$season->id)->orderBy('id')->get();
$locked = false; $locked = false;
foreach ($rounds as $round) { foreach ($rounds as $round) {
if (!Round::hasLockedGame($round->id) ) { if (!Round::hasLockedGame($round->id)) {
return $round; return $round;
} }
} }
return null; return null;
} }

View file

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

View file

@ -12,6 +12,7 @@ use App\Game;
use Carbon; use Carbon;
use Log; use Log;
use DB; use DB;
use App\MyClasses\TimeLogger;
class User extends Authenticatable class User extends Authenticatable
{ {
@ -138,10 +139,77 @@ class User extends Authenticatable
return $dbDate; return $dbDate;
} }
public static function hasMissingTipp($user_id) { // TODO: implement hasMissingTipps($user_array)
// OPTIMIZED VERSION FOR hasMissingTipp
public static function getMissingTippsAndJokers($users) {
$round = Round::getFirstTippableRound(); $round = Round::getFirstTippableRound();
if (!$round) return false; if (!$round) return false;
$tippClock=new TimeLogger("User::getMissingTippsAndJokers()");
Log::info($tippClock->getStartMessage());
// expecting collection of user db objects like: $users = DB::table('users')->where('deleted',null)->orderBy('lastname')->get();
$idlist = array();
$usersWithoutJoker=array();
foreach($users as $key => $user) {
array_push($idlist,$key);
array_push($usersWithoutJoker,$key);
}
$games = Game::where('round_id','=',$round->id)->get();
$gameIds=array();
foreach ($games as $key => $game) {
array_push($gameIds,$key);
Log::info("GAME_ID:".$key);
}
$tipps = Tipp::whereIn('game_id', $gameIds)->get();
Log::info("Fetched advanced tipps, checking now for missing tipps and jokers");
$usersWithoutTipps=array();
foreach($tipps as $tipp) {
if ($tipp->score1 == -1 || $tipp->score2 == -1) {
$usersWithoutTipps[$tipp->user_id]="no_tipp";
Log::info("UserId ".$tipp->user_id." is missing a tipp!");
}
if ($tipp->joker == true) {
Log::info("Removing from jokerlist: ".$tipp->user_id);
unset($usersWithoutJoker[$tipp->user_id]);
}
}
foreach ($usersWithoutJoker as $id) {
Log::info("Jokerless:".$id);
}
$result=array();
$result["MISSING_TIPP"]=$usersWithoutTipps;
$result["MISSING_JOKER"]=$usersWithoutJoker;
Log::info("USERLIST: ".implode(",",$idlist));
Log::info($tippClock->getEndMessage());
foreach(array_keys($result) as $key => $value) {
Log::info("Main key: ".$key.", value=".$value);
}
$mtipps=$result["MISSING_TIPP"];
foreach($mtipps as $key => $value) {
Log::info("MTipp: ".$key." => ".$value);
}
return $result;
}
public static function hasMissingTipp($user_id) {
$round = Round::getFirstTippableRound();
if (!$round) return false;
//$a=new TimeLogger("User::hasMissingTipp()");
//Log::info($a->getStartMessage());
$round_id = $round->id; $round_id = $round->id;
$games = Game::where('round_id','=',$round_id)->get(); $games = Game::where('round_id','=',$round_id)->get();
@ -151,14 +219,18 @@ class User extends Authenticatable
if(!$tipp) { if(!$tipp) {
Log::info("Tipp doesnt exist: game_id=".$game->id.", user_id=".$user_id); Log::info("Tipp doesnt exist: game_id=".$game->id.", user_id=".$user_id);
//Log::info($a->getEndMessage());
return 1; return 1;
} }
if ($tipp->score1 == -1 || $tipp->score2 == -1) { if ($tipp->score1 == -1 || $tipp->score2 == -1) {
//Log::info("!!! User ".$user_id." has a missing tipp for game_id ".$game->id.", round = ".$round_id); //Log::info($a->getEndMessage());
return 1; return 1;
} }
} }
//Log::info($a->getEndMessage());
return 0; return 0;
} }

View file

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

View file

@ -258,14 +258,18 @@ class Match extends Model
$roundtipps = $roundtipps["roundtipps"]; $roundtipps = $roundtipps["roundtipps"];
$matches = Match::getLeagueMatches($leagueId, $maxRoundId); $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) { foreach($matches as $key => $match) {
$user1_key = $match->round_id."_".$match->user1_id; $user1_key = $match->round_id."_".$match->user1_id;
$user2_key = $match->round_id."_".$match->user2_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"]; $user1_score = $roundtipps[$user1_key]["rankscore"];
$user2_score = $roundtipps[$user2_key]["rankscore"]; $user2_score = $roundtipps[$user2_key]["rankscore"];

View file

@ -47,7 +47,7 @@
"config": { "config": {
"preferred-install": "dist", "preferred-install": "dist",
"sort-packages": true, "sort-packages": true,
"optimize-autoloader": true, "optimize-autoloader": false,
"secure-http":false "secure-http":false
} }
} }

51
pfosten/composer.lock generated
View file

@ -693,16 +693,16 @@
}, },
{ {
"name": "nesbot/carbon", "name": "nesbot/carbon",
"version": "1.32.0", "version": "1.33.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/briannesbitt/Carbon.git", "url": "https://github.com/briannesbitt/Carbon.git",
"reference": "64563e2b9f69e4db1b82a60e81efa327a30ff343" "reference": "55667c1007a99e82030874b1bb14d24d07108413"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/64563e2b9f69e4db1b82a60e81efa327a30ff343", "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/55667c1007a99e82030874b1bb14d24d07108413",
"reference": "64563e2b9f69e4db1b82a60e81efa327a30ff343", "reference": "55667c1007a99e82030874b1bb14d24d07108413",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -744,7 +744,7 @@
"datetime", "datetime",
"time" "time"
], ],
"time": "2018-07-05T06:59:26+00:00" "time": "2018-08-07T08:39:47+00:00"
}, },
{ {
"name": "nikic/php-parser", "name": "nikic/php-parser",
@ -895,20 +895,22 @@
}, },
{ {
"name": "psy/psysh", "name": "psy/psysh",
"version": "v0.9.6", "version": "v0.9.7",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/bobthecow/psysh.git", "url": "https://github.com/bobthecow/psysh.git",
"reference": "4a2ce86f199d51b6e2524214dc06835e872f4fce" "reference": "4f5b6c090948773a8bfeea6a0f07ab7d0b24e932"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/bobthecow/psysh/zipball/4a2ce86f199d51b6e2524214dc06835e872f4fce", "url": "https://api.github.com/repos/bobthecow/psysh/zipball/4f5b6c090948773a8bfeea6a0f07ab7d0b24e932",
"reference": "4a2ce86f199d51b6e2524214dc06835e872f4fce", "reference": "4f5b6c090948773a8bfeea6a0f07ab7d0b24e932",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"dnoegel/php-xdg-base-dir": "0.1", "dnoegel/php-xdg-base-dir": "0.1",
"ext-json": "*",
"ext-tokenizer": "*",
"jakub-onderka/php-console-highlighter": "0.3.*", "jakub-onderka/php-console-highlighter": "0.3.*",
"nikic/php-parser": "~1.3|~2.0|~3.0|~4.0", "nikic/php-parser": "~1.3|~2.0|~3.0|~4.0",
"php": ">=5.4.0", "php": ">=5.4.0",
@ -963,7 +965,7 @@
"interactive", "interactive",
"shell" "shell"
], ],
"time": "2018-06-10T17:57:20+00:00" "time": "2018-08-11T15:54:43+00:00"
}, },
{ {
"name": "ramsey/uuid", "name": "ramsey/uuid",
@ -1536,25 +1538,28 @@
}, },
{ {
"name": "symfony/polyfill-ctype", "name": "symfony/polyfill-ctype",
"version": "v1.8.0", "version": "v1.9.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/polyfill-ctype.git", "url": "https://github.com/symfony/polyfill-ctype.git",
"reference": "7cc359f1b7b80fc25ed7796be7d96adc9b354bae" "reference": "e3d826245268269cd66f8326bd8bc066687b4a19"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/7cc359f1b7b80fc25ed7796be7d96adc9b354bae", "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/e3d826245268269cd66f8326bd8bc066687b4a19",
"reference": "7cc359f1b7b80fc25ed7796be7d96adc9b354bae", "reference": "e3d826245268269cd66f8326bd8bc066687b4a19",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=5.3.3" "php": ">=5.3.3"
}, },
"suggest": {
"ext-ctype": "For best performance"
},
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "1.8-dev" "dev-master": "1.9-dev"
} }
}, },
"autoload": { "autoload": {
@ -1587,7 +1592,7 @@
"polyfill", "polyfill",
"portable" "portable"
], ],
"time": "2018-04-30T19:57:29+00:00" "time": "2018-08-06T14:22:27+00:00"
}, },
{ {
"name": "symfony/polyfill-mbstring", "name": "symfony/polyfill-mbstring",
@ -1650,26 +1655,26 @@
}, },
{ {
"name": "symfony/polyfill-php70", "name": "symfony/polyfill-php70",
"version": "v1.8.0", "version": "v1.9.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/polyfill-php70.git", "url": "https://github.com/symfony/polyfill-php70.git",
"reference": "77454693d8f10dd23bb24955cffd2d82db1007a6" "reference": "1e24b0c4a56d55aaf368763a06c6d1c7d3194934"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/77454693d8f10dd23bb24955cffd2d82db1007a6", "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/1e24b0c4a56d55aaf368763a06c6d1c7d3194934",
"reference": "77454693d8f10dd23bb24955cffd2d82db1007a6", "reference": "1e24b0c4a56d55aaf368763a06c6d1c7d3194934",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"paragonie/random_compat": "~1.0|~2.0", "paragonie/random_compat": "~1.0|~2.0|~9.99",
"php": ">=5.3.3" "php": ">=5.3.3"
}, },
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "1.8-dev" "dev-master": "1.9-dev"
} }
}, },
"autoload": { "autoload": {
@ -1705,7 +1710,7 @@
"portable", "portable",
"shim" "shim"
], ],
"time": "2018-04-26T10:06:28+00:00" "time": "2018-08-06T14:22:27+00:00"
}, },
{ {
"name": "symfony/process", "name": "symfony/process",

View file

@ -38,6 +38,7 @@ return array(
'App\\Leagues\\Match' => $baseDir . '/app/Leagues/Match.php', 'App\\Leagues\\Match' => $baseDir . '/app/Leagues/Match.php',
'App\\Mail\\RoundmailMailer' => $baseDir . '/app/Mail/RoundmailMailer.php', 'App\\Mail\\RoundmailMailer' => $baseDir . '/app/Mail/RoundmailMailer.php',
'App\\ManualPayout' => $baseDir . '/app/ManualPayout.php', 'App\\ManualPayout' => $baseDir . '/app/ManualPayout.php',
'App\\MyClasses\\TimeLogger' => $baseDir . '/app/MyClasses/TimeLogger/TimeLogger.php',
'App\\Payment' => $baseDir . '/app/Payment.php', 'App\\Payment' => $baseDir . '/app/Payment.php',
'App\\Providers\\AppServiceProvider' => $baseDir . '/app/Providers/AppServiceProvider.php', 'App\\Providers\\AppServiceProvider' => $baseDir . '/app/Providers/AppServiceProvider.php',
'App\\Providers\\AuthServiceProvider' => $baseDir . '/app/Providers/AuthServiceProvider.php', 'App\\Providers\\AuthServiceProvider' => $baseDir . '/app/Providers/AuthServiceProvider.php',

View file

@ -13,8 +13,8 @@ return array(
'023d27dca8066ef29e6739335ea73bad' => $vendorDir . '/symfony/polyfill-php70/bootstrap.php', '023d27dca8066ef29e6739335ea73bad' => $vendorDir . '/symfony/polyfill-php70/bootstrap.php',
'667aeda72477189d0494fecd327c3641' => $vendorDir . '/symfony/var-dumper/Resources/functions/dump.php', '667aeda72477189d0494fecd327c3641' => $vendorDir . '/symfony/var-dumper/Resources/functions/dump.php',
'2c102faa651ef8ea5874edb585946bce' => $vendorDir . '/swiftmailer/swiftmailer/lib/swift_required.php', '2c102faa651ef8ea5874edb585946bce' => $vendorDir . '/swiftmailer/swiftmailer/lib/swift_required.php',
'801c31d8ed748cfa537fa45402288c95' => $vendorDir . '/psy/psysh/src/functions.php',
'6124b4c8570aa390c21fafd04a26c69f' => $vendorDir . '/myclabs/deep-copy/src/DeepCopy/deep_copy.php', '6124b4c8570aa390c21fafd04a26c69f' => $vendorDir . '/myclabs/deep-copy/src/DeepCopy/deep_copy.php',
'801c31d8ed748cfa537fa45402288c95' => $vendorDir . '/psy/psysh/src/functions.php',
'f0906e6318348a765ffb6eb24e0d0938' => $vendorDir . '/laravel/framework/src/Illuminate/Foundation/helpers.php', 'f0906e6318348a765ffb6eb24e0d0938' => $vendorDir . '/laravel/framework/src/Illuminate/Foundation/helpers.php',
'58571171fd5812e6e447dce228f52f4d' => $vendorDir . '/laravel/framework/src/Illuminate/Support/helpers.php', '58571171fd5812e6e447dce228f52f4d' => $vendorDir . '/laravel/framework/src/Illuminate/Support/helpers.php',
'f18cc91337d49233e5754e93f3ed9ec3' => $vendorDir . '/laravelcollective/html/src/helpers.php', 'f18cc91337d49233e5754e93f3ed9ec3' => $vendorDir . '/laravelcollective/html/src/helpers.php',

View file

@ -14,8 +14,8 @@ class ComposerStaticInita19fb0695e1b61b4feeb3cc3fbdd2feb
'023d27dca8066ef29e6739335ea73bad' => __DIR__ . '/..' . '/symfony/polyfill-php70/bootstrap.php', '023d27dca8066ef29e6739335ea73bad' => __DIR__ . '/..' . '/symfony/polyfill-php70/bootstrap.php',
'667aeda72477189d0494fecd327c3641' => __DIR__ . '/..' . '/symfony/var-dumper/Resources/functions/dump.php', '667aeda72477189d0494fecd327c3641' => __DIR__ . '/..' . '/symfony/var-dumper/Resources/functions/dump.php',
'2c102faa651ef8ea5874edb585946bce' => __DIR__ . '/..' . '/swiftmailer/swiftmailer/lib/swift_required.php', '2c102faa651ef8ea5874edb585946bce' => __DIR__ . '/..' . '/swiftmailer/swiftmailer/lib/swift_required.php',
'801c31d8ed748cfa537fa45402288c95' => __DIR__ . '/..' . '/psy/psysh/src/functions.php',
'6124b4c8570aa390c21fafd04a26c69f' => __DIR__ . '/..' . '/myclabs/deep-copy/src/DeepCopy/deep_copy.php', '6124b4c8570aa390c21fafd04a26c69f' => __DIR__ . '/..' . '/myclabs/deep-copy/src/DeepCopy/deep_copy.php',
'801c31d8ed748cfa537fa45402288c95' => __DIR__ . '/..' . '/psy/psysh/src/functions.php',
'f0906e6318348a765ffb6eb24e0d0938' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/helpers.php', 'f0906e6318348a765ffb6eb24e0d0938' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/helpers.php',
'58571171fd5812e6e447dce228f52f4d' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Support/helpers.php', '58571171fd5812e6e447dce228f52f4d' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Support/helpers.php',
'f18cc91337d49233e5754e93f3ed9ec3' => __DIR__ . '/..' . '/laravelcollective/html/src/helpers.php', 'f18cc91337d49233e5754e93f3ed9ec3' => __DIR__ . '/..' . '/laravelcollective/html/src/helpers.php',
@ -322,6 +322,7 @@ class ComposerStaticInita19fb0695e1b61b4feeb3cc3fbdd2feb
'App\\Leagues\\Match' => __DIR__ . '/../..' . '/app/Leagues/Match.php', 'App\\Leagues\\Match' => __DIR__ . '/../..' . '/app/Leagues/Match.php',
'App\\Mail\\RoundmailMailer' => __DIR__ . '/../..' . '/app/Mail/RoundmailMailer.php', 'App\\Mail\\RoundmailMailer' => __DIR__ . '/../..' . '/app/Mail/RoundmailMailer.php',
'App\\ManualPayout' => __DIR__ . '/../..' . '/app/ManualPayout.php', 'App\\ManualPayout' => __DIR__ . '/../..' . '/app/ManualPayout.php',
'App\\MyClasses\\TimeLogger' => __DIR__ . '/../..' . '/app/MyClasses/TimeLogger/TimeLogger.php',
'App\\Payment' => __DIR__ . '/../..' . '/app/Payment.php', 'App\\Payment' => __DIR__ . '/../..' . '/app/Payment.php',
'App\\Providers\\AppServiceProvider' => __DIR__ . '/../..' . '/app/Providers/AppServiceProvider.php', 'App\\Providers\\AppServiceProvider' => __DIR__ . '/../..' . '/app/Providers/AppServiceProvider.php',
'App\\Providers\\AuthServiceProvider' => __DIR__ . '/../..' . '/app/Providers/AuthServiceProvider.php', 'App\\Providers\\AuthServiceProvider' => __DIR__ . '/../..' . '/app/Providers/AuthServiceProvider.php',

View file

@ -1438,80 +1438,6 @@
"php" "php"
] ]
}, },
{
"name": "psy/psysh",
"version": "v0.9.6",
"version_normalized": "0.9.6.0",
"source": {
"type": "git",
"url": "https://github.com/bobthecow/psysh.git",
"reference": "4a2ce86f199d51b6e2524214dc06835e872f4fce"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/bobthecow/psysh/zipball/4a2ce86f199d51b6e2524214dc06835e872f4fce",
"reference": "4a2ce86f199d51b6e2524214dc06835e872f4fce",
"shasum": ""
},
"require": {
"dnoegel/php-xdg-base-dir": "0.1",
"jakub-onderka/php-console-highlighter": "0.3.*",
"nikic/php-parser": "~1.3|~2.0|~3.0|~4.0",
"php": ">=5.4.0",
"symfony/console": "~2.3.10|^2.4.2|~3.0|~4.0",
"symfony/var-dumper": "~2.7|~3.0|~4.0"
},
"require-dev": {
"bamarni/composer-bin-plugin": "^1.2",
"hoa/console": "~2.15|~3.16",
"phpunit/phpunit": "~4.8.35|~5.0|~6.0|~7.0"
},
"suggest": {
"ext-pcntl": "Enabling the PCNTL extension makes PsySH a lot happier :)",
"ext-pdo-sqlite": "The doc command requires SQLite to work.",
"ext-posix": "If you have PCNTL, you'll want the POSIX extension as well.",
"ext-readline": "Enables support for arrow-key history navigation, and showing and manipulating command history.",
"hoa/console": "A pure PHP readline implementation. You'll want this if your PHP install doesn't already support readline or libedit."
},
"time": "2018-06-10T17:57:20+00:00",
"bin": [
"bin/psysh"
],
"type": "library",
"extra": {
"branch-alias": {
"dev-develop": "0.9.x-dev"
}
},
"installation-source": "dist",
"autoload": {
"files": [
"src/functions.php"
],
"psr-4": {
"Psy\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Justin Hileman",
"email": "justin@justinhileman.info",
"homepage": "http://justinhileman.com"
}
],
"description": "An interactive shell for modern PHP.",
"homepage": "http://psysh.org",
"keywords": [
"REPL",
"console",
"interactive",
"shell"
]
},
{ {
"name": "vlucas/phpdotenv", "name": "vlucas/phpdotenv",
"version": "v2.5.1", "version": "v2.5.1",
@ -1849,67 +1775,6 @@
"random" "random"
] ]
}, },
{
"name": "symfony/polyfill-php70",
"version": "v1.8.0",
"version_normalized": "1.8.0.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php70.git",
"reference": "77454693d8f10dd23bb24955cffd2d82db1007a6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/77454693d8f10dd23bb24955cffd2d82db1007a6",
"reference": "77454693d8f10dd23bb24955cffd2d82db1007a6",
"shasum": ""
},
"require": {
"paragonie/random_compat": "~1.0|~2.0",
"php": ">=5.3.3"
},
"time": "2018-04-26T10:06:28+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.8-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Php70\\": ""
},
"files": [
"bootstrap.php"
],
"classmap": [
"Resources/stubs"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"polyfill",
"portable",
"shim"
]
},
{ {
"name": "symfony/http-foundation", "name": "symfony/http-foundation",
"version": "v3.4.14", "version": "v3.4.14",
@ -2031,63 +1896,6 @@
"description": "Symfony EventDispatcher Component", "description": "Symfony EventDispatcher Component",
"homepage": "https://symfony.com" "homepage": "https://symfony.com"
}, },
{
"name": "symfony/polyfill-ctype",
"version": "v1.8.0",
"version_normalized": "1.8.0.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-ctype.git",
"reference": "7cc359f1b7b80fc25ed7796be7d96adc9b354bae"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/7cc359f1b7b80fc25ed7796be7d96adc9b354bae",
"reference": "7cc359f1b7b80fc25ed7796be7d96adc9b354bae",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"time": "2018-04-30T19:57:29+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.8-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Ctype\\": ""
},
"files": [
"bootstrap.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
},
{
"name": "Gert de Pagter",
"email": "BackEndTea@gmail.com"
}
],
"description": "Symfony polyfill for ctype functions",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"ctype",
"polyfill",
"portable"
]
},
{ {
"name": "symfony/http-kernel", "name": "symfony/http-kernel",
"version": "v3.4.14", "version": "v3.4.14",
@ -2440,63 +2248,6 @@
"description": "Symfony Translation Component", "description": "Symfony Translation Component",
"homepage": "https://symfony.com" "homepage": "https://symfony.com"
}, },
{
"name": "nesbot/carbon",
"version": "1.32.0",
"version_normalized": "1.32.0.0",
"source": {
"type": "git",
"url": "https://github.com/briannesbitt/Carbon.git",
"reference": "64563e2b9f69e4db1b82a60e81efa327a30ff343"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/64563e2b9f69e4db1b82a60e81efa327a30ff343",
"reference": "64563e2b9f69e4db1b82a60e81efa327a30ff343",
"shasum": ""
},
"require": {
"php": ">=5.3.9",
"symfony/translation": "~2.6 || ~3.0 || ~4.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "~2",
"phpunit/phpunit": "^4.8.35 || ^5.7"
},
"time": "2018-07-05T06:59:26+00:00",
"type": "library",
"extra": {
"laravel": {
"providers": [
"Carbon\\Laravel\\ServiceProvider"
]
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Brian Nesbitt",
"email": "brian@nesbot.com",
"homepage": "http://nesbot.com"
}
],
"description": "A simple API extension for DateTime.",
"homepage": "http://carbon.nesbot.com",
"keywords": [
"date",
"datetime",
"time"
]
},
{ {
"name": "mtdowling/cron-expression", "name": "mtdowling/cron-expression",
"version": "v1.2.1", "version": "v1.2.1",
@ -3663,5 +3414,259 @@
"portable", "portable",
"shim" "shim"
] ]
},
{
"name": "nesbot/carbon",
"version": "1.33.0",
"version_normalized": "1.33.0.0",
"source": {
"type": "git",
"url": "https://github.com/briannesbitt/Carbon.git",
"reference": "55667c1007a99e82030874b1bb14d24d07108413"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/55667c1007a99e82030874b1bb14d24d07108413",
"reference": "55667c1007a99e82030874b1bb14d24d07108413",
"shasum": ""
},
"require": {
"php": ">=5.3.9",
"symfony/translation": "~2.6 || ~3.0 || ~4.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "~2",
"phpunit/phpunit": "^4.8.35 || ^5.7"
},
"time": "2018-08-07T08:39:47+00:00",
"type": "library",
"extra": {
"laravel": {
"providers": [
"Carbon\\Laravel\\ServiceProvider"
]
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Brian Nesbitt",
"email": "brian@nesbot.com",
"homepage": "http://nesbot.com"
}
],
"description": "A simple API extension for DateTime.",
"homepage": "http://carbon.nesbot.com",
"keywords": [
"date",
"datetime",
"time"
]
},
{
"name": "symfony/polyfill-php70",
"version": "v1.9.0",
"version_normalized": "1.9.0.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php70.git",
"reference": "1e24b0c4a56d55aaf368763a06c6d1c7d3194934"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/1e24b0c4a56d55aaf368763a06c6d1c7d3194934",
"reference": "1e24b0c4a56d55aaf368763a06c6d1c7d3194934",
"shasum": ""
},
"require": {
"paragonie/random_compat": "~1.0|~2.0|~9.99",
"php": ">=5.3.3"
},
"time": "2018-08-06T14:22:27+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.9-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Php70\\": ""
},
"files": [
"bootstrap.php"
],
"classmap": [
"Resources/stubs"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"polyfill",
"portable",
"shim"
]
},
{
"name": "symfony/polyfill-ctype",
"version": "v1.9.0",
"version_normalized": "1.9.0.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-ctype.git",
"reference": "e3d826245268269cd66f8326bd8bc066687b4a19"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/e3d826245268269cd66f8326bd8bc066687b4a19",
"reference": "e3d826245268269cd66f8326bd8bc066687b4a19",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"suggest": {
"ext-ctype": "For best performance"
},
"time": "2018-08-06T14:22:27+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.9-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Ctype\\": ""
},
"files": [
"bootstrap.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
},
{
"name": "Gert de Pagter",
"email": "BackEndTea@gmail.com"
}
],
"description": "Symfony polyfill for ctype functions",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"ctype",
"polyfill",
"portable"
]
},
{
"name": "psy/psysh",
"version": "v0.9.7",
"version_normalized": "0.9.7.0",
"source": {
"type": "git",
"url": "https://github.com/bobthecow/psysh.git",
"reference": "4f5b6c090948773a8bfeea6a0f07ab7d0b24e932"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/bobthecow/psysh/zipball/4f5b6c090948773a8bfeea6a0f07ab7d0b24e932",
"reference": "4f5b6c090948773a8bfeea6a0f07ab7d0b24e932",
"shasum": ""
},
"require": {
"dnoegel/php-xdg-base-dir": "0.1",
"ext-json": "*",
"ext-tokenizer": "*",
"jakub-onderka/php-console-highlighter": "0.3.*",
"nikic/php-parser": "~1.3|~2.0|~3.0|~4.0",
"php": ">=5.4.0",
"symfony/console": "~2.3.10|^2.4.2|~3.0|~4.0",
"symfony/var-dumper": "~2.7|~3.0|~4.0"
},
"require-dev": {
"bamarni/composer-bin-plugin": "^1.2",
"hoa/console": "~2.15|~3.16",
"phpunit/phpunit": "~4.8.35|~5.0|~6.0|~7.0"
},
"suggest": {
"ext-pcntl": "Enabling the PCNTL extension makes PsySH a lot happier :)",
"ext-pdo-sqlite": "The doc command requires SQLite to work.",
"ext-posix": "If you have PCNTL, you'll want the POSIX extension as well.",
"ext-readline": "Enables support for arrow-key history navigation, and showing and manipulating command history.",
"hoa/console": "A pure PHP readline implementation. You'll want this if your PHP install doesn't already support readline or libedit."
},
"time": "2018-08-11T15:54:43+00:00",
"bin": [
"bin/psysh"
],
"type": "library",
"extra": {
"branch-alias": {
"dev-develop": "0.9.x-dev"
}
},
"installation-source": "dist",
"autoload": {
"files": [
"src/functions.php"
],
"psr-4": {
"Psy\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Justin Hileman",
"email": "justin@justinhileman.info",
"homepage": "http://justinhileman.com"
}
],
"description": "An interactive shell for modern PHP.",
"homepage": "http://psysh.org",
"keywords": [
"REPL",
"console",
"interactive",
"shell"
]
} }
] ]

View file

@ -1015,17 +1015,24 @@ class Carbon extends DateTime implements JsonSerializable
} }
/** /**
* Throws an exception if the given object is not a DateTime and does not implement DateTimeInterface. * Throws an exception if the given object is not a DateTime and does not implement DateTimeInterface
* and not in $other.
* *
* @param mixed $date * @param mixed $date
* @param string|array $other
* *
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
*/ */
protected static function expectDateTime($date) protected static function expectDateTime($date, $other = array())
{ {
$message = 'Expected ';
foreach ((array) $other as $expect) {
$message .= "{$expect}, ";
}
if (!$date instanceof DateTime && !$date instanceof DateTimeInterface) { if (!$date instanceof DateTime && !$date instanceof DateTimeInterface) {
throw new InvalidArgumentException( throw new InvalidArgumentException(
'Expected null, string, DateTime or DateTimeInterface, '. $message.'DateTime or DateTimeInterface, '.
(is_object($date) ? get_class($date) : gettype($date)).' given' (is_object($date) ? get_class($date) : gettype($date)).' given'
); );
} }
@ -1049,7 +1056,7 @@ class Carbon extends DateTime implements JsonSerializable
return static::parse($date, $this->getTimezone()); return static::parse($date, $this->getTimezone());
} }
static::expectDateTime($date); static::expectDateTime($date, array('null', 'string'));
return $date instanceof self ? $date : static::instance($date); return $date instanceof self ? $date : static::instance($date);
} }
@ -1847,7 +1854,7 @@ class Carbon extends DateTime implements JsonSerializable
/** /**
* Set the default format used when type juggling a Carbon instance to a string * Set the default format used when type juggling a Carbon instance to a string
* *
* @param string $format * @param string|Closure $format
* *
* @return void * @return void
*/ */
@ -1863,7 +1870,9 @@ class Carbon extends DateTime implements JsonSerializable
*/ */
public function __toString() public function __toString()
{ {
return $this->format(static::$toStringFormat); $format = static::$toStringFormat;
return $this->format($format instanceof Closure ? $format($this) : $format);
} }
/** /**
@ -2284,7 +2293,7 @@ class Carbon extends DateTime implements JsonSerializable
/** /**
* Get the minimum instance between a given instance (default now) and the current instance. * Get the minimum instance between a given instance (default now) and the current instance.
* *
* @param \Carbon\Carbon|\DateTimeInterface|mixed $date * @param \Carbon\Carbon|\DateTimeInterface|string|null $date
* *
* @return static * @return static
*/ */
@ -2312,7 +2321,7 @@ class Carbon extends DateTime implements JsonSerializable
/** /**
* Get the maximum instance between a given instance (default now) and the current instance. * Get the maximum instance between a given instance (default now) and the current instance.
* *
* @param \Carbon\Carbon|\DateTimeInterface|mixed $date * @param \Carbon\Carbon|\DateTimeInterface|string|null $date
* *
* @return static * @return static
*/ */
@ -2523,7 +2532,7 @@ class Carbon extends DateTime implements JsonSerializable
{ {
$date = $date ?: static::now($this->tz); $date = $date ?: static::now($this->tz);
static::expectDateTime($date); static::expectDateTime($date, 'null');
return $this->format($format) === $date->format($format); return $this->format($format) === $date->format($format);
} }
@ -2572,7 +2581,7 @@ class Carbon extends DateTime implements JsonSerializable
{ {
$date = $date ? static::instance($date) : static::now($this->tz); $date = $date ? static::instance($date) : static::now($this->tz);
static::expectDateTime($date); static::expectDateTime($date, 'null');
$ofSameYear = is_null($ofSameYear) ? static::shouldCompareYearWithMonth() : $ofSameYear; $ofSameYear = is_null($ofSameYear) ? static::shouldCompareYearWithMonth() : $ofSameYear;
@ -4164,7 +4173,7 @@ class Carbon extends DateTime implements JsonSerializable
*/ */
public function endOfDay() public function endOfDay()
{ {
return $this->modify('23.59.59.999999'); return $this->modify('23:59:59.999999');
} }
/** /**
@ -4322,7 +4331,7 @@ class Carbon extends DateTime implements JsonSerializable
*/ */
public function endOfHour() public function endOfHour()
{ {
return $this->setTime($this->hour, 59, 59); return $this->modify("$this->hour:59:59.999999");
} }
/** /**
@ -4342,7 +4351,27 @@ class Carbon extends DateTime implements JsonSerializable
*/ */
public function endOfMinute() public function endOfMinute()
{ {
return $this->setTime($this->hour, $this->minute, 59); return $this->modify("$this->hour:$this->minute:59.999999");
}
/**
* Modify to start of current minute, seconds become 0
*
* @return static
*/
public function startOfSecond()
{
return $this->modify("$this->hour:$this->minute:$this->second.0");
}
/**
* Modify to end of current minute, seconds become 59
*
* @return static
*/
public function endOfSecond()
{
return $this->modify("$this->hour:$this->minute:$this->second.999999");
} }
/** /**
@ -4616,7 +4645,7 @@ class Carbon extends DateTime implements JsonSerializable
/** /**
* Modify the current instance to the average of a given instance (default now) and the current instance. * Modify the current instance to the average of a given instance (default now) and the current instance.
* *
* @param \Carbon\Carbon|\DateTimeInterface|null $date * @param \Carbon\Carbon|\DateTimeInterface|string|null $date
* *
* @return static * @return static
*/ */

View file

@ -28,4 +28,13 @@ return array(
'from_now' => ':time sonra', 'from_now' => ':time sonra',
'after' => ':time sonra', 'after' => ':time sonra',
'before' => ':time əvvəl', 'before' => ':time əvvəl',
'diff_now' => 'indi',
'diff_yesterday' => 'dünən',
'diff_tomorrow' => 'sabah',
'diff_before_yesterday' => 'srağagün',
'diff_after_tomorrow' => 'birisi gün',
'period_recurrences' => ':count dəfədən bir',
'period_interval' => 'hər :interval',
'period_start_date' => ':date tarixindən başlayaraq',
'period_end_date' => ':date tarixinədək',
); );

View file

@ -10,22 +10,29 @@
*/ */
return array( return array(
'year' => '১ বছর|:count বছর', 'year' => '১ বছর|:count বছর',
'y' => '১ বছর|:count বছর', 'y' => '১ বছর|:count বছর',
'month' => '১ মাস|:count মাস', 'month' => '১ মাস|:count মাস',
'm' => '১ মাস|:count মাস', 'm' => '১ মাস|:count মাস',
'week' => '১ সপ্তাহ|:count সপ্তাহ', 'week' => '১ সপ্তাহ|:count সপ্তাহ',
'w' => '১ সপ্তাহ|:count সপ্তাহ', 'w' => '১ সপ্তাহ|:count সপ্তাহ',
'day' => '১ দিন|:count দিন', 'day' => '১ দিন|:count দিন',
'd' => '১ দিন|:count দিন', 'd' => '১ দিন|:count দিন',
'hour' => '১ ঘন্টা|:count ঘন্টা', 'hour' => '১ ঘন্টা|:count ঘন্টা',
'h' => '১ ঘন্টা|:count ঘন্টা', 'h' => '১ ঘন্টা|:count ঘন্টা',
'minute' => '১ মিনিট|:count মিনিট', 'minute' => '১ মিনিট|:count মিনিট',
'min' => '১ মিনিট|:count মিনিট', 'min' => '১ মিনিট|:count মিনিট',
'second' => '১ সেকেন্ড|:count সেকেন্ড', 'second' => '১ সেকেন্ড|:count সেকেন্ড',
's' => '১ সেকেন্ড|:count সেকেন্ড', 's' => '১ সেকেন্ড|:count সেকেন্ড',
'ago' => ':time পূর্বে', 'ago' => ':time পূর্বে',
'from_now' => 'এখন থেকে :time', 'from_now' => 'এখন থেকে :time',
'after' => ':time পরে', 'after' => ':time পরে',
'before' => ':time আগে', 'before' => ':time আগে',
'diff_now' => 'এখন',
'diff_yesterday' => 'গতকাল',
'diff_tomorrow' => 'আগামীকাল',
'period_recurrences' => ':count বার|:count বার',
'period_interval' => 'প্রতি :interval',
'period_start_date' => ':date থেকে',
'period_end_date' => ':date পর্যন্ত',
); );

View file

@ -25,7 +25,7 @@ return array(
'second' => ':count segon|:count segons', 'second' => ':count segon|:count segons',
's' => ':count segon|:count segons', 's' => ':count segon|:count segons',
'ago' => 'fa :time', 'ago' => 'fa :time',
'from_now' => 'dins de :time', 'from_now' => 'd\'aquí :time',
'after' => ':time després', 'after' => ':time després',
'before' => ':time abans', 'before' => ':time abans',
'diff_now' => 'ara mateix', 'diff_now' => 'ara mateix',

View file

@ -31,6 +31,6 @@ return array(
'diff_now' => 'ahora mismo', 'diff_now' => 'ahora mismo',
'diff_yesterday' => 'ayer', 'diff_yesterday' => 'ayer',
'diff_tomorrow' => 'mañana', 'diff_tomorrow' => 'mañana',
'diff_before_yesterday' => 'anteayer', 'diff_before_yesterday' => 'antier',
'diff_after_tomorrow' => 'pasado mañana', 'diff_after_tomorrow' => 'pasado mañana',
); );

View file

@ -14,6 +14,8 @@
], ],
"require": { "require": {
"php": ">=5.4.0", "php": ">=5.4.0",
"ext-json": "*",
"ext-tokenizer": "*",
"symfony/console": "~2.3.10|^2.4.2|~3.0|~4.0", "symfony/console": "~2.3.10|^2.4.2|~3.0|~4.0",
"symfony/var-dumper": "~2.7|~3.0|~4.0", "symfony/var-dumper": "~2.7|~3.0|~4.0",
"nikic/php-parser": "~1.3|~2.0|~3.0|~4.0", "nikic/php-parser": "~1.3|~2.0|~3.0|~4.0",

View file

@ -9,7 +9,7 @@
* file that was distributed with this source code. * file that was distributed with this source code.
*/ */
$config->setRuntimeDir(sys_get_temp_dir() . '/psysh_test/withconfig/temp'); $config->setRuntimeDir(\sys_get_temp_dir() . '/psysh_test/withconfig/temp');
return [ return [
'useReadline' => true, 'useReadline' => true,