This commit is contained in:
Torsten 2017-07-18 14:58:32 +02:00
parent 164bb95eca
commit 30248ae4ef
6039 changed files with 3364 additions and 2287 deletions

64
pfosten/.env Normal file → Executable file
View file

@ -1,33 +1,33 @@
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=
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=

0
pfosten/.idea/blade.xml generated Normal file → Executable file
View file

0
pfosten/.idea/modules.xml generated Normal file → Executable file
View file

0
pfosten/.idea/pfosten.iml generated Normal file → Executable file
View file

0
pfosten/.idea/php.xml generated Normal file → Executable file
View file

0
pfosten/.idea/vcs.xml generated Normal file → Executable file
View file

1028
pfosten/.idea/workspace.xml generated Executable file

File diff suppressed because it is too large Load diff

19
pfosten/app/Game.php Normal file → Executable file
View file

@ -23,7 +23,21 @@ class Game extends Model
return ($tipp_input_end <= $now);
}
public function hasResult() {
$game = $this;
$hasIt = $game->score1 > -1;
if ($hasIt==false) {
return false;
}
return true;
}
public static function has_result($game_id) {
$game = Game::where('id',$game_id)->first();
$hasIt = $game->score1 > -1;
@ -35,12 +49,13 @@ class Game extends Model
return true;
}
public static function resultString($game_id) {
$game = Game::where('id',$game_id)->first();
$now=Carbon\Carbon::now();
if (!Game::has_result($game_id)) {
if ($game->kickoff>$now) return "Anstoss: " . $game->kickoff;
if (!$game->hasResult()) {
if ($game->kickoff > $now) return "Anstoss: " . $game->kickoff;
$start=Carbon\Carbon::parse($game->kickoff);
$end=$start->addHours(2);

5
pfosten/app/Http/Controllers/TippsController.php Normal file → Executable file
View file

@ -43,8 +43,6 @@ class TippsController extends Controller
}
}
}
}
public static function createAllTips(){
@ -83,6 +81,9 @@ class TippsController extends Controller
$rounds = Round::all()->where('season_id', '=', $activeSeasonId);
}
Log::info("REDIRECTING to TIPPS index");
return view('tipps.index', compact('rounds', 'activeSeason', 'user'));
}

54
pfosten/app/Http/Controllers/UsersController.php Normal file → Executable file
View file

