several cosmetic updates
This commit is contained in:
parent
5a90bb2c8a
commit
8c368524fe
8 changed files with 56 additions and 24 deletions
|
|
@ -26,14 +26,8 @@ class Game extends Model
|
|||
public function hasResult() {
|
||||
|
||||
$game = $this;
|
||||
$hasIt = $game->score1 > -1;
|
||||
return $game->score1 > -1;
|
||||
|
||||
if ($hasIt==false) {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static function has_result($game_id) {
|
||||
|
|
|
|||
|
|
@ -62,17 +62,12 @@ class TippsController extends Controller
|
|||
return redirect('/');
|
||||
}
|
||||
|
||||
|
||||
if (! User::payment_date($user->id, $activeSeason->id)) {
|
||||
return view('users.no_payment');
|
||||
}
|
||||
|
||||
|
||||
$rounds = null;
|
||||
|
||||
|
||||
|
||||
|
||||
TippsController::createTipps($user->id); // ggfs. fehlender Tipp Eintraege einfügen
|
||||
|
||||
|
||||
|
|
@ -106,20 +101,21 @@ class TippsController extends Controller
|
|||
|
||||
$user=Auth::user();
|
||||
|
||||
if (Game::locked(request('id'))) return redirect('/tipps'); // Für Schlauberger, die die Tippmaske auflassen.
|
||||
|
||||
// Fetch, modify, save Tipp
|
||||
$tipp = Tipp::where('id', request('id'))->first();
|
||||
$game = Game::where('id', $tipp->game_id)->first();
|
||||
$round= Round::where('id',$game->round_id)->first();
|
||||
if (Round::hasLockedGame($round->id)) { return redirect('/tipps'); } // Für Schlauberger, die die Tippmaske auflassen.
|
||||
|
||||
$tipp->score1= request('score1');
|
||||
$tipp->score2= request('score2');
|
||||
|
||||
if (request()->has('joker')) {
|
||||
if (Round::hasLockedGame(request('round_id'))==false) { // Jokermod nur wenn Runde noch nicht begonnen hat
|
||||
$tipp->joker=true;
|
||||
} else {
|
||||
$tipp->joker = false;
|
||||
}
|
||||
$tipp->joker=true;
|
||||
} else {
|
||||
$tipp->joker = false;
|
||||
}
|
||||
|
||||
$tipp->save();
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -113,7 +113,18 @@ class UsersController extends Controller
|
|||
|
||||
if($round_id==-1) {
|
||||
$round_id = Round::getLastLockedRoundId();
|
||||
if ($round_id==-1) {return redirect("/");}
|
||||
if ($round_id==-1) {
|
||||
|
||||
$sql="select DATE_FORMAT(date_sub(min(games.kickoff), interval 1 hour),'%d.%m.%Y %H:%i') as start_date from rounds,games where rounds.season_id=".$currentSeason->id." and games.round_id=rounds.id;";
|
||||
$date = DB::select($sql);
|
||||
|
||||
if (count($date)>0) {
|
||||
$start_date = $date[0]->start_date;
|
||||
return view('users.no_ranking', compact('start_date'));
|
||||
} else {
|
||||
return redirect("/");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Auth::guest()) { return redirect("/"); }
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ namespace App;
|
|||
use Illuminate\Database\Eloquent\Model;
|
||||
use App\Game;
|
||||
use Log;
|
||||
use DB;
|
||||
|
||||
class Round extends Model
|
||||
{
|
||||
|
|
@ -66,4 +67,11 @@ class Round extends Model
|
|||
return $lastLockedRoundId;
|
||||
}
|
||||
|
||||
public static function getClosestRoundToNow() {
|
||||
$sql="select round_id,DATEDIFF(NOW(),kickoff) from games order by 2 desc limit 1;";
|
||||
$result=DB::select($sql);
|
||||
if (count($result)==0) return 0;
|
||||
|
||||
return $result[0]->round_id;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
<a class="lead" href="/">Start</a>
|
||||
@if (Auth::user()->admin)
|
||||
<a class="lead" href="/seasons">Saison</a>
|
||||
<a class="lead" href="/rounds">Runden</a>
|
||||
<a class="lead" href="/rounds#{{\App\Round::getClosestRoundToNow()}}">Runden</a>
|
||||
<a class="lead" href="/users">Spieler</a>
|
||||
@endif
|
||||
<a class="lead" href="/tipps">Tipps</a>
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@
|
|||
|
||||
<div class="container">
|
||||
<!-- Start Runden-Loop-->
|
||||
@foreach($rounds->reverse() as $round)
|
||||
<div><a class="text lead" style="font-size: 38px" href="/rounds/editname/{{ $round->id }}">{{ $round->name }} </a></div>
|
||||
@foreach($rounds as $round)
|
||||
<div><a class="text lead" name="{{$round->id}}" style="font-size: 38px" href="/rounds/editname/{{ $round->id }}">{{ $round->name }} </a></div>
|
||||
|
||||
<table class="table-bordered">
|
||||
<tr class="table-bordered">
|
||||
|
|
@ -56,6 +56,8 @@
|
|||
</form>
|
||||
|
||||
<p> </p>
|
||||
<p> </p>
|
||||
|
||||
@endforeach
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
@if ($activeSeason)
|
||||
<div>
|
||||
|
||||
@foreach($rounds->reverse() as $round)
|
||||
@foreach($rounds as $round)
|
||||
|
||||
<div><label class="text lead">{{ $round->name }} </label></div>
|
||||
|
||||
|
|
|
|||
21
pfosten/resources/views/users/no_ranking.blade.php
Normal file
21
pfosten/resources/views/users/no_ranking.blade.php
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
@extends('layouts.layout')
|
||||
|
||||
@section('content')
|
||||
<section class="jumbotron text-center">
|
||||
<div class="container">
|
||||
<h1 class="jumbotron-heading"></h1>
|
||||
<p class="lead text-muted" style="color:red;">Dein Zahlungseingang für die Saison wurde noch nicht registriert.</p>
|
||||
<div><p></p><p></p><p></p></div>
|
||||
|
||||
<div>
|
||||
<a href="/" class="btn btn-primary">Ok</a>
|
||||
</div>
|
||||
<div><p></p><p></p><p></p></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
@endsection
|
||||
Loading…
Add table
Add a link
Reference in a new issue