Arbeit an Auf/Abstieg

This commit is contained in:
Torsten 2017-10-16 11:19:57 +02:00
parent 8edec26147
commit ed0c445bfa
5 changed files with 107 additions and 18 deletions

View file

@ -27,6 +27,10 @@ class Match extends Model
$currentSeason = Season::getCurrent();
$leagues = League::where('season_id', '=', $currentSeason->id)->get();
foreach ($leagues as $league) {
// Wenn es keine previous League gibt, dann ist $league->rank immer RANK_QUALIFICATION,
// ansonsten ist es einer von RANK_LEAGUE1, RANK_LEAGUE2, RANK_LEAGUE3
if ($league->rank == League::RANK_QUALIFICATION) {
$rounds = Round::where('id','>=',$league->start_round_id)->get();
$roundNr=1;
@ -87,14 +91,16 @@ class Match extends Model
}
public static function getLeagueMatches($league_id) {
//$matches = Match::where('league_id','=',$league_id)->orderBy('round_id')->get();
$matches = DB::table('leagues_matches')->where('league_id','=',$league_id)->orderBy('round_id')->get();
$season = Season::getCurrent();
$roundnames = Round::getNames();
public static function getLeagueMatches($leagueId) {
//error_log("App\Match::getLeagueMatches(leagueId=".$leagueId.")");
$matches = DB::table('leagues_matches')->where('league_id','=',$leagueId)->orderBy('round_id')->get();
$league=League::where('id','=',$leagueId)->first();
$season = Season::where('id','=',$league->season_id)->first();
$roundnames = Round::getNames($season->id);
$usernames = User::getNames();
foreach($matches as $match) {
//error_log("Needed round_id: ".$match->round_id);
$match->round_name = $roundnames[$match->round_id];
$match->user1_name = $usernames[$match->user1_id];
$match->user2_name = $usernames[$match->user2_id];