mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-14 00:04:24 +00:00
Take page size into account. [skip ci]
This commit is contained in:
@@ -123,28 +123,23 @@ class JournalRepository implements JournalRepositoryInterface
|
||||
|
||||
/**
|
||||
* @param array $types
|
||||
* @param int $offset
|
||||
* @param int $page
|
||||
*
|
||||
* @param int $pagesize
|
||||
* @param int $pageSize
|
||||
*
|
||||
* @return LengthAwarePaginator
|
||||
*/
|
||||
public function getJournalsOfTypes(array $types, int $offset, int $page, int $pagesize = 50): LengthAwarePaginator
|
||||
public function getJournalsOfTypes(array $types, int $page, int $pageSize = 50): LengthAwarePaginator
|
||||
{
|
||||
$set = $this->user
|
||||
$offset = ($page - 1) * $pageSize;
|
||||
$query = $this->user
|
||||
->transactionJournals()
|
||||
->expanded()
|
||||
->transactionTypes($types)
|
||||
->take($pagesize)
|
||||
->offset($offset)
|
||||
->orderBy('date', 'DESC')
|
||||
->orderBy('order', 'ASC')
|
||||
->orderBy('id', 'DESC')
|
||||
->get(TransactionJournal::QUERYFIELDS);
|
||||
->transactionTypes($types);
|
||||
|
||||
$count = $this->user->transactionJournals()->transactionTypes($types)->count();
|
||||
$journals = new LengthAwarePaginator($set, $count, $pagesize, $page);
|
||||
|
||||
$count = $query->count();
|
||||
$set = $query->take($pageSize)->offset($offset)->get(TransactionJournal::QUERYFIELDS);
|
||||
$journals = new LengthAwarePaginator($set, $count, $pageSize, $page);
|
||||
|
||||
return $journals;
|
||||
}
|
||||
|
@@ -57,12 +57,12 @@ interface JournalRepositoryInterface
|
||||
|
||||
/**
|
||||
* @param array $types
|
||||
* @param int $offset
|
||||
* @param int $page
|
||||
* @param int $pageSize
|
||||
*
|
||||
* @return LengthAwarePaginator
|
||||
*/
|
||||
public function getJournalsOfTypes(array $types, int $offset, int $page): LengthAwarePaginator;
|
||||
public function getJournalsOfTypes(array $types, int $page, int $pageSize = 50): LengthAwarePaginator;
|
||||
|
||||
/**
|
||||
* @param string $type
|
||||
|
Reference in New Issue
Block a user