mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-17 02:05:34 +00:00
Make note of some query heavy pages.
This commit is contained in:
@@ -152,13 +152,15 @@ class IndexController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
$collection = $this->repository->getActiveAccountsByType($types);
|
$collection = $this->repository->getActiveAccountsByType($types);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$total = $collection->count();
|
$total = $collection->count();
|
||||||
$page = 0 === (int) $request->get('page') ? 1 : (int) $request->get('page');
|
$page = 0 === (int) $request->get('page') ? 1 : (int) $request->get('page');
|
||||||
$pageSize = (int) app('preferences')->get('listPageSize', 50)->data;
|
$pageSize = (int) app('preferences')->get('listPageSize', 50)->data;
|
||||||
$accounts = $collection->slice(($page - 1) * $pageSize, $pageSize);
|
$accounts = $collection->slice(($page - 1) * $pageSize, $pageSize);
|
||||||
$inactiveCount = $this->repository->getInactiveAccountsByType($types)->count();
|
$inactiveCount = $this->repository->getInactiveAccountsByType($types)->count();
|
||||||
|
|
||||||
|
|
||||||
unset($collection);
|
unset($collection);
|
||||||
/** @var Carbon $start */
|
/** @var Carbon $start */
|
||||||
$start = clone session('start', Carbon::now()->startOfMonth());
|
$start = clone session('start', Carbon::now()->startOfMonth());
|
||||||
@@ -173,6 +175,7 @@ class IndexController extends Controller
|
|||||||
|
|
||||||
$accounts->each(
|
$accounts->each(
|
||||||
function (Account $account) use ($activities, $startBalances, $endBalances) {
|
function (Account $account) use ($activities, $startBalances, $endBalances) {
|
||||||
|
// TODO lots of queries executed in this block.
|
||||||
$account->lastActivityDate = $this->isInArray($activities, $account->id);
|
$account->lastActivityDate = $this->isInArray($activities, $account->id);
|
||||||
$account->startBalance = $this->isInArray($startBalances, $account->id);
|
$account->startBalance = $this->isInArray($startBalances, $account->id);
|
||||||
$account->endBalance = $this->isInArray($endBalances, $account->id);
|
$account->endBalance = $this->isInArray($endBalances, $account->id);
|
||||||
@@ -183,7 +186,6 @@ class IndexController extends Controller
|
|||||||
$account->location = $this->repository->getLocation($account);
|
$account->location = $this->repository->getLocation($account);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
// make paginator:
|
// make paginator:
|
||||||
$accounts = new LengthAwarePaginator($accounts, $total, $pageSize, $page);
|
$accounts = new LengthAwarePaginator($accounts, $total, $pageSize, $page);
|
||||||
$accounts->setPath(route('accounts.index', [$objectType]));
|
$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.
|
* 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
|
protected function formatAmountByAccount(): TwigFunction
|
||||||
{
|
{
|
||||||
|
@@ -225,6 +225,8 @@ class General extends AbstractExtension
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @return TwigFunction
|
* @return TwigFunction
|
||||||
|
* @deprecated because it uses a query in a view
|
||||||
|
* TODO remove me.
|
||||||
*/
|
*/
|
||||||
protected function getMetaField(): TwigFunction
|
protected function getMetaField(): TwigFunction
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user