This commit is contained in:
Torsten 2017-08-01 13:35:34 +02:00
parent 09b75172d8
commit 64e4959884
9 changed files with 91 additions and 67 deletions

View file

@ -16,8 +16,22 @@ use Log;
class UsersController extends Controller
{
public function main() {
$roundname="";
$report="";
return view('main');
$currentSeason=Season::getCurrent();
if ($currentSeason) {
$round_id = Round::getLastLockedRoundId();
if ($round_id > -1) {
$round = Round::where("id", "=", $round_id)->first();
$report = $round->report;
Log::info("Loaded report:".$report." round-id=".$round_id);
$roundname = $round->name;
} else { Log::info("No round identified. Last Locked=".$round_id); }
} else {Log::info("No current season");}
return view('main',compact('roundname','report'));
}
public function index() {
@ -87,6 +101,8 @@ class UsersController extends Controller
return redirect('/users');
}
public function ranking($round_id) {
Log::info("Start ranking");
@ -166,9 +182,6 @@ class UsersController extends Controller
if (!array_key_exists($key,$tendencies)) { $tendencies[$key]=0; }
$tendencies[$key]+=1;
if ($user->id==1) {
Log::info("Triggered tendency bonus for userid ".$user->id." gameid ".$game->id." roundid ".$round->id." tippid ".$tipp->id." tendency=". $tendencies[$key]);
}
}
$user->totalScore += $score;
@ -185,7 +198,7 @@ class UsersController extends Controller
// Increase score here
if (array_key_exists($key,$tendencies)) {
if ($tendencies[$key] == 4) {
Log::info("Increasing score ! userid=" . $user->id . ", gameid " . $game->id . ", roundid " . $round->id . ", tippid " . $tipp->id . ", tendency=" . $tendencies[$key]);
//Log::info("Increasing score ! userid=" . $user->id . ", gameid " . $game->id . ", roundid " . $round->id . ", tippid " . $tipp->id . ", tendency=" . $tendencies[$key]);
$user->totalScore += 2;
$user->dayScore+=2;
}