Updating repo for cross-computer work
This commit is contained in:
parent
807cf49bc0
commit
1fea0f4fe7
18 changed files with 87847 additions and 5202 deletions
|
|
@ -54,6 +54,7 @@ class TippsController extends Controller
|
|||
|
||||
}
|
||||
|
||||
|
||||
//Duplicate from Tipps model
|
||||
//TODO: Refactor usage to use only the Tipps version
|
||||
public static function createAllTips(){
|
||||
|
|
@ -67,6 +68,7 @@ class TippsController extends Controller
|
|||
Log::info($a->getEndMessage());
|
||||
}
|
||||
|
||||
|
||||
public function index()
|
||||
{
|
||||
if (Auth::guest()) { return redirect("/"); }
|
||||
|
|
@ -83,13 +85,15 @@ class TippsController extends Controller
|
|||
|
||||
$rounds = null;
|
||||
|
||||
TippsController::createTipps($user->id); // ggfs. fehlender Tipp Eintraege einfügen
|
||||
TippsController::createTipps($user->id); // ggfs. fehlende Tipp Eintraege einfügen
|
||||
|
||||
$lastLockedRoundId=Round::getLastLockedRoundId();
|
||||
|
||||
$rounds = Round::where('season_id', '=', $activeSeason->id)->get();
|
||||
$max_identical_jokertipps=$activeSeason->maxIdenticalJokertipps();
|
||||
|
||||
return view('tipps.index', compact('rounds', 'activeSeason', 'user'));
|
||||
|
||||
return view('tipps.index', compact('rounds', 'activeSeason', 'user', 'max_identical_jokertipps'));
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -115,17 +119,39 @@ class TippsController extends Controller
|
|||
$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.
|
||||
//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')) {
|
||||
$tipp->joker=true;
|
||||
Log::info("Request has joker");
|
||||
} else {
|
||||
$tipp->joker = false;
|
||||
Log::info("Request has NO joker");
|
||||
}
|
||||
|
||||
// Neuerung 2020-01-09: Joker nur speichern, wenn Ergebnis nicht schon zu oft "gejokert" wurde.
|
||||
Log::info("Checking for joker");
|
||||
if ($tipp->joker) {
|
||||
Log::info("Joker found.");
|
||||
$jokertipps=Tipp::getJokerUsageArray($user->id,$game->round_id);
|
||||
$key=$tipp->score1.":".$tipp->score2;
|
||||
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);
|
||||
$limit=Season::getCurrent()->maxIdenticalJokertipps();
|
||||
if (intval($value)>=intval($limit)) {
|
||||
Log::info("**JOKERLIMIT REACHED FOR GAMESCORE:".$key);
|
||||
return redirect('/tipps/joker_impossible');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$tipp->save();
|
||||
|
||||
|
||||
|
|
@ -158,6 +184,10 @@ class TippsController extends Controller
|
|||
return redirect($tippLink);
|
||||
}
|
||||
|
||||
public static function joker_impossible() {
|
||||
return view('tipps.joker_impossible');
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue