mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-16 09:22:33 +00:00
Experimental sort routine for list of accounts [skip ci]
This commit is contained in:
@@ -75,9 +75,18 @@ 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();
|
||||||
$page = 0 === (int)$request->get('page') ? 1 : (int)$request->get('page');
|
|
||||||
$pageSize = (int)app('preferences')->get('listPageSize', 50)->data;
|
// sort collection:
|
||||||
$accounts = $collection->slice(($page - 1) * $pageSize, $pageSize);
|
$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);
|
||||||
unset($collection);
|
unset($collection);
|
||||||
/** @var Carbon $start */
|
/** @var Carbon $start */
|
||||||
$start = clone session('start', Carbon::now()->startOfMonth());
|
$start = clone session('start', Carbon::now()->startOfMonth());
|
||||||
|
Reference in New Issue
Block a user