...
This commit is contained in:
parent
ed0c445bfa
commit
30f6157606
15 changed files with 248 additions and 169 deletions
|
|
@ -59,8 +59,10 @@ class Round extends Model
|
|||
}
|
||||
|
||||
public static function getFirstIncompleteRound() {
|
||||
$season_id = Season::getCurrent()->id;
|
||||
$rounds = Round::where('season_id','=',$season_id)->orderBy('id')->get();
|
||||
$season = Season::getCurrent();
|
||||
if (!$season) return -1;
|
||||
|
||||
$rounds = Round::where('season_id','=',$season->id)->orderBy('id')->get();
|
||||
foreach($rounds as $round) {
|
||||
if (!Round::isCompleted($round->id)) return $round->id;
|
||||
}
|
||||
|
|
@ -69,6 +71,8 @@ class Round extends Model
|
|||
|
||||
public static function getNextRoundId($roundId) {
|
||||
$currentSeason = Season::getCurrent();
|
||||
if (!$currentSeason) return -1;
|
||||
|
||||
$rounds = Round::where('season_id','=',$currentSeason->id)->where('id','>=',$roundId)->get();
|
||||
foreach($rounds as $round) {
|
||||
if ($round->id == $roundId) { continue; }
|
||||
|
|
@ -79,6 +83,7 @@ class Round extends Model
|
|||
|
||||
public static function getLastLockedRoundId() {
|
||||
$season = Season::getCurrent();
|
||||
if (!$season) return -1;
|
||||
$rounds=Round::where('season_id','=',$season->id)->orderBy('id')->get();
|
||||
$lastLockedRoundId=-1;
|
||||
foreach ($rounds as $round) {
|
||||
|
|
@ -89,8 +94,15 @@ class Round extends Model
|
|||
return $lastLockedRoundId;
|
||||
}
|
||||
|
||||
public static function getFirstTippableRoundId() {
|
||||
$round = Round::getFirstTippableRound();
|
||||
if (!$round) return -1;
|
||||
return $round->id;
|
||||
}
|
||||
|
||||
public static function getFirstTippableRound() {
|
||||
$season = Season::getCurrent();
|
||||
if (!$season) return null;
|
||||
$rounds=Round::where('season_id','=',$season->id)->orderBy('id')->get();
|
||||
$locked = false;
|
||||
foreach ($rounds as $round) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue