mirror of
https://github.com/JeroenED/libpairtwo.git
synced 2024-11-24 07:21:01 +01:00
added getting a ranking of players
This commit is contained in:
parent
82370b25d7
commit
e367e8929b
@ -52,4 +52,25 @@ class Tournament extends TournamentModel
|
||||
$this->setRounds($newArray);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getRanking()
|
||||
{
|
||||
$players = $this->getPlayers();
|
||||
$rankingsArray = array();
|
||||
foreach ($players as $player) {
|
||||
$rankingsArray[$player->getPoints()] = $player;
|
||||
}
|
||||
$rankingsArray = ksort($finalArray);
|
||||
|
||||
$finalArray = array();
|
||||
$i = 0;
|
||||
foreach ($rankingsArray as $ranking) {
|
||||
$finalArray[$i] = $ranking;
|
||||
$i++;
|
||||
}
|
||||
|
||||
return $finalArray();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user