mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-18 18:40:12 +00:00
Take page size into account.
This commit is contained in:
@@ -189,9 +189,10 @@ class AccountController extends Controller
|
|||||||
public function show(ARI $repository, Account $account)
|
public function show(ARI $repository, Account $account)
|
||||||
{
|
{
|
||||||
$page = intval(Input::get('page')) == 0 ? 1 : intval(Input::get('page'));
|
$page = intval(Input::get('page')) == 0 ? 1 : intval(Input::get('page'));
|
||||||
|
$pageSize = Preferences::get('transactionPageSize', 50)->data;
|
||||||
$subTitleIcon = Config::get('firefly.subTitlesByIdentifier.' . $account->accountType->type);
|
$subTitleIcon = Config::get('firefly.subTitlesByIdentifier.' . $account->accountType->type);
|
||||||
$what = Config::get('firefly.shortNamesByFullName.' . $account->accountType->type);
|
$what = Config::get('firefly.shortNamesByFullName.' . $account->accountType->type);
|
||||||
$journals = $repository->getJournals($account, $page);
|
$journals = $repository->getJournals($account, $page, $pageSize);
|
||||||
$subTitle = trans('firefly.details_for_' . $what, ['name' => $account->name]);
|
$subTitle = trans('firefly.details_for_' . $what, ['name' => $account->name]);
|
||||||
$journals->setPath('accounts/show/' . $account->id);
|
$journals->setPath('accounts/show/' . $account->id);
|
||||||
|
|
||||||
|
@@ -282,12 +282,13 @@ class AccountRepository implements AccountRepositoryInterface
|
|||||||
/**
|
/**
|
||||||
* @param Account $account
|
* @param Account $account
|
||||||
* @param int $page
|
* @param int $page
|
||||||
|
* @param int $pageSize
|
||||||
*
|
*
|
||||||
* @return LengthAwarePaginator
|
* @return LengthAwarePaginator
|
||||||
*/
|
*/
|
||||||
public function getJournals(Account $account, int $page): LengthAwarePaginator
|
public function getJournals(Account $account, int $page, int $pageSize = 50): LengthAwarePaginator
|
||||||
{
|
{
|
||||||
$offset = ($page - 1) * 50;
|
$offset = ($page - 1) * $pageSize;
|
||||||
$query = $this->user
|
$query = $this->user
|
||||||
->transactionJournals()
|
->transactionJournals()
|
||||||
->expanded()
|
->expanded()
|
||||||
@@ -298,8 +299,8 @@ class AccountRepository implements AccountRepositoryInterface
|
|||||||
->orderBy('transaction_journals.id', 'DESC');
|
->orderBy('transaction_journals.id', 'DESC');
|
||||||
|
|
||||||
$count = $query->count();
|
$count = $query->count();
|
||||||
$set = $query->take(50)->offset($offset)->get(TransactionJournal::QUERYFIELDS);
|
$set = $query->take($pageSize)->offset($offset)->get(TransactionJournal::QUERYFIELDS);
|
||||||
$paginator = new LengthAwarePaginator($set, $count, 50, $page);
|
$paginator = new LengthAwarePaginator($set, $count, $pageSize, $page);
|
||||||
|
|
||||||
return $paginator;
|
return $paginator;
|
||||||
|
|
||||||
|
@@ -123,11 +123,11 @@ interface AccountRepositoryInterface
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Account $account
|
* @param Account $account
|
||||||
* @param $page
|
* @param int $page
|
||||||
*
|
* @param int $pageSize
|
||||||
* @return LengthAwarePaginator
|
* @return LengthAwarePaginator
|
||||||
*/
|
*/
|
||||||
public function getJournals(Account $account, int $page): LengthAwarePaginator;
|
public function getJournals(Account $account, int $page, int $pageSize = 50): LengthAwarePaginator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Account $account
|
* @param Account $account
|
||||||
|
Reference in New Issue
Block a user