TimeLogger moved, League ranking also for not completed but started rounds
This commit is contained in:
parent
78a4a04cdf
commit
90c6d60ecd
26 changed files with 692 additions and 376 deletions
|
|
@ -22,10 +22,15 @@ use Auth;
|
|||
use Log;
|
||||
|
||||
use Carbon;
|
||||
use App\MyClasses\TimeLogger;
|
||||
|
||||
class UsersController extends Controller
|
||||
{
|
||||
public function main() {
|
||||
$a=new TimeLogger("UsersController::main()");
|
||||
Log::info($a->getStartMessage());
|
||||
//error_log($a->getStartMessage());
|
||||
|
||||
$currentSeason=Season::getCurrent();
|
||||
$roundname="";
|
||||
$report="";
|
||||
|
|
@ -90,15 +95,30 @@ class UsersController extends Controller
|
|||
}
|
||||
}
|
||||
|
||||
Log::info($a->getEndMessage());
|
||||
//error_log($a->getEndMessage());
|
||||
|
||||
return view('main',compact('roundname','display_rounds','message_text_joker','message_text_tipps','nextRoundName','nextRoundLockTime', 'hourDiffToLock'));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function index() {
|
||||
$a=new TimeLogger("UserController::index()");
|
||||
Log::info($a->getStartMessage());
|
||||
//error_log($a->getStartMessage());
|
||||
|
||||
if (Auth::guest()) { return redirect("/"); }
|
||||
if (!Auth::user()->admin) { return redirect("/"); }
|
||||
|
||||
$activeUsers = User::getActives();
|
||||
|
||||
$b=new TimeLogger("UsersController::index-db_subqueries");
|
||||
Log::info($b->getStartMessage());
|
||||
|
||||
$currentSeason=Season::getCurrent();
|
||||
if (!$currentSeason) { return redirect('/'); }
|
||||
|
||||
|
|
@ -107,28 +127,45 @@ class UsersController extends Controller
|
|||
|
||||
$users = DB::table('users')->where('deleted',null)->orderBy('lastname')->get();
|
||||
|
||||
foreach($users as $key => $user) {
|
||||
if (User::hasMissingTipp($user->id)) {
|
||||
$users[$key]->missingTippText="Tipps fehlen";
|
||||
$users[$key]->tippStyling="red";
|
||||
Log::info($b->getEndMessage());
|
||||
|
||||
|
||||
Log::info($a->getStartMessage());
|
||||
$missingTipps = User::getMissingTippsAndJokers($users);
|
||||
|
||||
$c=new TimeLogger("UsersController::index-missingTipp Loop");
|
||||
Log::info($c->getStartMessage());
|
||||
|
||||
|
||||
foreach($users as $user_id => $user) {
|
||||
if (array_key_exists($user_id, $missingTipps["MISSING_TIPP"])) {
|
||||
$users[$user_id]->missingTippText = "Tipps fehlen";
|
||||
$users[$user_id]->tippStyling = "red";
|
||||
} else {
|
||||
$users[$key]->missingTippText="Runde getippt";
|
||||
$users[$key]->tippStyling="green";
|
||||
$users[$user_id]->missingTippText = "Runde getippt";
|
||||
$users[$user_id]->tippStyling = "green";
|
||||
}
|
||||
if (User::hasMissingJoker($user->id)) {
|
||||
$users[$key]->missingJokerText="Joker fehlt";
|
||||
$users[$key]->jokerStyling="red";
|
||||
|
||||
|
||||
if (array_key_exists($user_id, $missingTipps["MISSING_JOKER"])) {
|
||||
$users[$user_id]->missingJokerText = "Joker fehlt";
|
||||
$users[$user_id]->jokerStyling = "red";
|
||||
} else {
|
||||
$users[$key]->missingJokerText="Joker gesetzt";
|
||||
$users[$key]->jokerStyling="green";
|
||||
$users[$user_id]->missingJokerText = "Joker gesetzt";
|
||||
$users[$user_id]->jokerStyling = "green";
|
||||
}
|
||||
}
|
||||
|
||||
Log::info($c->getEndMessage());
|
||||
|
||||
$round = Round::getFirstTippableRound();
|
||||
$firstTippableRound=new Round();
|
||||
$firstTippableRound->name="-";
|
||||
if ($round) { $firstTippableRound = $round; }
|
||||
|
||||
Log::info($a->getEndMessage());
|
||||
//error_log($a->getEndMessage());
|
||||
|
||||
return view('users.index', compact('users','active_user_count','total_user_count', 'firstTippableRound'));
|
||||
}
|
||||
/*
|
||||
|
|
@ -160,6 +197,11 @@ class UsersController extends Controller
|
|||
|
||||
public function store() {
|
||||
if (Auth::guest()) { return redirect("/"); }
|
||||
|
||||
$a=new TimeLogger("UsersController::store()");
|
||||
Log::info($a->getStartMessage());
|
||||
//error_log($a->getStartMessage());
|
||||
|
||||
$season_id = Season::getCurrent()->id;
|
||||
// Validate form
|
||||
$this->validate(request(), [
|
||||
|
|
@ -194,6 +236,9 @@ class UsersController extends Controller
|
|||
|
||||
Tipp::createAllTips();
|
||||
|
||||
Log::info($a->getEndMessage());
|
||||
//error_log($a->getEndMessage());
|
||||
|
||||
return redirect('/users');
|
||||
}
|
||||
|
||||
|
|
@ -657,28 +702,28 @@ class UsersController extends Controller
|
|||
|
||||
|
||||
|
||||
public function gshirt_ranking() {
|
||||
if (Auth::guest()) { return redirect("/"); }
|
||||
public function gshirt_ranking() {
|
||||
if (Auth::guest()) { return redirect("/"); }
|
||||
|
||||
// Check ob mindestens eine Runde der Saison gelockt ist und angezeigt werden kann
|
||||
// Check ob mindestens eine Runde der Saison gelockt ist und angezeigt werden kann
|
||||
|
||||
$season=Season::getCurrent();
|
||||
$seasonId=$season->id;
|
||||
$season=Season::getCurrent();
|
||||
$seasonId=$season->id;
|
||||
|
||||
$max_round_id = Round::getLastCompleteRoundId();
|
||||
if ($max_round_id==-1) {
|
||||
$max_round_id = Round::getLastCompleteRoundId();
|
||||
if ($max_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=".$seasonId." and games.round_id=rounds.id order by rounds.id;";
|
||||
//dd($sql);
|
||||
$entries = DB::select($sql);
|
||||
$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=".$seasonId." and games.round_id=rounds.id order by rounds.id;";
|
||||
//dd($sql);
|
||||
$entries = DB::select($sql);
|
||||
|
||||
if (count($entries)>0) {
|
||||
$start_date = $entries[0]->start_date;
|
||||
return view('users.no_ranking', compact('start_date'));
|
||||
} else {
|
||||
return redirect("/");
|
||||
}
|
||||
if (count($entries)>0) {
|
||||
$start_date = $entries[0]->start_date;
|
||||
return view('users.no_ranking', compact('start_date'));
|
||||
} else {
|
||||
return redirect("/");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue