Working on Roundmail system

This commit is contained in:
Torsten 2017-08-21 16:55:26 +02:00
parent 3fa31921f0
commit 6d7ee1a47c
11 changed files with 224 additions and 24 deletions

View file

@ -55,6 +55,21 @@ class Round extends Model
return $lastCompleteRound;
}
public static function getFirstIncompleteRound() {
$season_id = Season::getCurrent()->id;
$rounds = Round::where('season_id','=',$season_id)->orderBy('id')->get();
foreach($rounds as $round) {
$games = Game::where('round_id','=',$round->id);
foreach ($games as $game) {
if ($game->score1 == -1 || $game->score2 == -1) {
return $round->id;
}
}
}
return -1;
}
public static function getLastLockedRoundId() {
$season = Season::getCurrent();
$rounds=Round::where('season_id','=',$season->id)->orderBy('id')->get();