@ -17,7 +17,6 @@ class UsersController extends Controller
{
public function main() {
return view('main');
}
@ -29,7 +28,6 @@ class UsersController extends Controller
return view('users.index', compact('users'));
}
public function showUsers() {
$users = DB::table('users')->get();
return view('users.list', compact('users'));
@ -37,14 +35,11 @@ class UsersController extends Controller
// Route-Model binding, because parameter in web.php route has same name as functionparameter
public function showUser(User $userObject) {
//return $userObject; // If you want it as a JSON object
//$user = DB::table('users')->find($id);
return view('users.show', compact('userObject'));
}
public function edit($user_id) {
if (Auth::guest()) { return redirect("/"); }
if (!Auth::user()->admin) { return redirect("/"); }
@ -111,8 +106,9 @@ class UsersController extends Controller
$highestDayScore=0;
// Tagessieg
foreach($users as $user) {
Log::info("User: ".$user->id.", ".$user->fullname);
//Log::info("User: ".$user->id.", ".$user->fullname);
$user->totalScore=0; // Summe Ranglisten-Punkte bis heute
$user->dayScore=0; // Heute gemachte Ranglisten-Punkte
@ -123,14 +119,18 @@ class UsersController extends Controller
$games=Game::where('round_id','=',$round->id)->get();
//Log::info('Nr of games found: '.count($games)." game->id=".$round->id." user->id=".$user->id );
foreach($games as $game) {
//Log::info("game->id=".$game->id.", $user->id=".$user->id);
if ($user->id==1) {Log::info("game-id=".$game->id.", user-id=".$user->id);}
$tipp = Tipp::where([['game_id','=',$game->id],['user_id','=',$user->id]])->first();
if ($tipp) {
$score = Tipp::getDayScoreLocal($game->score1,$game->score2,$tipp->score1,$tipp->score2,$tipp->joker);
//Log::info("Tipp=".$tipp->id." score=".$score);
if ($score > $user->dayWinScore) { $user->dayWinScore=$score; }
if ($score > $highestDayScore) { $highestDayScore=$score;}
if ($score > $user->dayWinScore) {
$user->dayWinScore = $score;
}
if ($score > $highestDayScore) { $highestDayScore = $score; }
} else {
Log::info("No tipp found for game_id=".$game->id.", user_id=".$user->id);
@ -138,18 +138,39 @@ class UsersController extends Controller
}
}
$rounds=Round::where([['season_id','=',$currentSeason->id],['id','<=',$round_id]])->orderBy('id')->get();
//Tendency Key=UserID_Runde
$tendencies=array('0_0'=>0);
// Punktrangliste
$rounds=Round::where([['season_id','=',$currentSeason->id],['id','<=',$round_id]])->orderBy('id')->get();
foreach($rounds as $round) {
$games=Game::where('round_id','=',$round->id)->orderBy('id')->get();
$index=0;
foreach($games as $game) {
foreach($users as $user) {
$key = $user->id."_".$round->id;
$user->tendencyCount=0;// 4 correct tendencies ==> +2 bonus score
$tipp = Tipp::where('game_id','=',$game->id)->where('user_id','=',$user->id)->first();
if ($tipp) {
// Ranglisten-Punkte berechen
$score = Tipp::getScoreLocal($game->score1,$game->score2,$tipp->score1,$tipp->score2,$tipp->joker);
if ($score>0) {
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;
if ($game->round_id == $round_id) {
@ -160,6 +181,15 @@ class UsersController extends Controller
$tippDisplay[$user->id][$game->id][1] = $tipp->score2 ==-1 ? 'x' : $tipp->score2;
$tippDisplay[$user->id][$game->id][2] = $tipp->joker;
}
// 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]);
$user->totalScore += 2;
$user->dayScore+=2;
}
}
}
$index+=1;
}

3
pfosten/app/Round.php Normal file → Executable file
View file

@ -4,6 +4,7 @@ namespace App;
use Illuminate\Database\Eloquent\Model;
use App\Game;
use Log;
class Round extends Model
{
@ -16,10 +17,10 @@ class Round extends Model
return $this->hasMany('App\Game');
}
// true, wenn irgend ein Game locked ist.
public static function hasLockedGame($round_id)
{
//Log::info("Check Round::HasLockedGame => ".$round_id);
$games = Game::where('round_id', $round_id)->get();
foreach ($games as $game) {
if (Game::locked($game->id)==true) {

2
pfosten/app/Tipp.php Normal file → Executable file
View file

@ -78,6 +78,8 @@ class Tipp extends Model
// Bei Tagessieg gilt nur wer am meisten genau richtig getippt hat,
// Bei Gleichstand wer den höchsten Jokersieg hat ( Jokersieg mit mehr Toren zählt mehr)
public static function getDayScoreLocal($goals1, $goals2, $tipp1, $tipp2, $joker) {
if ($tipp1==-1||$tipp2==-1||$goals1==-1||$goals2==-1) { return 0; } // Ungetippt oder Spiel hat noch kein Ergebnis
if ( ($tipp1 != $goals1) || ($tipp2 != $goals2) ) return 0;

0
pfosten/composer.json Normal file → Executable file
View file

0
pfosten/composer.lock generated Normal file → Executable file
View file

0
pfosten/composer.phar Normal file → Executable file
View file

4
pfosten/info.php Normal file → Executable file
View file

@ -1,3 +1,3 @@
<?php
phpinfo();
<?php
phpinfo();
?>

0
pfosten/public/css/bootstrap-datetimepicker.min.css vendored Normal file → Executable file
View file

0
pfosten/public/img/crown.png Normal file → Executable file
View file

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Before After
Before After

0
pfosten/public/js/bootstrap-datetimepicker.min.js vendored Normal file → Executable file
View file

0
pfosten/resources/views/rounds/index.blade.php Normal file → Executable file
View file

2
pfosten/resources/views/tipps/index.blade.php Normal file → Executable file
View file

@ -36,12 +36,12 @@
<td class="table-bordered" style="width:350px;">{{ $game->hasResult() ? $game->score1 . ' : ' . $game->score2 : ' Tippen ' }}</td>
<td class="table-bordered" style="width:75px;">
@if(App\Round::hasLockedGame($round->id)==true)
<span>{{ App\Tipp::resultString(App\Tipp::getTipp( $user->id,$game->id)->id) }} </span>
@else
<a href="/tipps/edit/{{App\Tipp::getTipp($user->id,$game->id)->id}}">{{ App\Tipp::getTipp($user->id,$game->id)->score1== -1 ? 'Tippen': App\Tipp::resultString(App\Tipp::getTipp($user->id,$game->id)->id) }} </a>
@endif
</td>
<td class="table-bordered"><img src="/img/joker.png" style="{{ (App\Tipp::getTipp($user->id,$game->id)->joker==true ? 'float:left;width:32px;height:32px' : 'display: none;') }}"></td>
<td class="table-bordered">{{App\Tipp::getScore(App\Tipp::getTipp($user->id,$game->id)->id)}}</td>

0
pfosten/resources/views/users/ranking.blade.php Normal file → Executable file
View file

0
pfosten/vendor/autoload.php vendored Normal file → Executable file
View file

0
pfosten/vendor/bin/php-parse vendored Normal file → Executable file
View file

8
pfosten/vendor/bin/php-parse.bat vendored Normal file → Executable file
View file

@ -1,4 +1,4 @@
@ECHO OFF
setlocal DISABLEDELAYEDEXPANSION
SET BIN_TARGET=%~dp0/../nikic/php-parser/bin/php-parse
php "%BIN_TARGET%" %*
@ECHO OFF
setlocal DISABLEDELAYEDEXPANSION
SET BIN_TARGET=%~dp0/../nikic/php-parser/bin/php-parse
php "%BIN_TARGET%" %*

0
pfosten/vendor/bin/phpunit vendored Normal file → Executable file
View file

8
pfosten/vendor/bin/phpunit.bat vendored Normal file → Executable file
View file

@ -1,4 +1,4 @@
@ECHO OFF
setlocal DISABLEDELAYEDEXPANSION
SET BIN_TARGET=%~dp0/../phpunit/phpunit/phpunit
php "%BIN_TARGET%" %*
@ECHO OFF
setlocal DISABLEDELAYEDEXPANSION
SET BIN_TARGET=%~dp0/../phpunit/phpunit/phpunit
php "%BIN_TARGET%" %*

0
pfosten/vendor/bin/psysh vendored Normal file → Executable file
View file

8
pfosten/vendor/bin/psysh.bat vendored Normal file → Executable file
View file

@ -1,4 +1,4 @@
@ECHO OFF
setlocal DISABLEDELAYEDEXPANSION
SET BIN_TARGET=%~dp0/../psy/psysh/bin/psysh
php "%BIN_TARGET%" %*
@ECHO OFF
setlocal DISABLEDELAYEDEXPANSION
SET BIN_TARGET=%~dp0/../psy/psysh/bin/psysh
php "%BIN_TARGET%" %*

0
pfosten/vendor/composer/ClassLoader.php vendored Normal file → Executable file
View file

0
pfosten/vendor/composer/LICENSE vendored Normal file → Executable file
View file

0
pfosten/vendor/composer/autoload_classmap.php vendored Normal file → Executable file
View file

0
pfosten/vendor/composer/autoload_files.php vendored Normal file → Executable file
View file

0
pfosten/vendor/composer/autoload_namespaces.php vendored Normal file → Executable file
View file

0
pfosten/vendor/composer/autoload_psr4.php vendored Normal file → Executable file
View file

0
pfosten/vendor/composer/autoload_real.php vendored Normal file → Executable file
View file

0
pfosten/vendor/composer/autoload_static.php vendored Normal file → Executable file
View file

0
pfosten/vendor/composer/installed.json vendored Normal file → Executable file
View file

0
pfosten/vendor/dnoegel/php-xdg-base-dir/.gitignore vendored Normal file → Executable file
View file

0
pfosten/vendor/dnoegel/php-xdg-base-dir/LICENSE vendored Normal file → Executable file
View file

0
pfosten/vendor/dnoegel/php-xdg-base-dir/README.md vendored Normal file → Executable file
View file

0
pfosten/vendor/dnoegel/php-xdg-base-dir/composer.json vendored Normal file → Executable file
View file

0
pfosten/vendor/dnoegel/php-xdg-base-dir/phpunit.xml.dist vendored Normal file → Executable file
View file

0
pfosten/vendor/dnoegel/php-xdg-base-dir/src/Xdg.php vendored Normal file → Executable file
View file

0
pfosten/vendor/dnoegel/php-xdg-base-dir/tests/XdgTest.php vendored Normal file → Executable file
View file

0
pfosten/vendor/doctrine/inflector/.gitignore vendored Normal file → Executable file
View file

0
pfosten/vendor/doctrine/inflector/.travis.yml vendored Normal file → Executable file
View file

0
pfosten/vendor/doctrine/inflector/LICENSE vendored Normal file → Executable file
View file

0
pfosten/vendor/doctrine/inflector/README.md vendored Normal file → Executable file
View file

0
pfosten/vendor/doctrine/inflector/composer.json vendored Normal file → Executable file
View file

View file

0
pfosten/vendor/doctrine/inflector/phpunit.xml.dist vendored Normal file → Executable file
View file

View file

0
pfosten/vendor/doctrine/inflector/tests/Doctrine/Tests/TestInit.php vendored Normal file → Executable file
View file

0
pfosten/vendor/doctrine/instantiator/.gitignore vendored Normal file → Executable file
View file

0
pfosten/vendor/doctrine/instantiator/.scrutinizer.yml vendored Normal file → Executable file
View file

0
pfosten/vendor/doctrine/instantiator/.travis.install.sh vendored Normal file → Executable file
View file

0
pfosten/vendor/doctrine/instantiator/.travis.yml vendored Normal file → Executable file
View file

0
pfosten/vendor/doctrine/instantiator/CONTRIBUTING.md vendored Normal file → Executable file
View file

0
pfosten/vendor/doctrine/instantiator/LICENSE vendored Normal file → Executable file
View file

0
pfosten/vendor/doctrine/instantiator/README.md vendored Normal file → Executable file
View file

0
pfosten/vendor/doctrine/instantiator/composer.json vendored Normal file → Executable file
View file

0
pfosten/vendor/doctrine/instantiator/phpmd.xml.dist vendored Normal file → Executable file
View file

0
pfosten/vendor/doctrine/instantiator/phpunit.xml.dist vendored Normal file → Executable file
View file

View file

0
pfosten/vendor/erusev/parsedown/.travis.yml vendored Normal file → Executable file
View file

0
pfosten/vendor/erusev/parsedown/LICENSE.txt vendored Normal file → Executable file
View file

0
pfosten/vendor/erusev/parsedown/Parsedown.php vendored Normal file → Executable file
View file

0
pfosten/vendor/erusev/parsedown/README.md vendored Normal file → Executable file
View file

0
pfosten/vendor/erusev/parsedown/composer.json vendored Normal file → Executable file
View file

0
pfosten/vendor/erusev/parsedown/phpunit.xml.dist vendored Normal file → Executable file
View file

0
pfosten/vendor/erusev/parsedown/test/CommonMarkTest.php vendored Normal file → Executable file
View file

0
pfosten/vendor/erusev/parsedown/test/ParsedownTest.php vendored Normal file → Executable file
View file

0
pfosten/vendor/erusev/parsedown/test/TestParsedown.php vendored Normal file → Executable file
View file

0
pfosten/vendor/erusev/parsedown/test/bootstrap.php vendored Normal file → Executable file
View file

0
pfosten/vendor/erusev/parsedown/test/data/aesthetic_table.html vendored Normal file → Executable file
View file

0
pfosten/vendor/erusev/parsedown/test/data/aesthetic_table.md vendored Normal file → Executable file
View file

0
pfosten/vendor/erusev/parsedown/test/data/aligned_table.html vendored Normal file → Executable file
View file

Some files were not shown because too many files have changed in this diff Show more