diff --git a/pfosten/app/Http/Controllers/TippsController.php b/pfosten/app/Http/Controllers/TippsController.php index 384bc39d..3a76ca19 100755 --- a/pfosten/app/Http/Controllers/TippsController.php +++ b/pfosten/app/Http/Controllers/TippsController.php @@ -104,6 +104,9 @@ class TippsController extends Controller public function edit4($round_id) { $user=Auth::user(); + + Log::info("TippsController::edit4 for user-id ".$user->id); + Log::info("Multi fetch result for tipps"); $round=Round::where('id','=', $round_id)->first(); $games=Game::where('round_id', '=', $round_id)->get(); @@ -131,7 +134,7 @@ class TippsController extends Controller ]); $user=Auth::user(); - + Log::info("TippsController::store for user-id ".$user->id); // Fetch, modify, save Tipp $tipp = Tipp::where('id', request('id'))->first(); $game = Game::where('id', $tipp->game_id)->first(); @@ -262,22 +265,27 @@ class TippsController extends Controller // If store fails, the jokerlimit has been reached. Redirect to edit4 page if (self::tryStore($tipp_id_1, $game_id_1, $round_id, $score1_1, $score2_1, $joker_1 ) == false) { - return redirect('/tipps/edit4/'.$round_id); + //return redirect('/tipps/edit4/'.$round_id); + return redirect('/tipps/joker_impossible'); + } // If store fails, the jokerlimit has been reached. Redirect to edit4 page if (self::tryStore($tipp_id_2, $game_id_2, $round_id, $score1_2, $score2_2, $joker_2) == false) { - return redirect('/tipps/edit4/'.$round_id); + return redirect('/tipps/joker_impossible'); + } // If store fails, the jokerlimit has been reached. Redirect to edit4 page if (self::tryStore($tipp_id_3, $game_id_3, $round_id, $score1_3, $score2_3, $joker_3 ) == false) { - return redirect('/tipps/edit4/'.$round_id); + return redirect('/tipps/joker_impossible'); + } // If store fails, the jokerlimit has been reached. Redirect to edit4 page if (self::tryStore($tipp_id_4, $game_id_4, $round_id, $score1_4, $score2_4, $joker_4 ) == false) { - return redirect('/tipps/edit4/'.$round_id); + return redirect('/tipps/joker_impossible'); + } return redirect('/tipps/'); @@ -285,11 +293,11 @@ class TippsController extends Controller // Store tipp if valid. public function tryStore($tipp_id, $game_id, $round_id, $score1, $score2, $has_joker ) { - error_log("Starting tryStore"); + Log::info("Starting tryStore"); $user=Auth::user(); $tipp = Tipp::where('id', $tipp_id)->first(); - error_log("tipp_id=".$tipp->id); + Log::info("tipp_id=".$tipp->id); $game = Game::where('id', $game_id)->first(); $round= Round::where('id',$round_id)->first(); @@ -299,27 +307,26 @@ class TippsController extends Controller if ($tipp->joker) { $jokertipps=Tipp::getJokerUsageArray($user->id,$round_id); $key=$tipp->score1.":".$tipp->score2; - //Log::info("Key(Gamescore):".$key); - error_log("Key(Gamescore):".$key); + Log::info("Key(Gamescore):".$key); if (array_key_exists($key,$jokertipps)) { //Log::info("Key found in jokertipps array"); $value=$jokertipps[$key]; - //Log::info("Stored value:".$value); + Log::info("Stored value:".$value); $limit=Season::getCurrent()->maxIdenticalJokertipps(); if (intval($value)>=intval($limit)) { - //Log::info("**JOKERLIMIT REACHED FOR GAMESCORE:".$key); - error_log("**JOKERLIMIT REACHED FOR GAMESCORE:".$key); - error_log("Returning false"); + Log::info("**JOKERLIMIT REACHED FOR GAMESCORE:".$key); + Log::info("Returning false"); return false; // Returning false should make store4 method return to edit4 page. } } } + Log::info("tryStore: Saving score ".$score1.":".$score2." for user-id ".$user->id); $tipp->score1=$score1; $tipp->score2=$score2; $tipp->joker=$has_joker; $tipp->save(); - error_log("Returning true"); + Log::info("Returning true"); return true; // Returning true should make store4 method return to general tipps (index) page. } diff --git a/pfosten/resources/views/tipps/index.blade.php b/pfosten/resources/views/tipps/index.blade.php index d6dad44f..e241fffe 100755 --- a/pfosten/resources/views/tipps/index.blade.php +++ b/pfosten/resources/views/tipps/index.blade.php @@ -67,8 +67,9 @@ - @if (Auth::user()->admin) - @if(App\Round::hasLockedGame($round->id)!=true) + + @if(App\Round::hasLockedGame($round->id)!=true) + @if (Auth::user()->admin) Runde Tippen @endif @endif diff --git a/pfosten/resources/views/tipps/joker_impossible.blade.php b/pfosten/resources/views/tipps/joker_impossible.blade.php index 0a011433..8b56b068 100755 --- a/pfosten/resources/views/tipps/joker_impossible.blade.php +++ b/pfosten/resources/views/tipps/joker_impossible.blade.php @@ -4,8 +4,8 @@
-

Ungültige Tippeingabe: Joker wurde zu oft verwendet.

-
Zu den Tipps
+

Ungültige Tippeingabe: Joker wurde zu oft verwendet.

+
Zu den Tipps