Start of Test Class, fixing ranking visibiliy of open rounds issue

This commit is contained in:
Torsten 2017-10-06 12:17:49 +02:00
parent 7545760aa2
commit 29e493e22d
11 changed files with 11891 additions and 43 deletions

View file

@ -171,32 +171,28 @@ class LeaguesController extends Controller
return redirect("/seasons");
}
public function showLeagueRounds($league_rank, $maxRoundId) {
public function showLeagueRounds($league_rank) {
if (Auth::guest()) { return redirect("/"); }
$season=Season::getCurrent();
$maxRoundId = min(Round::getLastRoundId($season->id),$maxRoundId);
$roundNames = Round::getNames();
$leagueNames = League::getNames();
$leagues = League::where('season_id','=',$season->id)->where('rank','=', $league_rank)->orderBy('id')->get();
$matchesTotal = array();
foreach ($leagues as $league) {
$matches = Match::getMatchResults($league->id, $maxRoundId);
$matches = Match::getMatchResults($league->id, -1);
foreach ($matches as $match) {
if ($match->round_id <= $maxRoundId) {
if (!key_exists($match->round_id, $matchesTotal)) {
$matchesTotal[$match->round_id]=array();
}
if (!key_exists($league->id, $matchesTotal[$match->round_id] )) {
$matchesTotal[$match->round_id][$league->id]=array();
}
$lg = $matchesTotal[$match->round_id][$league->id];
array_push($lg, $match);
$matchesTotal[$match->round_id][$league->id] = $lg;
if (!key_exists($match->round_id, $matchesTotal)) {
$matchesTotal[$match->round_id]=array();
}
if (!key_exists($league->id, $matchesTotal[$match->round_id] )) {
$matchesTotal[$match->round_id][$league->id]=array();
}
$lg = $matchesTotal[$match->round_id][$league->id];
array_push($lg, $match);
$matchesTotal[$match->round_id][$league->id] = $lg;
}
}