Tippstart auf Tippable round, Link Roundmail: Tipps@Tippspiel

This commit is contained in:
Torsten 2017-08-26 15:15:54 +02:00
parent 0abaeb2eba
commit 6aad1a7ab2
13 changed files with 149 additions and 34 deletions

View file

@ -66,6 +66,8 @@ class Round extends Model
return -1;
}
public static function getLastLockedRoundId() {
$season = Season::getCurrent();
$rounds=Round::where('season_id','=',$season->id)->orderBy('id')->get();
@ -78,6 +80,18 @@ class Round extends Model
return $lastLockedRoundId;
}
public static function getFirstTippableRound() {
$season = Season::getCurrent();
$rounds=Round::where('season_id','=',$season->id)->orderBy('id')->get();
$locked = false;
foreach ($rounds as $round) {
if (!Round::hasLockedGame($round->id) ) {
return $round;
}
}
return null;
}
public static function getClosestRoundToNow() {
$sql="select round_id,DATEDIFF(NOW(),kickoff) from games order by 2 desc limit 1;";
$result=DB::select($sql);