Minor view and usability fixes, refactoring for Quota/Payout

This commit is contained in:
Torsten 2017-08-30 14:52:21 +02:00
parent 76947b1df9
commit b9e4fcca7f
12 changed files with 5736 additions and 139 deletions

5621
d0274241_2017-08-30_1251.sql Normal file

File diff suppressed because it is too large Load diff

View file

@ -240,7 +240,7 @@ class RoundmailController extends Controller
$r->send_date = Carbon\Carbon::now(); $r->send_date = Carbon\Carbon::now();
$r->recipients = implode(",", $emailsOfUsersWithIncompleteTipps); $r->recipients = implode(",", $emailsOfUsersWithIncompleteTipps);
$r->topic = "Fehlende Tipps/Joker"; $r->topic = "Fehlende Tipps/Joker";
$r->mail_message = "Es fehlen noch Tipps/Joker für: " . $firstTippableRound->name . "<br/>Die Runde sperrt sich: " . $roundLockTime . "<br/><br/>Link zum Spiel: " . Round::getTippSpielLink(); $r->mail_message = 'Es fehlen noch Tipps/Joker für: ' . $firstTippableRound->name . '<br/>Die Runde sperrt sich: ' . $roundLockTime . '<br/><br/>Link zum Spiel: <a href="' . Round::getTippSpielLink(). '">( Hier klicken )</a>';
Log::info("Sending Reminder Mails"); Log::info("Sending Reminder Mails");
\Mail::to($emailsOfUsersWithIncompleteTipps)->send($r); \Mail::to($emailsOfUsersWithIncompleteTipps)->send($r);

View file

@ -8,6 +8,7 @@ use App\Round;
use App\Game; use App\Game;
use App\User; use App\User;
use App\Tipp; use App\Tipp;
use App\Quota;
use DB; use DB;
use Auth; use Auth;
use Log; use Log;
@ -21,15 +22,15 @@ class RoundsController extends Controller
$activeSeason=Season::getCurrent(); $activeSeason=Season::getCurrent();
$rounds =null; $rounds =null;
//$rounds=Round::all();
if ($activeSeason) { if ($activeSeason) {
$activeSeasonId = Season::getCurrent()->id; $activeSeasonId = Season::getCurrent()->id;
$rounds = Round::all()->where('season_id', '=', $activeSeasonId); $rounds = Round::all()->where('season_id', '=', $activeSeasonId);
} }
return view('rounds.index', compact('rounds','activeSeason')); $quotas = Quota::getQuotas($activeSeason->id);
$round_count = $quotas['Runden'];
return view('rounds.index', compact('rounds','activeSeason', 'round_count'));
} }

View file

