Working on LeagueMemberSwap Form

This commit is contained in:
Torsten 2022-06-03 11:58:26 +02:00
parent 2f26ee76d4
commit 3ec04c090d
4 changed files with 613 additions and 0 deletions

View file

@ -125,6 +125,8 @@ class LeaguesController extends Controller
return view ('leagues.matches', compact('season', 'matchesTotal','leagues','leagueNames','roundNames'));
}
public static function showLeagueRanking() {
$a=new TimeLogger("LeaguesController::showLeagueRanking()");
@ -166,6 +168,49 @@ class LeaguesController extends Controller
return view ('leagues.chart',compact('season', 'leagueNames', 'userNames','leagueScores','rankInfo','rank','cols'));
}
// Originall copied over from showLeagueRanking
public static function showLeagueSwapForm() {
$a=new TimeLogger("LeaguesController::showLeagueSwapForm()");
Log::info($a->getStartMessage());
$season = Season::getCurrent();
//$leagues = array_reverse(League::getRanking($rank));
$leagueNames = League::getNames();
$userNames = User::getNames();
$leagues = League::where('season_id','=',$season->id)->where('rank','<=', 4)->orderBy('id')->get();
if (!sizeof($leagues)) {
Log::info($a->getEndMessage());
return redirect("/");
}
$totalRanking = League::getTotalRankingOverall(); // Nur für Auf/Abstiegsinfo benötigt.
$rankInfo=array();
foreach($totalRanking as $index => $entry) {
$userId=$entry[0];
$rankInfo[$userId]=$totalRanking[$index][4];
}
$cols=array();
$cols[1]="greenyellow";
$cols[2]="orange";
$cols[3]="lightgrey";
$cols[4]="";
$leagueScores=array();
foreach([1,2,3,4] as $rank) {
$leagueScores[$rank] = League::getRanking($rank);
}
Log::info($a->getEndMessage());
//error_log($a->getEndMessage());
return view ('leagues.chart_swapform',compact('season', 'leagueNames', 'userNames','leagueScores','rankInfo','rank','cols'));
}
public static function showSingleUserMatches($userId) {
$season = Season::getCurrent();
$leagueNames = League::getNames();