several cosmetic updates

This commit is contained in:
Torsten 2017-08-04 16:51:28 +02:00
parent 5a90bb2c8a
commit 8c368524fe
8 changed files with 56 additions and 24 deletions

View file

@ -26,14 +26,8 @@ class Game extends Model
public function hasResult() { public function hasResult() {
$game = $this; $game = $this;
$hasIt = $game->score1 > -1; return $game->score1 > -1;
if ($hasIt==false) {
return false;
}
return true;
} }
public static function has_result($game_id) { public static function has_result($game_id) {

View file

@ -62,17 +62,12 @@ class TippsController extends Controller
return redirect('/'); return redirect('/');
} }
if (! User::payment_date($user->id, $activeSeason->id)) { if (! User::payment_date($user->id, $activeSeason->id)) {
return view('users.no_payment'); return view('users.no_payment');
} }
$rounds = null; $rounds = null;
TippsController::createTipps($user->id); // ggfs. fehlender Tipp Eintraege einfügen TippsController::createTipps($user->id); // ggfs. fehlender Tipp Eintraege einfügen
@ -106,20 +101,21 @@ class TippsController extends Controller
$user=Auth::user(); $user=Auth::user();
if (Game::locked(request('id'))) return redirect('/tipps'); // Für Schlauberger, die die Tippmaske auflassen.
// Fetch, modify, save Tipp // Fetch, modify, save Tipp
$tipp = Tipp::where('id', request('id'))->first(); $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->score1= request('score1');
$tipp->score2= request('score2'); $tipp->score2= request('score2');
if (request()->has('joker')) { if (request()->has('joker')) {
if (Round::hasLockedGame(request('round_id'))==false) { // Jokermod nur wenn Runde noch nicht begonnen hat $tipp->joker=true;
$tipp->joker=true; } else {
} else { $tipp->joker = false;
$tipp->joker = false;
}
} }
$tipp->save(); $tipp->save();

View file

@ -113,7 +113,18 @@ class UsersController extends Controller
if($round_id==-1) { if($round_id==-1) {
$round_id = Round::getLastLockedRoundId(); $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("/"); } if (Auth::guest()) { return redirect("/"); }

View file

@ -5,6 +5,7 @@ namespace App;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use App\Game; use App\Game;
use Log; use Log;
use DB;
class Round extends Model class Round extends Model
{ {
@ -66,4 +67,11 @@ class Round extends Model
return $lastLockedRoundId; 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;
}
} }

View file

@ -8,7 +8,7 @@
<a class="lead" href="/">Start</a> &nbsp; &nbsp; &nbsp; <a class="lead" href="/">Start</a> &nbsp; &nbsp; &nbsp;
@if (Auth::user()->admin) @if (Auth::user()->admin)
<a class="lead" href="/seasons">Saison</a> &nbsp; &nbsp; &nbsp; <a class="lead" href="/seasons">Saison</a> &nbsp; &nbsp; &nbsp;
<a class="lead" href="/rounds">Runden</a> &nbsp; &nbsp; &nbsp; <a class="lead" href="/rounds#{{\App\Round::getClosestRoundToNow()}}">Runden</a> &nbsp; &nbsp; &nbsp;
<a class="lead" href="/users">Spieler</a> &nbsp; &nbsp; &nbsp; <a class="lead" href="/users">Spieler</a> &nbsp; &nbsp; &nbsp;
@endif @endif
<a class="lead" href="/tipps">Tipps</a> &nbsp; &nbsp; &nbsp; <a class="lead" href="/tipps">Tipps</a> &nbsp; &nbsp; &nbsp;

View file

@ -14,8 +14,8 @@
<div class="container"> <div class="container">
<!-- Start Runden-Loop--> <!-- Start Runden-Loop-->
@foreach($rounds->reverse() as $round) @foreach($rounds as $round)
<div><a class="text lead" style="font-size: 38px" href="/rounds/editname/{{ $round->id }}">{{ $round->name }} </a></div> <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"> <table class="table-bordered">
<tr class="table-bordered"> <tr class="table-bordered">
@ -56,6 +56,8 @@
</form> </form>
<p>&nbsp;</p> <p>&nbsp;</p>
<p>&nbsp;</p>
@endforeach @endforeach
</div> </div>

View file

@ -16,7 +16,7 @@
@if ($activeSeason) @if ($activeSeason)
<div> <div>
@foreach($rounds->reverse() as $round) @foreach($rounds as $round)
<div><label class="text lead">{{ $round->name }} </label></div> <div><label class="text lead">{{ $round->name }} </label></div>

View 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