Working on Qualification Pairings

This commit is contained in:
Torsten 2017-09-22 17:40:48 +02:00
parent 9c0f94758d
commit a66189ca00
19 changed files with 9005 additions and 237 deletions

View file

@ -4,6 +4,8 @@ namespace App;
use Illuminate\Database\Eloquent\Model;
use App\Game;
use App\Season;
use Log;
use DB;
use Carbon;
@ -65,7 +67,15 @@ class Round extends Model
return -1;
}
public static function getNextRoundId($roundId) {
$currentSeason = Season::getCurrent();
$rounds = Round::where('season_id','=',$currentSeason->id)->where('id','>=',$roundId)->get();
foreach($rounds as $round) {
if ($round->id == $roundId) { continue; }
return $round->id;
}
return -1;
}
public static function getLastLockedRoundId() {
$season = Season::getCurrent();
@ -132,5 +142,15 @@ class Round extends Model
return $hourDiffToLock;
}
public static function getNames() {
$season= Season::getCurrent();
$rounds = Round::where('season_id','=',$season->id)->get();
Log::info("START");
$roundnames = array();
foreach($rounds as $round) {
$roundnames[$round->id] = $round->name;
}
return $roundnames;
}
}