League creation, Auf & Abstieg - preparation
This commit is contained in:
parent
444ce18f63
commit
8edec26147
2 changed files with 21 additions and 4 deletions
|
|
@ -121,6 +121,8 @@ class LeaguesController extends Controller
|
|||
} else {
|
||||
// ToDo: Achtel-, Viertel-, Halb-, Finale require additional leagues; Same with Pokal, so createMissingLeagues method will be needed in the future
|
||||
|
||||
|
||||
## !! ##
|
||||
$league_size1= min(22,$active_member_count);
|
||||
$league1 = League::create([
|
||||
'is_qualification' => false,
|
||||
|
|
|
|||
|
|
@ -92,11 +92,11 @@ class League extends Model
|
|||
foreach ($matches as $match) {
|
||||
if (Round::isCompleted($match->round_id)) {
|
||||
$memberScores[$match->user1_id][1] += $match->user1_league_score;
|
||||
$memberScores[$match->user1_id][2] += $match->user1_rankscore;
|
||||
$memberScores[$match->user1_id][3] += $match->user2_rankscore;
|
||||
$memberScores[$match->user1_id][2] += $match->user1_rankscore; // goals
|
||||
$memberScores[$match->user1_id][3] += $match->user2_rankscore; // countergoals
|
||||
$memberScores[$match->user2_id][1] += $match->user2_league_score;
|
||||
$memberScores[$match->user2_id][2] += $match->user2_rankscore;
|
||||
$memberScores[$match->user2_id][3] += $match->user1_rankscore;
|
||||
$memberScores[$match->user2_id][2] += $match->user2_rankscore; // goals
|
||||
$memberScores[$match->user2_id][3] += $match->user1_rankscore; // countergoals
|
||||
}
|
||||
}
|
||||
usort($memberScores, array('App\Leagues\League','cmpScore'));
|
||||
|
|
@ -109,6 +109,21 @@ class League extends Model
|
|||
|
||||
|
||||
|
||||
// Für Auf/Abstiegsberechnung
|
||||
public static function getUnifiedRanking($rank, $seasonId=-1) {
|
||||
$leagueScores = League::getRanking($rank, $seasonId);
|
||||
$unifiedScores = array();
|
||||
foreach($leagueScores as $leagueId => $singleLeagueScores) {
|
||||
foreach ($singleLeagueScores as $placeNr => $singleLeagueScore) {
|
||||
$userId=$singleLeagueScores[$placeNr][0];
|
||||
$unifiedScores[$userId]=$singleLeagueScores[$placeNr];
|
||||
}
|
||||
}
|
||||
usort($unifiedScores,array('App\Leagues\League','cmpScore'));
|
||||
return $unifiedScores;
|
||||
}
|
||||
|
||||
|
||||
// Aktuelle Liga-Zuordnung auf Basis des Rangs in der letzten Liga
|
||||
public static function getNewLeagueForPlayers()
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue