Expand and fix sort columns

This commit is contained in:
James Cole
2024-04-30 20:22:31 +02:00
parent 69d839997a
commit 4bd19e0627
2 changed files with 41 additions and 37 deletions

View File

@@ -73,7 +73,7 @@ class IndexController extends Controller
// 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.
$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) {
$accounts = $accounts->slice(($this->parameters->get('page') - 1) * $pageSize, $pageSize);
}

View File

@@ -87,6 +87,9 @@ class AccountTransformer extends AbstractTransformer
// get object groups
$this->getObjectGroups($objects);
// sort:
$objects = $this->sortAccounts($objects);
// if pagination is disabled, do it now:
if (true === $this->parameters->get('disablePagination')) {
$page = (int) $this->parameters->get('page');
@@ -94,7 +97,8 @@ class AccountTransformer extends AbstractTransformer
$objects = $objects->slice(($page - 1) * $size, $size);
}
return $this->sortAccounts($objects);
return $objects;
}
private function getDate(): Carbon