mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-30 18:41:08 +00:00
Take page size into account.
This commit is contained in:
@@ -226,10 +226,11 @@ class CategoryController extends Controller
|
|||||||
|
|
||||||
$hideCategory = true; // used in list.
|
$hideCategory = true; // used in list.
|
||||||
$page = intval(Input::get('page'));
|
$page = intval(Input::get('page'));
|
||||||
|
$pageSize = Preferences::get('transactionPageSize', 50)->data;
|
||||||
|
|
||||||
$set = $repository->getJournalsInRange($category, $page, $start, $end);
|
$set = $repository->getJournalsInRange($category, $start, $end, $page, $pageSize);
|
||||||
$count = $repository->countJournalsInRange($category, $start, $end);
|
$count = $repository->countJournalsInRange($category, $start, $end);
|
||||||
$journals = new LengthAwarePaginator($set, $count, 50, $page);
|
$journals = new LengthAwarePaginator($set, $count, $pageSize, $page);
|
||||||
$journals->setPath('categories/show/' . $category->id . '/' . $date);
|
$journals->setPath('categories/show/' . $category->id . '/' . $date);
|
||||||
|
|
||||||
return view('categories.show_with_date', compact('category', 'journals', 'hideCategory', 'subTitle', 'carbon'));
|
return view('categories.show_with_date', compact('category', 'journals', 'hideCategory', 'subTitle', 'carbon'));
|
||||||
|
@@ -178,21 +178,23 @@ class SingleCategoryRepository extends ComponentRepository implements SingleCate
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Category $category
|
* @param Category $category
|
||||||
* @param int $page
|
|
||||||
* @param Carbon $start
|
* @param Carbon $start
|
||||||
* @param Carbon $end
|
* @param Carbon $end
|
||||||
|
* @param int $page
|
||||||
|
* @param int $pageSize
|
||||||
|
*
|
||||||
*
|
*
|
||||||
* @return Collection
|
* @return Collection
|
||||||
*/
|
*/
|
||||||
public function getJournalsInRange(Category $category, $page, Carbon $start, Carbon $end): Collection
|
public function getJournalsInRange(Category $category, Carbon $start, Carbon $end, int $page, int $pageSize = 50): Collection
|
||||||
{
|
{
|
||||||
$offset = $page > 0 ? $page * 50 : 0;
|
$offset = $page > 0 ? $page * $pageSize : 0;
|
||||||
|
|
||||||
return $category->transactionjournals()
|
return $category->transactionjournals()
|
||||||
->after($start)
|
->after($start)
|
||||||
->before($end)
|
->before($end)
|
||||||
->expanded()
|
->expanded()
|
||||||
->take(50)
|
->take($pageSize)
|
||||||
->offset($offset)
|
->offset($offset)
|
||||||
->get(TransactionJournal::QUERYFIELDS);
|
->get(TransactionJournal::QUERYFIELDS);
|
||||||
}
|
}
|
||||||
|
@@ -93,14 +93,15 @@ interface SingleCategoryRepositoryInterface
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Category $category
|
* @param Category $category
|
||||||
* @param int $page
|
|
||||||
*
|
|
||||||
* @param Carbon $start
|
* @param Carbon $start
|
||||||
* @param Carbon $end
|
* @param Carbon $end
|
||||||
|
* @param int $page
|
||||||
|
* @param int $pageSize
|
||||||
|
*
|
||||||
*
|
*
|
||||||
* @return Collection
|
* @return Collection
|
||||||
*/
|
*/
|
||||||
public function getJournalsInRange(Category $category, $page, Carbon $start, Carbon $end): Collection;
|
public function getJournalsInRange(Category $category, Carbon $start, Carbon $end, int $page, int $pageSize = 50): Collection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Category $category
|
* @param Category $category
|
||||||
|
Reference in New Issue
Block a user