mirror of
https://github.com/YGGverse/HLState.git
synced 2025-02-11 06:24:33 +00:00
sort servers by players quantity by default
This commit is contained in:
parent
f61487cc9f
commit
80e362a131
@ -33,12 +33,7 @@ class MainController extends AbstractController
|
||||
// Collect servers info
|
||||
$servers = [];
|
||||
|
||||
foreach ((array) $entityManagerInterface->getRepository(Server::class)->findBy(
|
||||
[],
|
||||
[
|
||||
'online' => 'desc'
|
||||
]
|
||||
) as $server)
|
||||
foreach ((array) $entityManagerInterface->getRepository(Server::class)->findAll() as $server)
|
||||
{
|
||||
// Init defaults
|
||||
$status = false;
|
||||
@ -106,10 +101,21 @@ class MainController extends AbstractController
|
||||
'updated' => $server->getUpdated(),
|
||||
'online' => $server->getOnline(),
|
||||
'info' => $info,
|
||||
'status' => $status
|
||||
'status' => $status,
|
||||
'sort' => empty($info['Players']) ? 0 : (int) $info['Players']
|
||||
];
|
||||
}
|
||||
|
||||
// Sort by players
|
||||
array_multisort(
|
||||
array_column(
|
||||
$servers,
|
||||
'sort'
|
||||
),
|
||||
SORT_DESC,
|
||||
$servers
|
||||
);
|
||||
|
||||
return $this->render(
|
||||
'default/main/index.html.twig',
|
||||
[
|
||||
|
Loading…
x
Reference in New Issue
Block a user