mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-23 14:26:58 +00:00
Expand and fix sort columns
This commit is contained in:
@@ -73,7 +73,7 @@ class IndexController extends Controller
|
|||||||
// depending on the sort parameters, this list must not be split, because the
|
// depending on the sort parameters, this list must not be split, because the
|
||||||
// order is calculated in the account transformer and by that time it's too late.
|
// order is calculated in the account transformer and by that time it's too late.
|
||||||
$first = array_key_first($sorting);
|
$first = array_key_first($sorting);
|
||||||
$disablePagination = in_array($first, ['last_activity', 'balance_difference'], true);
|
$disablePagination = in_array($first, ['last_activity','balance', 'balance_difference'], true);
|
||||||
if (!$disablePagination) {
|
if (!$disablePagination) {
|
||||||
$accounts = $accounts->slice(($this->parameters->get('page') - 1) * $pageSize, $pageSize);
|
$accounts = $accounts->slice(($this->parameters->get('page') - 1) * $pageSize, $pageSize);
|
||||||
}
|
}
|
||||||
|
@@ -87,14 +87,18 @@ class AccountTransformer extends AbstractTransformer
|
|||||||
// get object groups
|
// get object groups
|
||||||
$this->getObjectGroups($objects);
|
$this->getObjectGroups($objects);
|
||||||
|
|
||||||
|
// sort:
|
||||||
|
$objects = $this->sortAccounts($objects);
|
||||||
|
|
||||||
// if pagination is disabled, do it now:
|
// if pagination is disabled, do it now:
|
||||||
if(true === $this->parameters->get('disablePagination')) {
|
if (true === $this->parameters->get('disablePagination')) {
|
||||||
$page = (int) $this->parameters->get('page');
|
$page = (int) $this->parameters->get('page');
|
||||||
$size = (int) $this->parameters->get('pageSize');
|
$size = (int) $this->parameters->get('pageSize');
|
||||||
$objects = $objects->slice(($page-1) * $size, $size);
|
$objects = $objects->slice(($page - 1) * $size, $size);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->sortAccounts($objects);
|
return $objects;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getDate(): Carbon
|
private function getDate(): Carbon
|
||||||
@@ -218,7 +222,7 @@ class AccountTransformer extends AbstractTransformer
|
|||||||
'links' => [
|
'links' => [
|
||||||
[
|
[
|
||||||
'rel' => 'self',
|
'rel' => 'self',
|
||||||
'uri' => '/accounts/'.$account->id,
|
'uri' => '/accounts/' . $account->id,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
Reference in New Issue
Block a user