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

@ -20,9 +20,14 @@ use App\Leagues\Match;
use Log;
use DB;
use App\MyClasses\TimeLogger;
class LeaguesController extends Controller
{
public function index() {
$a=new TimeLogger("LeaguesController.index");
Log::info($a->getStartMessage());
$season=Season::getCurrent();
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'));
}
public function createLeagues($start_round_id, $round_count) {
$a=new TimeLogger("LeaguesController::createLeagues()");
Log::info($a->getStartMessage());
$users=User::getActives();
if (sizeof($users)==0){
Log::info($a->getEndMessage());
return view("leagues.no_users");
}
@ -79,12 +88,16 @@ class LeaguesController extends Controller
Match::createMatchups();
Log::info($a->getEndMessage());
return redirect("/seasons");
}
public function showLeagueRounds() {
if (Auth::guest()) { return redirect("/"); }
$a=new TimeLogger("LeaguesController::showLeagueRounds()");
Log::info($a->getStartMessage());
$season=Season::getCurrent();
$roundNames = Round::getNames();
@ -106,18 +119,26 @@ class LeaguesController extends Controller
$matchesTotal[$match->round_id][$league->id] = $lg;
}
}
Log::info($a->getEndMessage());
return view ('leagues.matches', compact('season', 'matchesTotal','leagues','leagueNames','roundNames'));
}
public static function showLeagueRanking() {
$a=new TimeLogger("LeaguesController::showLeagueRanking()");
Log::info($a->getStartMessage());
$season = Season::getCurrent();
//$leagues = array_reverse(League::getRanking($rank));
$leagueNames = League::getNames();
$userNames = User::getNames();
$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.
$rankInfo=array();
@ -138,6 +159,9 @@ class LeaguesController extends Controller
$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'));
}