mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-11 16:05:50 -06:00
Experimental sort routine for list of accounts [skip ci]
This commit is contained in:
parent
138a5bc3fe
commit
610af45dee
@ -75,6 +75,15 @@ class IndexController extends Controller
|
||||
$types = config('firefly.accountTypesByIdentifier.' . $what);
|
||||
$collection = $this->repository->getAccountsByType($types);
|
||||
$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');
|
||||
$pageSize = (int)app('preferences')->get('listPageSize', 50)->data;
|
||||
$accounts = $collection->slice(($page - 1) * $pageSize, $pageSize);
|
||||
|
Loading…
Reference in New Issue
Block a user