@ -14,83 +14,26 @@ class SeasonsController extends Controller
public function index() { public function index() {
if (Auth::guest()) { return redirect("/"); } if (Auth::guest()) { return redirect("/"); }
if (!Auth::user()->admin) { return redirect("/"); } if (!Auth::user()->admin) { return redirect("/"); }
$seasons = DB::table('seasons')->get(); $seasons = DB::table('seasons')->get();
$currentSeason=Season::getCurrent(); $currentSeason=Season::getCurrent();
$active_user_count = sizeof( DB::table('payments')->where('season_id',$currentSeason->id)->whereNotNull('paid_date')->get() ); $active_user_count = sizeof( DB::table('payments')->where('season_id',$currentSeason->id)->whereNotNull('paid_date')->get() );
$quotas = Quota::getQuotas($currentSeason->id); $quotas = Quota::getQuotas($currentSeason->id);
if (!$quotas) { Quota::createDefaultQuota($currentSeason->id);} if (!$quotas) {
Quota::createDefaultQuota($currentSeason->id);
$quotas = Quota::getQuotas($currentSeason->id);
}
$active_user_count = sizeof( DB::table('payments')->where('season_id',$currentSeason->id)->whereNotNull('paid_date')->get() ); $active_user_count = sizeof( DB::table('payments')->where('season_id',$currentSeason->id)->whereNotNull('paid_date')->get() );
$euro_pott = $active_user_count * $quotas["Einsatz"];
$euro_tagessieg_sum = intval ($euro_pott * ( $quotas["Tagessieg"] / 100 ) ); $quotas = Quota::getQuotas($currentSeason->id);
$euro_tagessieg = Quota::get6Divisor( intval($euro_tagessieg_sum / 36)); $payouts = Quota::getPayouts($currentSeason->id);
$euro_gruenes_trikot = intval($euro_pott * (($quotas["Gruenes Trikot"] / 100)));
$euro_gruenes_trikot = Quota::get6Divisor($euro_gruenes_trikot);
$euro_pokal= intval ($euro_pott * (($quotas["Pokal"] / 100)));
$euro_pokal= Quota::get6Divisor($euro_pokal);
$euro_platzierung = intval ( $euro_pott * (($quotas["Platzierung"] / 100)));
$tagessieg_rest = $euro_tagessieg_sum - ($euro_tagessieg * 36);
Log::info("Tagessieg Rest=".$tagessieg_rest." €");
$euro_platzierung += $tagessieg_rest;
$euro_platz1 = Quota::get6Divisor(intval( $euro_platzierung * (( $quotas["Platz 1"] / 100))));
$euro_platz2 = Quota::get6Divisor(intval( $euro_platzierung * (( $quotas["Platz 2"] / 100))));
$euro_platz3 = Quota::get6Divisor(intval( $euro_platzierung * (( $quotas["Platz 3"] / 100))));
$euro_platz4 = Quota::get6Divisor(intval( $euro_platzierung * (( $quotas["Platz 4"] / 100))));
$euro_platz5 = Quota::get6Divisor(intval( $euro_platzierung * (( $quotas["Platz 5"] / 100))));
$euro_platz6 = Quota::get6Divisor(intval( $euro_platzierung * (( $quotas["Platz 6"] / 100))));
$euro_platz7 = Quota::get6Divisor(intval( $euro_platzierung * (( $quotas["Platz 7"] / 100))));
$euro_platz8 = Quota::get6Divisor(intval( $euro_platzierung * (( $quotas["Platz 8"] / 100))));
$euro_platz9 = Quota::get6Divisor(intval( $euro_platzierung * (( $quotas["Platz 9"] / 100))));
$euro_platz10= Quota::get6Divisor(intval( $euro_platzierung * (( $quotas["Platz 10"] / 100))));
$euro_liga=intval($euro_pott *(($quotas["Liga-Wertung"] / 100)));
$euro_liga_platz1 = Quota::get6Divisor(intval($euro_liga*(($quotas["Liga Platz 1"] / 100))));
$euro_liga_platz2 = Quota::get6Divisor(intval($euro_liga*(($quotas["Liga Platz 2"] / 100))));
$euro_liga_platz3 = Quota::get6Divisor(intval($euro_liga*(($quotas["Liga Platz 3"] / 100))));
$finaler_rest = $euro_pott - ( 36*$euro_tagessieg + $euro_gruenes_trikot + $euro_pokal + $euro_platz1
+ $euro_platz2 + $euro_platz3+ $euro_platz4 + $euro_platz5 + $euro_platz6 + $euro_platz7 + $euro_platz8 + $euro_platz9 + $euro_platz10);
$euro_platz1 = $euro_platz1 + $finaler_rest;
Log::info("Users: ". $active_user_count);
Log::info("Einsatz: ". $quotas["Einsatz"]);
Log::info("Pott: ".$euro_pott." €");
Log::info("Tagessieg: ".$euro_tagessieg." €");
Log::info("Grünes Trikot: ".$euro_gruenes_trikot." €");
Log::info("Pokal: ".$euro_pokal." €");
Log::info("Liga: ".$euro_liga." €"); return view('seasons.index', compact('seasons','currentSeason','active_user_count','quotas','payouts'));
Log::info("Platzierung: ".$euro_platzierung." €");
Log::info("Platz 1: ".$euro_platz1." €");
Log::info("Platz 2: ".$euro_platz2." €");
Log::info("Platz 3: ".$euro_platz3." €");
Log::info("Platz 4: ".$euro_platz4." €");
Log::info("Platz 5: ".$euro_platz5." €");
Log::info("Platz 6: ".$euro_platz6." €");
Log::info("Platz 7: ".$euro_platz7." €");
Log::info("Platz 8: ".$euro_platz8." €");
Log::info("Platz 9: ".$euro_platz9." €");
Log::info("Platz 10: ".$euro_platz10." €");
Log::info("Finaler Rest: ".$finaler_rest." €");
return view('seasons.index', compact('seasons','currentSeason','quotas','active_user_count','euro_tagessieg','euro_platz1','euro_platz2','euro_platz3','euro_platz4','euro_platz5','euro_platz6','euro_platz7','euro_platz8','euro_platz9','euro_platz10'));
} }
public function create() { public function create() {
@ -133,6 +76,7 @@ class SeasonsController extends Controller
// Validate form // Validate form
$this->validate(request(), [ $this->validate(request(), [
'round_count' => 'required',
'season_id' => 'required', 'season_id' => 'required',
'einsatz' => 'required', 'einsatz' => 'required',
'tagessieg' => 'required', 'tagessieg' => 'required',
@ -158,6 +102,7 @@ class SeasonsController extends Controller
// Create and save the season // Create and save the season
Quota::setQuota('Runden',request('round_count'), $currentSeason->id);
Quota::setQuota('Einsatz',request('einsatz'), $currentSeason->id); Quota::setQuota('Einsatz',request('einsatz'), $currentSeason->id);
Quota::setQuota('Tagessieg',request('tagessieg'), $currentSeason->id); Quota::setQuota('Tagessieg',request('tagessieg'), $currentSeason->id);
Quota::setQuota('Gruenes Trikot',request('gruenes_trikot'), $currentSeason->id); Quota::setQuota('Gruenes Trikot',request('gruenes_trikot'), $currentSeason->id);

View file

@ -187,6 +187,7 @@ class UsersController extends Controller
$max_round_id = Round::getLastLockedRoundId(); $max_round_id = Round::getLastLockedRoundId();
if ($max_round_id==-1) { 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=".$currentSeason->id." and games.round_id=rounds.id;"; $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=".$currentSeason->id." and games.round_id=rounds.id;";
dd($sql);
$date = DB::select($sql); $date = DB::select($sql);
if (count($date)>0) { if (count($date)>0) {
@ -198,7 +199,13 @@ class UsersController extends Controller
} }
} }
// Payment made ?
if (! User::payment_date(Auth::user()->id, $currentSeason->id)) {
return view('users.no_payment');
}
// Hier werden _alle_ Tipps der aktuellen Saison ausgerechnet, die $round_id Begrenzung wird erst später ausgewertet. // 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.
$sql = "select users.id as user_id, users.name as user_name, "; $sql = "select users.id as user_id, users.name as user_name, ";
$sql = $sql . "rounds.id as round_id, rounds.name as round_name, "; $sql = $sql . "rounds.id as round_id, rounds.name as round_name, ";
$sql = $sql . "games.id as game_id, games.team1, games.team2, games.score1 as game_score1, games.score2 as game_score2, games.kickoff as game_kickoff, "; $sql = $sql . "games.id as game_id, games.team1, games.team2, games.score1 as game_score1, games.score2 as game_score2, games.kickoff as game_kickoff, ";
@ -208,6 +215,7 @@ class UsersController extends Controller
$sql = $sql . "and games.round_id=rounds.id and tipps.game_id=games.id and users.id = tipps.user_id "; $sql = $sql . "and games.round_id=rounds.id and tipps.game_id=games.id and users.id = tipps.user_id ";
$sql = $sql . "and payments.season_id=".$currentSeason->id." and payments.user_id = users.id "; $sql = $sql . "and payments.season_id=".$currentSeason->id." and payments.user_id = users.id ";
$sql = $sql . "and payments.paid_date is not null "; $sql = $sql . "and payments.paid_date is not null ";
$sql = $sql . "and users.deleted is null ";
$sql = $sql . "order by rounds.id, games.id, users.id;"; $sql = $sql . "order by rounds.id, games.id, users.id;";
$result=DB::select($sql); $result=DB::select($sql);
@ -260,14 +268,6 @@ class UsersController extends Controller
// NOW ALL KEYS FOR ROUNDTIPPS (ROUND & USER) EXIST // NOW ALL KEYS FOR ROUNDTIPPS (ROUND & USER) EXIST
// CALCULATION OF SCORES, RANKS, ETC. // CALCULATION OF SCORES, RANKS, ETC.
// FIRST LOOP: COMPUTE AGGREGATED VALUES // FIRST LOOP: COMPUTE AGGREGATED VALUES
@ -333,14 +333,21 @@ class UsersController extends Controller
// If more than 6 DayScoreWinners: Restrict by dayscore (rank) // If more than 6 DayScoreWinners: Restrict by dayscore (rank)
// Compute highest dayscore // Compute highest dayscore
// Addition: no dayscorewinner && round_completed: Payout goes to next round
$payouts = Quota::getPayouts($currentSeason->id);
$totalDayWinPayout = 0;
foreach ($round_ids as $round_id) { foreach ($round_ids as $round_id) {
$totalDayWinPayout += $payouts["tagessieg"];
$highestDayScore = $highestDayscores[$round_id]; $highestDayScore = $highestDayscores[$round_id];
$usersWithHighestDayScore = array(); $usersWithHighestDayScore = array();
$round_completed=false;
foreach ($user_ids as $user_id) { foreach ($user_ids as $user_id) {
$round_completed = $roundtipps[$key]['round_completed']; // TODO: Separaten info array roundData erzeugen, der Rundenspezifische, SPielerübergreifende Infos enthält, so wie round_completed.
$key = $round_id . "_" . $user_id; $key = $round_id . "_" . $user_id;
if ($roundtipps[$key]['dayscore'] == $highestDayScore && $roundtipps[$key]['round_completed']) { if ($roundtipps[$key]['dayscore'] == $highestDayScore && $roundtipps[$key]['round_completed'] && $highestDayScore>0 ) {
array_push($usersWithHighestDayScore, [$user_id, $roundtipps[$key]['dayScoreWithRankScore']]); array_push($usersWithHighestDayScore, [$user_id, $roundtipps[$key]['dayScoreWithRankScore']]);
} }
} }
@ -365,31 +372,36 @@ class UsersController extends Controller
} }
// Compute Dayscorewin payout (Tagessieg) // Compute Dayscorewin payout (Tagessieg)
$payouts = Quota::getPayouts($currentSeason->id);
$single_payout = 0;
$winnerCount = sizeof($dayScoreWinnersIds); $winnerCount = sizeof($dayScoreWinnersIds);
$single_payout=0;
if ($winnerCount > 0) { if ($winnerCount > 0) {
$single_payout = $payouts["Tagessieg"] / $winnerCount; $single_payout = $totalDayWinPayout / $winnerCount;
$single_payout = number_format((float)$single_payout, 2, '.', ''); $single_payout = number_format((float)$single_payout, 2, '.', '');
$single_payout = str_replace(".", ",", $single_payout); $single_payout = str_replace(".", ",", $single_payout);
$totalDayWinPayout=0;
} }
foreach ($round_ids as $round_id) {
foreach ($user_ids as $user_id) { foreach ($user_ids as $user_id) {
$key = $round_id . "_" . $user_id; $key = $round_id . "_" . $user_id;
if ($roundtipps[$key]['is_dayscorewinner']) { if ($roundtipps[$key]['is_dayscorewinner']) {
$roundtipps[$key]['payout'] = $single_payout; $roundtipps[$key]['payout'] = $single_payout;
} else { } else {
$roundtipps[$key]['payout'] = ''; $roundtipps[$key]['payout'] = '';
} }
} }
}
} }
//////////////////// END OF ROUNDTIPPS CREATION /////////////////// //////////////////// END OF ROUNDTIPPS CREATION ///////////////////
///////////////////////////// DISPLAY AUFBAU ///////////////////////////// ///////////////////////////// DISPLAY AUFBAU /////////////////////////////
/// ///
@ -471,6 +483,7 @@ class UsersController extends Controller
$roundtipps[$key]["tipps"][6],$roundtipps[$key]["tipps"][7], $roundtipps[$key]["tipps"][6],$roundtipps[$key]["tipps"][7],
$roundtipps[$key]["joker"][3]); $roundtipps[$key]["joker"][3]);
} }
$userids = array_keys($rankingDisplay); $userids = array_keys($rankingDisplay);
@ -478,6 +491,7 @@ class UsersController extends Controller
$games=Game::where('round_id','=',$max_round_id)->get(); $games=Game::where('round_id','=',$max_round_id)->get();
$all_rounds=Round::where('season_id','=',$currentSeason->id)->get(); $all_rounds=Round::where('season_id','=',$currentSeason->id)->get();
// Sortieren nach Rankscore // Sortieren nach Rankscore
$entries = array(); $entries = array();
usort($rankingDisplay, array($this,"cmp")); usort($rankingDisplay, array($this,"cmp"));
@ -491,6 +505,7 @@ class UsersController extends Controller
// von Rankingdisplay abgespeichert sind. // von Rankingdisplay abgespeichert sind.
$game_results=array(); // 4 Spielergebnisse der angezeigten Runde $game_results=array(); // 4 Spielergebnisse der angezeigten Runde
$a=$rankingDisplay[0];
array_push($game_results,$rankingDisplay[0]["result_score1"],$rankingDisplay[0]["result_score2"],$rankingDisplay[0]["result_score3"],$rankingDisplay[0]["result_score4"],$rankingDisplay[0]["result_score5"],$rankingDisplay[0]["result_score6"],$rankingDisplay[0]["result_score7"],$rankingDisplay[0]["result_score8"]); array_push($game_results,$rankingDisplay[0]["result_score1"],$rankingDisplay[0]["result_score2"],$rankingDisplay[0]["result_score3"],$rankingDisplay[0]["result_score4"],$rankingDisplay[0]["result_score5"],$rankingDisplay[0]["result_score6"],$rankingDisplay[0]["result_score7"],$rankingDisplay[0]["result_score8"]);
return view('users.ranking', compact('all_rounds','rankingDisplay','userids','round','games','game_results')); return view('users.ranking', compact('all_rounds','rankingDisplay','userids','round','games','game_results'));
@ -515,12 +530,10 @@ class UsersController extends Controller
$currentSeason = Season::getCurrent(); $currentSeason = Season::getCurrent();
$active_user_count = sizeof( DB::table('payments')->where('season_id',$currentSeason->id)->whereNotNull('paid_date')->get() ); $active_user_count = sizeof( DB::table('payments')->where('season_id',$currentSeason->id)->whereNotNull('paid_date')->get() );
$einsatz = Quota::getQuota($currentSeason->id,"Einsatz"); $quotas = Quota::getQuotas($currentSeason->id);
$payouts = Quota::getPayouts($currentSeason->id); $payouts = Quota::getPayouts($currentSeason->id);
Log::info("EINSATZ=".$einsatz); return view('users.show_payouts', compact('payouts','active_user_count','quotas','currentSeason'));
return view('users.show_payouts', compact('payouts','active_user_count','einsatz','currentSeason'));
} }
public function mailtest() { public function mailtest() {

View file

@ -22,7 +22,7 @@ class Quota extends Model
$euro_pott = $active_user_count * $quotas["Einsatz"]; $euro_pott = $active_user_count * $quotas["Einsatz"];
$euro_tagessieg_sum = intval ($euro_pott * ( $quotas["Tagessieg"] / 100 ) ); $euro_tagessieg_sum = intval ($euro_pott * ( $quotas["Tagessieg"] / 100 ) );
$euro_tagessieg = Quota::get6Divisor( intval($euro_tagessieg_sum / 36)); $euro_tagessieg = Quota::get6Divisor( intval($euro_tagessieg_sum / $quotas['Runden']));
$euro_gruenes_trikot = intval($euro_pott * (($quotas["Gruenes Trikot"] / 100))); $euro_gruenes_trikot = intval($euro_pott * (($quotas["Gruenes Trikot"] / 100)));
$euro_gruenes_trikot = Quota::get6Divisor($euro_gruenes_trikot); $euro_gruenes_trikot = Quota::get6Divisor($euro_gruenes_trikot);
@ -30,12 +30,13 @@ class Quota extends Model
$euro_pokal= Quota::get6Divisor($euro_pokal); $euro_pokal= Quota::get6Divisor($euro_pokal);
$euro_platzierung = intval ( $euro_pott * (($quotas["Platzierung"] / 100))); $euro_platzierung = intval ( $euro_pott * (($quotas["Platzierung"] / 100)));
$tagessieg_rest = $euro_tagessieg_sum - ($euro_tagessieg * 36); $tagessieg_rest = $euro_tagessieg_sum - ($euro_tagessieg * $quotas['Runden']);
Log::info("Tagessieg Rest=".$tagessieg_rest." €"); Log::info("Tagessieg Rest=".$tagessieg_rest." €");
$euro_platzierung += $tagessieg_rest; $euro_platzierung += $tagessieg_rest;
$euro_platz1 = Quota::get6Divisor(intval( $euro_platzierung * (( $quotas["Platz 1"] / 100)))); $euro_platz1 = Quota::get6Divisor(intval( $euro_platzierung * (( $quotas["Platz 1"] / 100))));
Log::info("Platz 1=".$euro_platz1);
$euro_platz2 = Quota::get6Divisor(intval( $euro_platzierung * (( $quotas["Platz 2"] / 100)))); $euro_platz2 = Quota::get6Divisor(intval( $euro_platzierung * (( $quotas["Platz 2"] / 100))));
$euro_platz3 = Quota::get6Divisor(intval( $euro_platzierung * (( $quotas["Platz 3"] / 100)))); $euro_platz3 = Quota::get6Divisor(intval( $euro_platzierung * (( $quotas["Platz 3"] / 100))));
$euro_platz4 = Quota::get6Divisor(intval( $euro_platzierung * (( $quotas["Platz 4"] / 100)))); $euro_platz4 = Quota::get6Divisor(intval( $euro_platzierung * (( $quotas["Platz 4"] / 100))));
@ -51,13 +52,16 @@ class Quota extends Model
$euro_liga_platz2 = Quota::get6Divisor(intval($euro_liga*(($quotas["Liga Platz 2"] / 100)))); $euro_liga_platz2 = Quota::get6Divisor(intval($euro_liga*(($quotas["Liga Platz 2"] / 100))));
$euro_liga_platz3 = Quota::get6Divisor(intval($euro_liga*(($quotas["Liga Platz 3"] / 100)))); $euro_liga_platz3 = Quota::get6Divisor(intval($euro_liga*(($quotas["Liga Platz 3"] / 100))));
$finaler_rest = $euro_pott - ( 36*$euro_tagessieg + $euro_gruenes_trikot + $euro_pokal + $euro_platz1 $finaler_rest = $euro_pott - ( $quotas['Runden']*$euro_tagessieg + $euro_gruenes_trikot + $euro_pokal + $euro_platz1
+ $euro_platz2 + $euro_platz3+ $euro_platz4 + $euro_platz5 + $euro_platz6 + $euro_platz7 + $euro_platz8 + $euro_platz9 + $euro_platz10); + $euro_platz2 + $euro_platz3+ $euro_platz4 + $euro_platz5
+ $euro_platz6 + $euro_platz7 + $euro_platz8 + $euro_platz9 + $euro_platz10
+ $euro_liga_platz1 + $euro_liga_platz2 + $euro_liga_platz3);
$euro_platz1 = $euro_platz1 + $finaler_rest; $euro_platz1 = $euro_platz1 + $finaler_rest;
Log::info("PLatz 1 mit Rest(".$finaler_rest.") = ".$euro_platz1);
$payouts=array(); $payouts=array();
$payouts['Tagessieg'] = $euro_tagessieg; $payouts['tagessieg'] = $euro_tagessieg;
$payouts['platz1'] = $euro_platz1; $payouts['platz1'] = $euro_platz1;
$payouts['platz2'] = $euro_platz2; $payouts['platz2'] = $euro_platz2;
$payouts['platz3'] = $euro_platz3; $payouts['platz3'] = $euro_platz3;
@ -118,8 +122,6 @@ class Quota extends Model
public static function createDefaultQuota($season_id) public static function createDefaultQuota($season_id)
{ {
Log::info('Creating default quotas'); Log::info('Creating default quotas');
DB::table('quotas')->where('season_id', '=', $season_id)->delete(); DB::table('quotas')->where('season_id', '=', $season_id)->delete();
@ -127,6 +129,13 @@ class Quota extends Model
Log::info("Creating new Quota"); Log::info("Creating new Quota");
$quota = new Quota;
$quota->season_id = $season_id;
$quota->name = "Runden";
$quota->prc = 36;
$quota->save();
$quota = new Quota; $quota = new Quota;
$quota->season_id = $season_id; $quota->season_id = $season_id;
$quota->name = "Einsatz"; $quota->name = "Einsatz";

View file

@ -14,7 +14,7 @@
@endif @endif
<a class="lead" href="/users/show_payouts">Quoten</a> &nbsp; &nbsp; &nbsp; <a class="lead" href="/users/show_payouts">Quoten</a> &nbsp; &nbsp; &nbsp;
<a class="lead" href="/tipps#{{\App\Round::getFirstTippableRound()->id}}">Tipps</a> &nbsp; &nbsp; &nbsp; <a class="lead" href="/tipps#{{\App\Round::getFirstTippableRound()->id}}">Tipps</a> &nbsp; &nbsp; &nbsp;
<a class="lead" href="/users/ranking/-1" >Rangliste</a> &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; <a class="lead" href="/users/ranking/roundid_-1#playerid_{{Auth::user()->id}}" >Rangliste</a> &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;
<label class="lead text ml-auto" >Spieler: <a href="/users/useredit/{{ Auth::user()->id }}">{{ Auth::user()->name }}</a></label><a class="lead" href="/logout">(abmelden)</a> <label class="lead text ml-auto" >Spieler: <a href="/users/useredit/{{ Auth::user()->id }}">{{ Auth::user()->name }}</a></label><a class="lead" href="/logout">(abmelden)</a>
@endif @endif

View file

@ -4,12 +4,12 @@
<section class="jumbotron text-center"> <section class="jumbotron text-center">
<div class="container"> <div class="container">
<label>Saison:{{ $activeSeason->name }}</label> <label>{{ $activeSeason->name }}</label>
<div class="lead" style="font-size: 42px;">Runden</div> @if (sizeof($rounds)<$round_count)
<div><a href="/rounds/create" class="btn btn-primary" >Runde hinzufügen</a></div> <div><a href="/rounds/create" class="btn btn-primary" >Runde hinzufügen</a></div>
<p>&nbsp;</p> <p>&nbsp;</p>
@endif
</div> </div>
<div class="container"> <div class="container">

View file

@ -22,11 +22,21 @@
@if ($currentSeason) @if ($currentSeason)
<div> <div>
<h3>Spiel-Einsatz</h3>
<form method="POST" action="/seasons/store_quota"> <form method="POST" action="/seasons/store_quota">
{{ csrf_field() }} {{ csrf_field() }}
<h3>Anzahl Runden</h3>
<div class="form-group" >
<h4>
<label style="float:left; width:200px;">Anzahl Runden:</label>
<input type="text" class="form-control" id="round_count" name="round_count" value="{{ $quotas['Runden'] }}" style="float:left; width:50px;"required>
</h4>
</div>
<p>&nbsp;</p>
<h3>Spiel-Einsatz</h3>
<div class="form-group" > <div class="form-group" >
<h4> <h4>
@ -45,7 +55,7 @@
<h4> <h4>
<label style="float:left; width:200px;">Tagessieg:</label> <label style="float:left; width:200px;">Tagessieg:</label>
<input type="text" class="form-control" id="tagessieg" name="tagessieg" value="{{ $quotas['Tagessieg'] }}" style="float:left; width:50px;"required> <input type="text" class="form-control" id="tagessieg" name="tagessieg" value="{{ $quotas['Tagessieg'] }}" style="float:left; width:50px;"required>
<label style="float:left;">&nbsp;% = {{$euro_tagessieg}} €</label> <label style="float:left;">&nbsp;% = {{$payouts['tagessieg']}} € </label>
<p>&nbsp;</p> <p>&nbsp;</p>
<label style="float:left; width:200px;">Platzierung:</label> <label style="float:left; width:200px;">Platzierung:</label>
@ -54,7 +64,12 @@
<label style="float:left; width:200px;">Grünes Trikot:</label> <label style="float:left; width:200px;">Grünes Trikot:</label>
<input type="text" class="form-control" id="gruenes_trikot" name="gruenes_trikot" value="{{ $quotas['Gruenes Trikot'] }}" style="float:left; width:50px;"required> <input type="text" class="form-control" id="gruenes_trikot" name="gruenes_trikot" value="{{ $quotas['Gruenes Trikot'] }}" style="float:left; width:50px;"required>
<label style="float:left;">&nbsp;%</label> <label style="float:left;">&nbsp;% = {{$payouts['gruenes_trikot']}} €</label>
<p>&nbsp;</p>
<label style="float:left; width:200px;">Pokal:</label>
<input type="text" class="form-control" id="pokal" name="pokal" value="{{ $quotas['Pokal'] }}" style="float:left; width:50px;"required>
<label style="float:left;">&nbsp;% = {{ $payouts['pokal'] }} €</label>
<p>&nbsp;</p> <p>&nbsp;</p>
<label style="float:left; width:200px;">Liga:</label> <label style="float:left; width:200px;">Liga:</label>
@ -62,10 +77,6 @@
<label style="float:left;">&nbsp;%</label> <label style="float:left;">&nbsp;%</label>
<p>&nbsp;</p> <p>&nbsp;</p>
<label style="float:left; width:200px;">Pokal:</label>
<input type="text" class="form-control" id="pokal" name="pokal" value="{{ $quotas['Pokal'] }}" style="float:left; width:50px;"required>
<label style="float:left;">&nbsp;%</label>
<p>&nbsp;</p>
</h4> </h4>
</div> </div>
<p>&nbsp;</p><p>&nbsp;</p> <p>&nbsp;</p><p>&nbsp;</p>
@ -78,53 +89,53 @@
<h4> <h4>
<label style="float:left; width:200px;">Platz 1:</label> <label style="float:left; width:200px;">Platz 1:</label>
<input type="text" class="form-control" id="platz1" name="platz1" value="{{ $quotas["Platz 1"] }}" style="float:left; width:50px;"required> <input type="text" class="form-control" id="platz1" name="platz1" value="{{ $quotas["Platz 1"] }}" style="float:left; width:50px;"required>
<label style="float:left;">&nbsp;% = {{$euro_platz1}} €</label> <label style="float:left;">&nbsp;% = {{$payouts['platz1']}} €</label>
<!-- <label>Test</label>--> <!-- <label>Test</label>-->
<p>&nbsp;</p> <p>&nbsp;</p>
<label style="float:left; width:200px;">Platz 2:</label> <label style="float:left; width:200px;">Platz 2:</label>
<input type="text" class="form-control" id="platz2" name="platz2" value="{{ $quotas["Platz 2"] }}" style="float:left; width:50px;"required> <input type="text" class="form-control" id="platz2" name="platz2" value="{{ $quotas["Platz 2"] }}" style="float:left; width:50px;"required>
<label style="float:left;">&nbsp;% = {{$euro_platz2}} €</label> <label style="float:left;">&nbsp;% = {{$payouts['platz2']}} €</label>
<p>&nbsp;</p> <p>&nbsp;</p>
<label style="float:left; width:200px;">Platz 3:</label> <label style="float:left; width:200px;">Platz 3:</label>
<input type="text" class="form-control" id="platz3" name="platz3" value="{{ $quotas["Platz 3"] }}" style="float:left; width:50px;"required> <input type="text" class="form-control" id="platz3" name="platz3" value="{{ $quotas["Platz 3"] }}" style="float:left; width:50px;"required>
<label style="float:left;">&nbsp;% = {{$euro_platz3}} €</label> <label style="float:left;">&nbsp;% = {{$payouts['platz3']}} €</label>
<p>&nbsp;</p> <p>&nbsp;</p>
<label style="float:left; width:200px;">Platz 4:</label> <label style="float:left; width:200px;">Platz 4:</label>
<input type="text" class="form-control" id="platz4" name="platz4" value="{{ $quotas["Platz 4"] }}" style="float:left; width:50px;"required> <input type="text" class="form-control" id="platz4" name="platz4" value="{{ $quotas["Platz 4"] }}" style="float:left; width:50px;"required>
<label style="float:left;">&nbsp;% = {{$euro_platz4}} €</label> <label style="float:left;">&nbsp;% = {{$payouts['platz4']}} €</label>
<p>&nbsp;</p> <p>&nbsp;</p>
<label style="float:left; width:200px;">Platz 5:</label> <label style="float:left; width:200px;">Platz 5:</label>
<input type="text" class="form-control" id="platz5" name="platz5" value="{{ $quotas["Platz 5"] }}" style="float:left; width:50px;"required> <input type="text" class="form-control" id="platz5" name="platz5" value="{{ $quotas["Platz 5"] }}" style="float:left; width:50px;"required>
<label style="float:left;">&nbsp;% = {{$euro_platz5}} €</label> <label style="float:left;">&nbsp;% = {{$payouts['platz5']}} €</label>
<p>&nbsp;</p> <p>&nbsp;</p>
<label style="float:left; width:200px;">Platz 6:</label> <label style="float:left; width:200px;">Platz 6:</label>
<input type="text" class="form-control" id="platz6" name="platz6" value="{{ $quotas["Platz 6"] }}" style="float:left; width:50px;"required> <input type="text" class="form-control" id="platz6" name="platz6" value="{{ $quotas["Platz 6"] }}" style="float:left; width:50px;"required>
<label style="float:left;">&nbsp;% = {{$euro_platz6}} €</label> <label style="float:left;">&nbsp;% = {{$payouts['platz6']}} €</label>
<p>&nbsp;</p> <p>&nbsp;</p>
<label style="float:left; width:200px;">Platz 7:</label> <label style="float:left; width:200px;">Platz 7:</label>
<input type="text" class="form-control" id="platz7" name="platz7" value="{{ $quotas["Platz 7"] }}" style="float:left; width:50px;"required> <input type="text" class="form-control" id="platz7" name="platz7" value="{{ $quotas["Platz 7"] }}" style="float:left; width:50px;"required>
<label style="float:left;">&nbsp;% = {{$euro_platz7}} €</label> <label style="float:left;">&nbsp;% = {{$payouts['platz7']}} €</label>
<p>&nbsp;</p> <p>&nbsp;</p>
<label style="float:left; width:200px;">Platz 8:</label> <label style="float:left; width:200px;">Platz 8:</label>
<input type="text" class="form-control" id="platz8" name="platz8" value="{{ $quotas["Platz 8"] }}" style="float:left; width:50px;"required> <input type="text" class="form-control" id="platz8" name="platz8" value="{{ $quotas["Platz 8"] }}" style="float:left; width:50px;"required>
<label style="float:left;">&nbsp;% = {{$euro_platz8}} €</label> <label style="float:left;">&nbsp;% = {{$payouts['platz8']}} €</label>
<p>&nbsp;</p> <p>&nbsp;</p>
<label style="float:left; width:200px;">Platz 9:</label> <label style="float:left; width:200px;">Platz 9:</label>
<input type="text" class="form-control" id="platz9" name="platz9" value="{{ $quotas["Platz 9"] }}" style="float:left; width:50px;"required> <input type="text" class="form-control" id="platz9" name="platz9" value="{{ $quotas["Platz 9"] }}" style="float:left; width:50px;"required>
<label style="float:left;">&nbsp;% = {{$euro_platz9}} €</label> <label style="float:left;">&nbsp;% = {{$payouts['platz9']}} €</label>
<p>&nbsp;</p> <p>&nbsp;</p>
<label style="float:left; width:200px;">Platz 10:</label> <label style="float:left; width:200px;">Platz 10:</label>
<input type="text" class="form-control" id="platz10" name="platz10" value="{{ $quotas["Platz 10"] }}" style="float:left; width:50px;"required> <input type="text" class="form-control" id="platz10" name="platz10" value="{{ $quotas["Platz 10"] }}" style="float:left; width:50px;"required>
<label style="float:left;">&nbsp;% = {{$euro_platz10}} €</label> <label style="float:left;">&nbsp;% = {{$payouts['platz10']}} €</label>
<p>&nbsp;</p> <p>&nbsp;</p>
</h4> </h4>
@ -134,17 +145,17 @@
<h4> <h4>
<label style="float:left; width:200px;">Platz 1:</label> <label style="float:left; width:200px;">Platz 1:</label>
<input type="text" class="form-control" id="liga_platz1" name="liga_platz1" value="{{ $quotas['Liga Platz 1'] }}" style="float:left; width:50px;"required> <input type="text" class="form-control" id="liga_platz1" name="liga_platz1" value="{{ $quotas['Liga Platz 1'] }}" style="float:left; width:50px;"required>
<label style="float:left">&nbsp;%</label> <label style="float:left">&nbsp;% = {{$payouts['liga_platz1']}} €</label>
<p>&nbsp;</p> <p>&nbsp;</p>
<label style="float:left; width:200px;">Platz 2:</label> <label style="float:left; width:200px;">Platz 2:</label>
<input type="text" class="form-control" id="liga_platz2" name="liga_platz2" value="{{ $quotas['Liga Platz 2'] }}" style="float:left; width:50px;"required> <input type="text" class="form-control" id="liga_platz2" name="liga_platz2" value="{{ $quotas['Liga Platz 2'] }}" style="float:left; width:50px;"required>
<label style="float:left;">&nbsp;%</label> <label style="float:left;">&nbsp;% = {{$payouts['liga_platz2']}} €</label>
<p>&nbsp;</p> <p>&nbsp;</p>
<label style="float:left; width:200px;">Platz 3:</label> <label style="float:left; width:200px;">Platz 3:</label>
<input type="text" class="form-control" id="liga_platz3" name="liga_platz3" value="{{ $quotas['Liga Platz 3'] }}" style="float:left; width:50px;"required> <input type="text" class="form-control" id="liga_platz3" name="liga_platz3" value="{{ $quotas['Liga Platz 3'] }}" style="float:left; width:50px;"required>
<label style="float:left;">&nbsp;%</label> <label style="float:left;">&nbsp;% = {{ $payouts['liga_platz3'] }} €</label>
<p>&nbsp;</p> <p>&nbsp;</p>
</h4> </h4>

View file

@ -10,7 +10,7 @@
@if ($r->id == $round->id) @if ($r->id == $round->id)
<label>{{$r->name}}</label> <label>{{$r->name}}</label>
@else @else
<a href="/users/ranking/{{$r->id}}">{{$r->name}}</a> <a href="/users/ranking/roundid_{{$r->id}}/playerid_{{Auth::user()->id}}">{{$r->name}}</a>
@endif @endif
</div> </div>
@endif @endif
@ -146,15 +146,12 @@
</div> </div>
</th> </th>
@foreach($rankingDisplay as $entry) @foreach($rankingDisplay as $entry)
<tr> <tr>
<td class="table-bordered" >&nbsp;<span class="text list-unstyled" href="#" >&nbsp;{{ $entry["rank"] }}&nbsp;</span></td> <td class="table-bordered" >&nbsp;<span class="text list-unstyled" href="#" >&nbsp;{{ $entry["rank"] }}&nbsp;</span></td>
<!-- <td class="table-bordered" align="center">&nbsp; $entry["dayScoreWithRankScore"] &nbsp;</td> --> <!-- <td class="table-bordered" align="center">&nbsp; $entry["dayScoreWithRankScore"] &nbsp;</td> -->
<td class="table-bordered"><div style="margin: 0 auto; width: 32px;"><img src="/img/crown.png" style="{{ ($entry["is_dayscorewinner"] ? 'float:left;width:32px;height:32px' : 'display: none;') }}"></div></td> <td class="table-bordered"><div style="margin: 0 auto; width: 32px;"><img src="/img/crown.png" style="{{ ($entry["is_dayscorewinner"] ? 'float:left;width:32px;height:32px' : 'display: none;') }}"></div></td>
<td class="table-bordered">&nbsp;<a class="text list-unstyled" href="#" style="vertical-align: middle;">{{ $entry["user_name"] }} &nbsp;</a></td> <td class="table-bordered">&nbsp;<a class="text list-unstyled {{ $entry['user_id']==Auth::user()->id ? 'blink_text' : '' }}" name="playerid_{{$entry['user_id']}}" href="#" style="vertical-align: middle;">{{ $entry["user_name"] }} &nbsp;</a></td>
<td class="table-bordered" align="center">&nbsp;{{ $entry["totalRankScore"] }}&nbsp;</td> <td class="table-bordered" align="center">&nbsp;{{ $entry["totalRankScore"] }}&nbsp;</td>
<td class="table-bordered" align="center">&nbsp;{{ $entry["rankscore"] }}&nbsp;</td> <td class="table-bordered" align="center">&nbsp;{{ $entry["rankscore"] }}&nbsp;</td>
<td class="table-bordered" align="center" style="border: 0px">&nbsp;&nbsp;&nbsp;</td> <!-- Spacer column --> <td class="table-bordered" align="center" style="border: 0px">&nbsp;&nbsp;&nbsp;</td> <!-- Spacer column -->
@ -173,7 +170,6 @@
<td class="table-bordered" align="center" style="border: 0px">&nbsp;&nbsp;&nbsp;</td> <!-- Spacer column --> <td class="table-bordered" align="center" style="border: 0px">&nbsp;&nbsp;&nbsp;</td> <!-- Spacer column -->
<td class="table-bordered" align="center" >&nbsp;{{ $entry["payout"] }}&nbsp;{{ $entry["payout"]>0 ? '€': '' }}</td> <td class="table-bordered" align="center" >&nbsp;{{ $entry["payout"] }}&nbsp;{{ $entry["payout"]>0 ? '€': '' }}</td>
</tr> </tr>
@endforeach @endforeach
<!-- Spielergebnis als letzte Zeile --> <!-- Spielergebnis als letzte Zeile -->

View file

@ -19,7 +19,7 @@
<div class="form-group" > <div class="form-group" >
<h4> <h4>
<label style="float:left; width:200px;">Einsatz pro Spieler:</label> <label style="float:left; width:200px;">Einsatz pro Spieler:</label>
<label style="float:left;">&nbsp;{{$einsatz}} €</label> <label style="float:left;">&nbsp;{{$quotas['Einsatz']}} €</label>
</h4> </h4>
</div> </div>
<p>&nbsp;</p><p>&nbsp;</p> <p>&nbsp;</p><p>&nbsp;</p>
@ -31,7 +31,7 @@
<div class="form-group" > <div class="form-group" >
<h4> <h4>
<label style="float:left; width:200px;">Tagessieg:</label> <label style="float:left; width:200px;">Tagessieg:</label>
<label style="float:left;">&nbsp;{{$payouts["Tagessieg"]}} €</label> <label style="float:left;">&nbsp;{{$payouts["tagessieg"]}} €</label>
<p>&nbsp;</p> <p>&nbsp;</p>
@if($payouts["gruenes_trikot"]>0) @if($payouts["gruenes_trikot"]>0)

View file

@ -43,10 +43,11 @@ Route::post('/games/store', 'GamesController@store');
Route::get('/users','UsersController@index'); Route::get('/users','UsersController@index');
Route::get('/users/edit/{user_id}','UsersController@edit'); Route::get('/users/edit/{user_id}','UsersController@edit');
Route::post('/users/store','UsersController@store'); Route::post('/users/store','UsersController@store');
Route::get('/users/ranking/{round_id}','UsersController@ranking'); Route::get('/users/ranking/roundid_{round_id}','UsersController@ranking');
Route::get('/users/show_payouts','UsersController@show_payouts'); Route::get('/users/show_payouts','UsersController@show_payouts');
Route::get('/users/useredit/{user_id}','UsersController@useredit'); Route::get('/users/useredit/{user_id}','UsersController@useredit');
Route::post('/users/store_useredit','UsersController@storeUserEdit'); Route::post('/users/store_useredit','UsersController@storeUserEdit');
Route::get('/users/no_payment');
Route::get('/tipps','TippsController@index'); Route::get('/tipps','TippsController@index');
Route::get('/tipps/edit/{tipp_id}','TippsController@edit'); Route::get('/tipps/edit/{tipp_id}','TippsController@edit');