Quotes Display & Daywin Calculation, Bugfix: 2 extra rankscore for all 4 tendencies in a round
This commit is contained in:
parent
954eca957b
commit
3fa31921f0
9 changed files with 522 additions and 31 deletions
|
|
@ -15,15 +15,82 @@ class SeasonsController extends Controller
|
|||
if (Auth::guest()) { return redirect("/"); }
|
||||
if (!Auth::user()->admin) { return redirect("/"); }
|
||||
|
||||
|
||||
|
||||
$seasons = DB::table('seasons')->get();
|
||||
$activeSeason=Season::getCurrent();
|
||||
$currentSeason=Season::getCurrent();
|
||||
|
||||
Log::info("Creating default quota");
|
||||
Quota::createDefaultQuota($activeSeason->id);
|
||||
$active_user_count = sizeof( DB::table('payments')->where('season_id',$currentSeason->id)->whereNotNull('paid_date')->get() );
|
||||
|
||||
return view('seasons.index', compact('seasons','activeSeason'));
|
||||
$quotas = Quota::getQuotas($currentSeason->id);
|
||||
|
||||
|
||||
|
||||
|
||||
$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 ) );
|
||||
$euro_tagessieg = Quota::get6Divisor( intval($euro_tagessieg_sum / 36));
|
||||
|
||||
$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." €");
|
||||
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() {
|
||||
|
|
@ -53,11 +120,67 @@ class SeasonsController extends Controller
|
|||
Log::info('Setting season id=' .$season->id);
|
||||
}
|
||||
|
||||
Quota::createDefaultQuota($season->id);
|
||||
|
||||
// Redirect to the home page
|
||||
return redirect('/seasons');
|
||||
}
|
||||
public function store_quota() {
|
||||
if (Auth::guest()) { return redirect("/"); }
|
||||
if (!Auth::user()->admin) { return redirect("/"); }
|
||||
|
||||
$currentSeason=Season::getCurrent();
|
||||
|
||||
// Validate form
|
||||
$this->validate(request(), [
|
||||
'season_id' => 'required',
|
||||
'einsatz' => 'required',
|
||||
'tagessieg' => 'required',
|
||||
'pokal' => 'required',
|
||||
'gruenes_trikot' => 'required',
|
||||
'platzierung' => 'required',
|
||||
'liga' => 'required',
|
||||
'liga_platz1' => 'required',
|
||||
'liga_platz2' => 'required',
|
||||
'liga_platz3' => 'required',
|
||||
'platz1' => 'required',
|
||||
'platz2' => 'required',
|
||||
'platz3' => 'required',
|
||||
'platz4' => 'required',
|
||||
'platz5' => 'required',
|
||||
'platz6' => 'required',
|
||||
'platz7' => 'required',
|
||||
'platz8' => 'required',
|
||||
'platz9' => 'required',
|
||||
'platz10' => 'required'
|
||||
]);
|
||||
|
||||
|
||||
// Create and save the season
|
||||
|
||||
Quota::setQuota('Einsatz',request('einsatz'), $currentSeason->id);
|
||||
Quota::setQuota('Tagessieg',request('tagessieg'), $currentSeason->id);
|
||||
Quota::setQuota('Gruenes Trikot',request('gruenes_trikot'), $currentSeason->id);
|
||||
Quota::setQuota('Pokal',request('pokal'), $currentSeason->id);
|
||||
Quota::setQuota('Platzierung',request('platzierung'), $currentSeason->id);
|
||||
Quota::setQuota('Platz 1',request('platz1'), $currentSeason->id);
|
||||
Quota::setQuota('Platz 2',request('platz2'), $currentSeason->id);
|
||||
Quota::setQuota('Platz 3',request('platz3'), $currentSeason->id);
|
||||
Quota::setQuota('Platz 4',request('platz4'), $currentSeason->id);
|
||||
Quota::setQuota('Platz 5',request('platz5'), $currentSeason->id);
|
||||
Quota::setQuota('Platz 6',request('platz6'), $currentSeason->id);
|
||||
Quota::setQuota('Platz 7',request('platz7'), $currentSeason->id);
|
||||
Quota::setQuota('Platz 8',request('platz8'), $currentSeason->id);
|
||||
Quota::setQuota('Platz 9',request('platz9'), $currentSeason->id);
|
||||
Quota::setQuota('Platz 10',request('platz10'), $currentSeason->id);
|
||||
Quota::setQuota('Liga-Wertung',request('liga'), $currentSeason->id);
|
||||
Quota::setQuota('Liga Platz 1',request('liga_platz1'), $currentSeason->id);
|
||||
Quota::setQuota('Liga Platz 2',request('liga_platz2'), $currentSeason->id);
|
||||
Quota::setQuota('Liga Platz 3',request('liga_platz3'), $currentSeason->id);
|
||||
|
||||
// Redirect to the home page
|
||||
return redirect('/seasons');
|
||||
}
|
||||
public function setcurrent($new_season_id) {
|
||||
if (Auth::guest()) { return redirect("/"); }
|
||||
if (!Auth::user()->admin) { return redirect("/"); }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue