Bugfix Round::getFirstTippableRound

This commit is contained in:
Torsten 2017-11-09 17:29:02 +01:00
parent c337916a3b
commit 922db48c36
3 changed files with 12518 additions and 5 deletions

12508
d0274241_2017-11-09_1714.sql Normal file

File diff suppressed because it is too large Load diff

View file

@ -137,7 +137,11 @@ class TippsController extends Controller
}
}
$tippLink="/tipps#".\App\Round::getFirstTippableRound()->id;
$tippLink="/tipps#";
$r=\App\Round::getFirstTippableRound();
if($r) $tippLink=$tippLink.$r->id;
// Redirect to the Rounds Index
return redirect($tippLink);
}

View file

@ -125,9 +125,9 @@ class Round extends Model
public static function getFirstTippableRoundId($seasonId=-1) {
$season=null;
if ($seasonId==-1) {
$currentSeason=Season::getCurrent();
$season=Season::getCurrent();
} else {
$currentSeason=Season::where('id','=', $seasonId)->first();
$season=Season::where('id','=', $seasonId)->first();
}
if (!$season) return null;
@ -139,13 +139,14 @@ class Round extends Model
public static function getFirstTippableRound($seasonId=-1) {
$season=null;
if ($seasonId==-1) {
$currentSeason=Season::getCurrent();
$season=Season::getCurrent();
} else {
$currentSeason=Season::where('id','=', $seasonId)->first();
$season=Season::where('id','=', $seasonId)->first();
}
if (!$season) return null;
$rounds=Round::where('season_id','=',$season->id)->orderBy('id')->get();
$locked = false;
foreach ($rounds as $round) {
if (!Round::hasLockedGame($round->id) ) {