mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-16 01:06:46 +00:00
Experimental sort routine for list of accounts [skip ci]
This commit is contained in:
@@ -75,6 +75,15 @@ class IndexController extends Controller
|
|||||||
$types = config('firefly.accountTypesByIdentifier.' . $what);
|
$types = config('firefly.accountTypesByIdentifier.' . $what);
|
||||||
$collection = $this->repository->getAccountsByType($types);
|
$collection = $this->repository->getAccountsByType($types);
|
||||||
$total = $collection->count();
|
$total = $collection->count();
|
||||||
|
|
||||||
|
// sort collection:
|
||||||
|
$collection = $collection->sortBy(
|
||||||
|
function (Account $account) {
|
||||||
|
return ($account->active ? '1' : '0') . $account->name;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
$page = 0 === (int)$request->get('page') ? 1 : (int)$request->get('page');
|
$page = 0 === (int)$request->get('page') ? 1 : (int)$request->get('page');
|
||||||
$pageSize = (int)app('preferences')->get('listPageSize', 50)->data;
|
$pageSize = (int)app('preferences')->get('listPageSize', 50)->data;
|
||||||
$accounts = $collection->slice(($page - 1) * $pageSize, $pageSize);
|
$accounts = $collection->slice(($page - 1) * $pageSize, $pageSize);
|
||||||
|
Reference in New Issue
Block a user