mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Make note of some query heavy pages.
This commit is contained in:
parent
384854b353
commit
386c067e93
@ -152,13 +152,15 @@ class IndexController extends Controller
|
||||
}
|
||||
|
||||
$collection = $this->repository->getActiveAccountsByType($types);
|
||||
|
||||
|
||||
|
||||
$total = $collection->count();
|
||||
$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);
|
||||
$inactiveCount = $this->repository->getInactiveAccountsByType($types)->count();
|
||||
|
||||
|
||||
unset($collection);
|
||||
/** @var Carbon $start */
|
||||
$start = clone session('start', Carbon::now()->startOfMonth());
|
||||
@ -173,6 +175,7 @@ class IndexController extends Controller
|
||||
|
||||
$accounts->each(
|
||||
function (Account $account) use ($activities, $startBalances, $endBalances) {
|
||||
// TODO lots of queries executed in this block.
|
||||
$account->lastActivityDate = $this->isInArray($activities, $account->id);
|
||||
$account->startBalance = $this->isInArray($startBalances, $account->id);
|
||||
$account->endBalance = $this->isInArray($endBalances, $account->id);
|
||||
@ -183,7 +186,6 @@ class IndexController extends Controller
|
||||
$account->location = $this->repository->getLocation($account);
|
||||
}
|
||||
);
|
||||
|
||||
// make paginator:
|
||||
$accounts = new LengthAwarePaginator($accounts, $total, $pageSize, $page);
|
||||
$accounts->setPath(route('accounts.index', [$objectType]));
|
||||
|
@ -76,7 +76,9 @@ class AmountFormat extends AbstractExtension
|
||||
/**
|
||||
* Will format the amount by the currency related to the given account.
|
||||
*
|
||||
* @return TwigFunction;
|
||||
* @return TwigFunction
|
||||
* @deprecated
|
||||
* TODO remove me because it executes a query in a view.
|
||||
*/
|
||||
protected function formatAmountByAccount(): TwigFunction
|
||||
{
|
||||
|
@ -225,6 +225,8 @@ class General extends AbstractExtension
|
||||
|
||||
/**
|
||||
* @return TwigFunction
|
||||
* @deprecated because it uses a query in a view
|
||||
* TODO remove me.
|
||||
*/
|
||||
protected function getMetaField(): TwigFunction
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user