From beaba1d389ee10b1aa2625d28b864fb86b19defe Mon Sep 17 00:00:00 2001 From: Torsten Date: Fri, 3 Nov 2017 14:20:10 +0100 Subject: [PATCH] update, working on inter-season logic --- pfosten/.env | 33 - pfosten/.env_production | 33 - pfosten/.idea/pfosten.iml | 214 ---- pfosten/.idea/php.xml | 8 - pfosten/.idea/workspace.xml | 1028 ----------------- .../Controllers/Leagues/LeaguesController.php | 5 +- .../app/Http/Controllers/UsersController.php | 2 - pfosten/app/Tipp.php | 2 +- pfosten/app/leagues/League.php | 51 +- pfosten/resources/views/layouts/nav.blade.php | 4 +- pfosten/routes/web.php | 2 +- 11 files changed, 45 insertions(+), 1337 deletions(-) delete mode 100755 pfosten/.env delete mode 100644 pfosten/.env_production delete mode 100755 pfosten/.idea/pfosten.iml delete mode 100755 pfosten/.idea/php.xml delete mode 100755 pfosten/.idea/workspace.xml diff --git a/pfosten/.env b/pfosten/.env deleted file mode 100755 index 5a5f8b05..00000000 --- a/pfosten/.env +++ /dev/null @@ -1,33 +0,0 @@ -APP_NAME=Laravel -APP_ENV=local -APP_KEY=base64:kDZstIrXoxXzGa2reMEbvFjDhcaoJ4eKupyPnPL7euE= -APP_DEBUG=true -APP_LOG_LEVEL=debug -APP_URL=http://localhost - -DB_CONNECTION=mysql -DB_HOST=127.0.0.1 -DB_PORT=3306 -DB_DATABASE=pfosten -DB_USERNAME=root -DB_PASSWORD=root - -BROADCAST_DRIVER=log -CACHE_DRIVER=file -SESSION_DRIVER=file -QUEUE_DRIVER=sync - -REDIS_HOST=127.0.0.1 -REDIS_PASSWORD=null -REDIS_PORT=6379 - -MAIL_DRIVER=smtp -MAIL_HOST=smtp.mailtrap.io -MAIL_PORT=2525 -MAIL_USERNAME=null -MAIL_PASSWORD=null -MAIL_ENCRYPTION=null - -PUSHER_APP_ID= -PUSHER_APP_KEY= -PUSHER_APP_SECRET= \ No newline at end of file diff --git a/pfosten/.env_production b/pfosten/.env_production deleted file mode 100644 index 36be0483..00000000 --- a/pfosten/.env_production +++ /dev/null @@ -1,33 +0,0 @@ -APP_NAME=Laravel -APP_ENV=local -APP_KEY=base64:kDZstIrXoxXzGa2reMEbvFjDhcaoJ4eKupyPnPL7euE= -APP_DEBUG=true -APP_LOG_LEVEL=debug -APP_URL=http://localhost - -DB_CONNECTION=mysql -DB_HOST=127.0.0.1 -DB_PORT=3306 -DB_DATABASE=d026d238 -DB_USERNAME=d026d238 -DB_PASSWORD=superpfosten! - -BROADCAST_DRIVER=log -CACHE_DRIVER=file -SESSION_DRIVER=file -QUEUE_DRIVER=sync - -REDIS_HOST=127.0.0.1 -REDIS_PASSWORD=null -REDIS_PORT=6379 - -MAIL_DRIVER=smtp -MAIL_HOST=smtp.mailtrap.io -MAIL_PORT=2525 -MAIL_USERNAME=null -MAIL_PASSWORD=null -MAIL_ENCRYPTION=null - -PUSHER_APP_ID= -PUSHER_APP_KEY= -PUSHER_APP_SECRET= diff --git a/pfosten/.idea/pfosten.iml b/pfosten/.idea/pfosten.iml deleted file mode 100755 index 67c33590..00000000 --- a/pfosten/.idea/pfosten.iml +++ /dev/null @@ -1,214 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/pfosten/.idea/php.xml b/pfosten/.idea/php.xml deleted file mode 100755 index cf9b6b71..00000000 --- a/pfosten/.idea/php.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/pfosten/.idea/workspace.xml b/pfosten/.idea/workspace.xml deleted file mode 100755 index 127cb5d1..00000000 --- a/pfosten/.idea/workspace.xml +++ /dev/null @@ -1,1028 +0,0 @@ - - - - - - - - - - - - - - - $PROJECT_DIR$/composer.json - D:\dev\pfosten\composer.phar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - legacy-packages - http - s - secure- - secure-h - secure-ht - secure-htt - secure-http - secure - joker - index - has_ - Check RF - User: - C - Che - Check Ro - Check Round - $tendencyCount - - - - - - - - - - - - - true - DEFINITION_ORDER - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - project - - - - - - - - - - - - - - - - project - - - true - - - - DIRECTORY - - false - - - - - - - - - - - - - - - - - - - - 1498978123218 - - - 1499101582930 - - - 1499102358213 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/pfosten/app/Http/Controllers/Leagues/LeaguesController.php b/pfosten/app/Http/Controllers/Leagues/LeaguesController.php index 56ee2912..72aa1f32 100644 --- a/pfosten/app/Http/Controllers/Leagues/LeaguesController.php +++ b/pfosten/app/Http/Controllers/Leagues/LeaguesController.php @@ -75,14 +75,14 @@ class LeaguesController extends Controller return redirect("/seasons"); } - public function showLeagueRounds($league_rank) { + public function showLeagueRounds() { if (Auth::guest()) { return redirect("/"); } $season=Season::getCurrent(); $roundNames = Round::getNames(); $leagueNames = League::getNames(); - $leagues = League::where('season_id','=',$season->id)->where('rank','=', $league_rank)->orderBy('id')->get(); + $leagues = League::where('season_id','=',$season->id)->where('rank','<', 4)->orderBy('id')->get(); $matchesTotal = array(); foreach ($leagues as $league) { @@ -110,6 +110,7 @@ class LeaguesController extends Controller $userNames = User::getNames(); $leagueScores = League::getRanking($rank); + return view ('leagues.chart',compact('season','leagues', 'leagueNames', 'userNames','leagueScores')); } diff --git a/pfosten/app/Http/Controllers/UsersController.php b/pfosten/app/Http/Controllers/UsersController.php index a330f9a1..5e596cc1 100755 --- a/pfosten/app/Http/Controllers/UsersController.php +++ b/pfosten/app/Http/Controllers/UsersController.php @@ -191,7 +191,6 @@ class UsersController extends Controller public function ranking($max_round_id, $seasonId=-1) { if (!Auth::user()) { return redirect("/"); } - $startTime = microtime(true); $season = Season::getCurrent(); @@ -220,7 +219,6 @@ class UsersController extends Controller $max_round_id=min($max_round_id, Round::getLastLockedRoundId()); - // Payment made ? if (! User::payment_date(Auth::user()->id, $season->id) && Auth::user()->name!="Torsten Schneider") { return view('users.no_payment'); diff --git a/pfosten/app/Tipp.php b/pfosten/app/Tipp.php index 1fcc3650..c4a54417 100755 --- a/pfosten/app/Tipp.php +++ b/pfosten/app/Tipp.php @@ -258,7 +258,7 @@ class Tipp extends Model $currentSeason = Season::getCurrent(); if ($seasonId!=-1) { $currentSeason=Season::where('id','=',$seasonId)->first(); }; - error_log("SeasonId=".$currentSeason->id); + // Hier werden _alle_ Tipps der aktuellen Saison ausgerechnet, die $round_id Begrenzung wird erst später ausgewertet. // TODO: Nur die Runden durchrechnen, die aktuell sind, oder round_incomplete, alle anderen Runden (bis zur ersten unvollständigen) sollen in eine Cachetabelle gespeichert werden. diff --git a/pfosten/app/leagues/League.php b/pfosten/app/leagues/League.php index f8994e33..541eff8c 100644 --- a/pfosten/app/leagues/League.php +++ b/pfosten/app/leagues/League.php @@ -105,8 +105,6 @@ class League extends Model if ($seasonId > -1) { $season=Season::where('id','=',$seasonId)->first(); }; $leagues = League::where('rank','=',$rank)->where('season_id','=', $season->id)->orderBy('id')->get(); - error_log("LeagueCount:".sizeof($leagues)); - $leagueScores=array(); foreach($leagues as $league) { $memberIds = LeagueMember::getMembers($league->id); @@ -160,7 +158,7 @@ class League extends Model // Nur für Auf und Abstieg public static function getTotalRankingOverall($seasonId=-1) { $totalRanking=array(); - + $hasRank4 = false; foreach([1,2,3,4] as $rank) { foreach (League::getUnifiedRanking($rank, $seasonId) as $rankEntry) { @@ -171,10 +169,46 @@ class League extends Model $tpl[2] = $rankEntry[2]; $tpl[3] = $rankEntry[3]; $tpl[4] = $rank; + if ($rank==4) { $hasRank4=true;} array_push($totalRanking, $tpl); } } + usort($totalRanking, array('App\Leagues\League','cmpScore')); + + // kein Rank4 ==> Ligaspiel ==> Auf & Abstieg wird angewendet. + if (!$hasRank4) { + // Liga 1/2: Swap rank 17-22 <> 23-28 ==> index 16-21 to rank=2, index 22-27 to rank=1 + // Liga 2/3: Swap rank 39-44 <> 45-50 ==> index 38-43 to rank=3, index 44-49 to rank=2 + $totalRanking[16][4]=2; + $totalRanking[17][4]=2; + $totalRanking[18][4]=2; + $totalRanking[19][4]=2; + $totalRanking[20][4]=2; + $totalRanking[21][4]=2; + $totalRanking[22][4]=1; + $totalRanking[23][4]=1; + $totalRanking[24][4]=1; + $totalRanking[25][4]=1; + $totalRanking[26][4]=1; + $totalRanking[27][4]=1; + + $totalRanking[38][4]=3; + $totalRanking[39][4]=3; + $totalRanking[40][4]=3; + $totalRanking[41][4]=3; + $totalRanking[42][4]=3; + $totalRanking[43][4]=3; + $totalRanking[44][4]=2; + $totalRanking[45][4]=2; + $totalRanking[46][4]=2; + $totalRanking[47][4]=2; + $totalRanking[48][4]=2; + $totalRanking[49][4]=2; + + usort($totalRanking, array('App\Leagues\League','cmpScore')); + } + return $totalRanking; } @@ -299,17 +333,8 @@ class League extends Model } } - // TODO: LeagueMembers zu den Leagues hinzufügen, abhängig vom zuzuordnenden Platz - - $unifiedList = League::getTotalRankingOverall($previousSeason->id); + $unifiedList = League::getTotalRankingOverall($previousSeason->id); // WICHTIG !! getTotalRankingOverall implentiert Auf- und Abstieg !! $currentCount = 1; - //TODO: Auf- und Abstieg - - Log::info("-- CREATED LEAGUES --"); - foreach($createdLeagues as $createdLeague) { - Log::info("-> ".$createdLeague->id.") ".$createdLeague->name); - //TODO: Member erzeugen / zuordnen - } $nr=1; $leagueNr=1; diff --git a/pfosten/resources/views/layouts/nav.blade.php b/pfosten/resources/views/layouts/nav.blade.php index 6fa5f9a0..d119893b 100644 --- a/pfosten/resources/views/layouts/nav.blade.php +++ b/pfosten/resources/views/layouts/nav.blade.php @@ -24,8 +24,8 @@