Ranking: Changing degree of headings
This commit is contained in:
parent
faf00dc0cb
commit
abf66ea3c9
5 changed files with 74 additions and 31 deletions
|
|
@ -67,6 +67,7 @@ class LeaguesController extends Controller
|
|||
|
||||
public function createLeagues($start_round_id, $round_count) {
|
||||
|
||||
|
||||
$users=User::getActives();
|
||||
if (sizeof($users)==0){
|
||||
return view("leagues.no_users");
|
||||
|
|
|
|||
|
|
@ -14,8 +14,9 @@ class Test extends Model
|
|||
$users = User::all();
|
||||
$cnt=0;
|
||||
foreach ($users as $user) {
|
||||
Payment::set_payment_date($user->id, $seasonId, '01.01.2017');
|
||||
$cnt+=1;
|
||||
if (!$user->deleted)
|
||||
{ Payment::set_payment_date($user->id, $seasonId, '01.01.2017'); $cnt+=1;}
|
||||
|
||||
}
|
||||
return $cnt." Users in season_id ".$seasonId." set to paid";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,9 +37,12 @@ class User extends Authenticatable
|
|||
|
||||
|
||||
// Only the current season.
|
||||
public static function is_season_paid($user_id) {
|
||||
public static function is_season_paid($user_id,$seasonId=-1) {
|
||||
$season=Season::getCurrent();
|
||||
if ($seasonId!=-1) { $season=Season::where('id','=',$seasonId)->first();}
|
||||
|
||||
$retval="Ja";
|
||||
if (User::payment_date($user_id, Season::getCurrent()->id)==null) { $retval="Nein"; }
|
||||
if (User::payment_date($user_id, $season->id)==null) { $retval="Nein"; }
|
||||
|
||||
return $retval;
|
||||
}
|
||||
|
|
@ -217,6 +220,13 @@ class User extends Authenticatable
|
|||
}
|
||||
|
||||
|
||||
public static function isDeleted($user_id) {
|
||||
$user=User::where('id','=',$user_id)->first();
|
||||
if (!$user) return true;
|
||||
if ($user->deleted) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function softDelete($user_id) {
|
||||
$user = User::where('id','=',$user_id)->first();
|
||||
if ($user) { $user->deleted = Carbon\Carbon::now();}
|
||||
|
|
@ -228,7 +238,7 @@ class User extends Authenticatable
|
|||
|
||||
|
||||
public static function getNames() {
|
||||
$users=User::getActives();
|
||||
$users=User::all();
|
||||
$usernames = array();
|
||||
foreach($users as $user) {
|
||||
$usernames[$user->id] = $user->name;
|
||||
|
|
|
|||
|
|
@ -179,8 +179,8 @@ class League extends Model
|
|||
|
||||
|
||||
// Für Auf/Abstiegsberechnung - wird auf previous Season angewendet.
|
||||
// Unified bezieht sich (nur) auf Gruppen-Übergreifende Listung (also alle Untergruppen)
|
||||
// Rank = -1 bedeutet über alle Rank (benötigt für Auf- und Abstieg über alle Ligen)
|
||||
// getUnifiedRanking bezieht sich (nur) auf Gruppen-Übergreifende Listung (also alle Untergruppen)
|
||||
// Rank = -1 bedeutet über alle Ranks (benötigt für Auf- und Abstieg über alle Ligen)
|
||||
public static function getUnifiedRanking($rank, $seasonId=-1) {
|
||||
$leagueScores = League::getRanking($rank, $seasonId);
|
||||
$unifiedScores = array();
|
||||
|
|
@ -214,7 +214,11 @@ class League extends Model
|
|||
$tpl[5] = $rankEntry[4]; // league_pos (for multiple leagues per rank, usually ranks 3 and 4)
|
||||
|
||||
if ($rank==4) { $hasRank4=true;}
|
||||
array_push($totalRanking, $tpl);
|
||||
|
||||
// only add to list if user has paid for season
|
||||
if (User::is_season_paid($tpl[0])=="Ja") {
|
||||
array_push($totalRanking, $tpl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -296,9 +300,13 @@ class League extends Model
|
|||
// TODO: 22 Mitspieler festgelegt sind.
|
||||
|
||||
public static function createLeagues($start_round_id, $round_count) {
|
||||
|
||||
Log::info("Leagues\League::createLeagues, start_round_id=".$start_round_id.", round_count=".$round_count);
|
||||
$currentSeason=Season::getCurrent();
|
||||
$previousSeason=Season::getPrevious();
|
||||
|
||||
$userNames = User::getNames();
|
||||
|
||||
// Eventuell vorhandene Ligen loeschen
|
||||
$leagues=League::where('season_id','=',$currentSeason->id)->get();
|
||||
if ($leagues) {
|
||||
|
|
@ -362,6 +370,7 @@ class League extends Model
|
|||
// - 2.) unified Liste bauen
|
||||
// - 3.) Wenn Vorsaison keine Quali war, dann Auf & Abstieg umsetzen ( unfified Liste als Basis )
|
||||
// - 4.) Member den Ligen zuordnen
|
||||
Log::info("League::createLeagues => Previous season detected. Creating Leagues 1, 2 and 3");
|
||||
|
||||
// Erzeugung der Ligen
|
||||
$createdLeagues=array();
|
||||
|
|
@ -410,16 +419,37 @@ class League extends Model
|
|||
}
|
||||
}
|
||||
|
||||
Log::info("Creating unified List from previous season");
|
||||
$unifiedList = League::getTotalRankingOverall($previousSeason->id); // WICHTIG !! getTotalRankingOverall implentiert Auf- und Abstieg !!
|
||||
|
||||
Log:info("Unified List:");
|
||||
$userNames = User::getNames();
|
||||
|
||||
$unifiedList2=array(); // We will only transfer users over to here that have paid the current season and are not deleted.
|
||||
$count=0;
|
||||
foreach($unifiedList as $listEntry) {
|
||||
$userId = $listEntry[0];
|
||||
if (User::is_season_paid($userId) && !User::isDeleted($userId)) {
|
||||
$count+=1;
|
||||
array_push($unifiedList2, $listEntry);
|
||||
Log::info($count.".) [".$userId."] ".$userNames[$userId]);
|
||||
} else {
|
||||
Log::info($count.".) [".$userId."] ".$userNames[$userId]." [DELETED]");
|
||||
}
|
||||
}
|
||||
$unifiedList = $unifiedList2;
|
||||
|
||||
|
||||
// Jetzt neue Spieler hinzufügen, die letzte Saison noch nicht dabei waren, und deshalb in getTotalRankingOverall nicht enthalten sind.
|
||||
|
||||
|
||||
Log::info("Adding new users not within previous season");
|
||||
foreach( League::getNewUsers() as $entry) {
|
||||
array_push($unifiedList, $entry);
|
||||
$userId=$entry[0];
|
||||
Log::info("( [".$userId."] ".$userNames[$userId]." )");
|
||||
}
|
||||
|
||||
|
||||
|
||||
$currentCount = 1;
|
||||
|
||||
$nr=1;
|
||||
|
|
@ -449,7 +479,8 @@ class League extends Model
|
|||
$leagueIndex+=1;
|
||||
}
|
||||
|
||||
Log::info("#".$leagueCount." Liga ".$leagueNr."-".$subLeague.")".$nr." ".$entry[0]);
|
||||
Log::info("#".$leagueCount." Liga ".$leagueNr."-".$subLeague.") ".$nr." ".$entry[0]." (".$userNames[$entry[0]].")");
|
||||
|
||||
$league=$createdLeagues[$leagueIndex];
|
||||
$leagueMember = LeagueMember::create([
|
||||
'user_id' => $entry[0],
|
||||
|
|
|
|||
|
|
@ -44,110 +44,110 @@
|
|||
|
||||
<table>
|
||||
<th style="height:140px;white-space: nowrap;">
|
||||
<div style="transform:translate(25px, 51px) rotate(315deg);width:30px;">
|
||||
<div style="transform:translate(10px, 51px) rotate(270deg);width:30px;">
|
||||
<span style="border-bottom: 1px solid #ccc; padding: 5px 10px;width:50px;">Rang</span>
|
||||
</div>
|
||||
</th>
|
||||
<!--
|
||||
<th style="height:140px;white-space: nowrap;">
|
||||
<div style="transform:translate(25px, 51px) rotate(315deg);width:30px;">
|
||||
<div style="transform:translate(10px, 51px) rotate(315deg);width:30px;">
|
||||
<span style="border-bottom: 1px solid #ccc; padding: 5px 10px;width:50px;">dayScoreWithRankScore</span>
|
||||
</div>
|
||||
</th>
|
||||
-->
|
||||
<th style="height:140px;white-space: nowrap;">
|
||||
<div style="transform:translate(25px, 51px) rotate(315deg);width:30px;">
|
||||
<div style="transform:translate(10px, 51px) rotate(270deg);width:30px;">
|
||||
<span style="border-bottom: 1px solid #ccc; padding: 5px 10px;width:50px;">Tagessieg</span>
|
||||
</div>
|
||||
</th>
|
||||
<th style="height:140px;white-space: nowrap;">
|
||||
<div style="transform:translate(25px, 51px) rotate(315deg);width:30px;">
|
||||
<div style="transform:translate(10px, 51px) rotate(270deg);width:30px;">
|
||||
<span style="border-bottom: 1px solid #ccc; padding: 5px 10px;width:150px;">Spieler</span>
|
||||
</div>
|
||||
</th>
|
||||
<th style="height:140px;white-space: nowrap;">
|
||||
<div style="transform:translate(25px, 51px) rotate(315deg);width:30px;">
|
||||
<div style="transform:translate(10px, 51px) rotate(270deg);width:30px;">
|
||||
<span style="border-bottom: 1px solid #ccc; padding: 5px 10px;">Punkte Gesamt</span>
|
||||
</div>
|
||||
</th>
|
||||
<th style="height:140px;white-space: nowrap;">
|
||||
<div style="transform:translate(25px, 51px) rotate(315deg);width:30px;">
|
||||
<div style="transform:translate(10px, 51px) rotate(270deg);width:30px;">
|
||||
<span style="border-bottom: 1px solid #ccc; padding: 5px 10px;">Punkte Tag</span>
|
||||
</div>
|
||||
</th>
|
||||
<th> </th><!-- Spacer Column -->
|
||||
<th style="height:140px;white-space: nowrap;">
|
||||
<div style="transform:translate(25px, 51px) rotate(315deg);width:30px;">
|
||||
<div style="transform:translate(10px, 51px) rotate(270deg);width:30px;">
|
||||
<span style="border-bottom: 1px solid #ccc; padding: 5px 10px;">{{$games[0]->team1}}</span>
|
||||
</div>
|
||||
</th>
|
||||
<th style="height:140px;white-space: nowrap;">
|
||||
<div style="transform:translate(25px, 51px) rotate(315deg);width:30px;">
|
||||
<div style="transform:translate(10px, 51px) rotate(270deg);width:30px;">
|
||||
<span style="border-bottom: 1px solid #ccc; padding: 5px 10px;">{{$games[0]->team2}}</span>
|
||||
</div>
|
||||
</th>
|
||||
<th style="height:140px;white-space: nowrap;">
|
||||
<div style="transform:translate(25px, 51px) rotate(315deg);width:30px;">
|
||||
<div style="transform:translate(10px, 51px) rotate(270deg);width:30px;">
|
||||
<span style="border-bottom: 1px solid #ccc; padding: 5px 10px;">Joker</span>
|
||||
</div>
|
||||
</th>
|
||||
|
||||
<th style="height:140px;white-space: nowrap;">
|
||||
<div style="transform:translate(25px, 51px) rotate(315deg);width:30px;">
|
||||
<div style="transform:translate(10px, 51px) rotate(270deg);width:30px;">
|
||||
<span style="border-bottom: 1px solid #ccc; padding: 5px 10px;">{{$games[1]->team1}}</span>
|
||||
</div>
|
||||
</th>
|
||||
<th style="height:140px;white-space: nowrap;">
|
||||
<div style="transform:translate(25px, 51px) rotate(315deg);width:30px;">
|
||||
<div style="transform:translate(10px, 51px) rotate(270deg);width:30px;">
|
||||
<span style="border-bottom: 1px solid #ccc; padding: 5px 10px;">{{$games[1]->team2}}</span>
|
||||
</div>
|
||||
</th>
|
||||
<th style="height:140px;white-space: nowrap;">
|
||||
<div style="transform:translate(25px, 51px) rotate(315deg);width:30px;">
|
||||
<div style="transform:translate(10px, 51px) rotate(270deg);width:30px;">
|
||||
<span style="border-bottom: 1px solid #ccc; padding: 5px 10px;">Joker</span>
|
||||
</div>
|
||||
</th>
|
||||
|
||||
<th style="height:140px;white-space: nowrap;">
|
||||
<div style="transform:translate(25px, 51px) rotate(315deg);width:30px;">
|
||||
<div style="transform:translate(10px, 51px) rotate(270deg);width:30px;">
|
||||
<span style="border-bottom: 1px solid #ccc; padding: 5px 10px;">{{$games[2]->team1}}</span>
|
||||
</div>
|
||||
</th>
|
||||
<th style="height:140px;white-space: nowrap;">
|
||||
<div style="transform:translate(25px, 51px) rotate(315deg);width:30px;">
|
||||
<div style="transform:translate(10px, 51px) rotate(270deg);width:30px;">
|
||||
<span style="border-bottom: 1px solid #ccc; padding: 5px 10px;">{{$games[2]->team2}}</span>
|
||||
</div>
|
||||
</th>
|
||||
<th style="height:140px;white-space: nowrap;">
|
||||
<div style="transform:translate(25px, 51px) rotate(315deg);width:30px;">
|
||||
<div style="transform:translate(10px, 51px) rotate(270deg);width:30px;">
|
||||
<span style="border-bottom: 1px solid #ccc; padding: 5px 10px;">Joker</span>
|
||||
</div>
|
||||
</th>
|
||||
|
||||
<th style="height:140px;white-space: nowrap;">
|
||||
<div style="transform:translate(25px, 51px) rotate(315deg);width:30px;">
|
||||
<div style="transform:translate(10px, 51px) rotate(270deg);width:30px;">
|
||||
<span style="border-bottom: 1px solid #ccc; padding: 5px 10px;">{{$games[3]->team1}}</span>
|
||||
</div>
|
||||
</th>
|
||||
<th style="height:140px;white-space: nowrap;">
|
||||
<div style="transform:translate(25px, 51px) rotate(315deg);width:30px;">
|
||||
<div style="transform:translate(10px, 51px) rotate(270deg);width:30px;">
|
||||
<span style="border-bottom: 1px solid #ccc; padding: 5px 10px;">{{$games[3]->team2}}</span>
|
||||
</div>
|
||||
</th>
|
||||
<th style="height:140px;white-space: nowrap;">
|
||||
<div style="transform:translate(25px, 51px) rotate(315deg);width:30px;">
|
||||
<div style="transform:translate(10px, 51px) rotate(270deg);width:30px;">
|
||||
<span style="border-bottom: 1px solid #ccc; padding: 5px 10px;">Joker</span>
|
||||
</div>
|
||||
</th>
|
||||
<th> </th><!-- Spacer Column -->
|
||||
<th style="height:140px;white-space: nowrap;">
|
||||
<div style="transform:translate(25px, 51px) rotate(315deg);width:30px;">
|
||||
<div style="transform:translate(10px, 51px) rotate(270deg);width:30px;">
|
||||
<span style="border-bottom: 1px solid #ccc; padding: 5px 10px;">Ausschüttung Tagessieg</span>
|
||||
</div>
|
||||
</th>
|
||||
@if($isFinalRound)
|
||||
<th style="height:140px;white-space: nowrap;">
|
||||
<div style="transform:translate(25px, 51px) rotate(315deg);width:30px;">
|
||||
<div style="transform:translate(10px, 51px) rotate(270deg);width:30px;">
|
||||
<span style="border-bottom: 1px solid #ccc; padding: 5px 10px;">Aussch.Platzierung</span>
|
||||
</div>
|
||||
</th>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue