Skip to content

Firefly III: a personal finances manager

Fixed sort commands [skip ci]

James Cole92d8dde90ded
diff --git a/app/Helpers/Collection/Bill.php b/app/Helpers/Collection/Bill.php
index 34b3205c6b..550f8f1aeb 100644
--- a/app/Helpers/Collection/Bill.php
+++ b/app/Helpers/Collection/Bill.php
@@ -40,7 +40,7 @@ class Bill
*/
public function getBills()
{
- $this->bills->sortBy(
+ $set = $this->bills->sortBy(
function (BillLine $bill) {
$active = intval($bill->getBill()->active) == 0 ? 1 : 0;
$name = $bill->getBill()->name;
@@ -50,7 +50,7 @@ class Bill
);
- return $this->bills;
+ return $set;
}
}
diff --git a/app/Helpers/Collection/Category.php b/app/Helpers/Collection/Category.php
index 84f426487a..76ed0f05de 100644
--- a/app/Helpers/Collection/Category.php
+++ b/app/Helpers/Collection/Category.php
@@ -54,14 +54,14 @@ class Category
*/
public function getCategories()
{
- $this->categories->sortByDesc(
+ $set = $this->categories->sortByDesc(
function (CategoryModel $category) {
return $category->spent;
}
);
- return $this->categories;
+ return $set;
}
/**
diff --git a/app/Helpers/Collection/Expense.php b/app/Helpers/Collection/Expense.php
index a66c1ef86d..68ac2baf05 100644
--- a/app/Helpers/Collection/Expense.php
+++ b/app/Helpers/Collection/Expense.php
@@ -66,13 +66,13 @@ class Expense
*/
public function getExpenses()
{
- $this->expenses->sortByDesc(
+ $set = $this->expenses->sortByDesc(
function (stdClass $object) {
return $object->amount;
}
);
- return $this->expenses;
+ return $set;
}
/**
diff --git a/app/Helpers/Collection/Income.php b/app/Helpers/Collection/Income.php
index c3caf9eba7..1d34e2bb57 100644
--- a/app/Helpers/Collection/Income.php
+++ b/app/Helpers/Collection/Income.php
@@ -67,13 +67,13 @@ class Income
*/
public function getIncomes()
{
- $this->incomes->sortByDesc(
+ $set = $this->incomes->sortByDesc(
function (stdClass $object) {
return $object->amount;
}
);
- return $this->incomes;
+ return $set;
}
/**
diff --git a/app/Repositories/Account/AccountRepository.php b/app/Repositories/Account/AccountRepository.php
index dd413a236e..a174005ffd 100644
--- a/app/Repositories/Account/AccountRepository.php
+++ b/app/Repositories/Account/AccountRepository.php
@@ -68,7 +68,7 @@ class AccountRepository implements AccountRepositoryInterface
['accountmeta' => function (HasMany $query) {
$query->where('name', 'accountRole');
}]
- )->accountTypeIn($types)->orderBy('accounts.name', 'ASC')->get(['accounts.*'])->sortBy('name');
+ )->accountTypeIn($types)->orderBy('accounts.name', 'ASC')->get(['accounts.*']);
return $result;
}
diff --git a/app/Repositories/Bill/BillRepository.php b/app/Repositories/Bill/BillRepository.php
index 3d27a90d3c..ec6984ccc6 100644
--- a/app/Repositories/Bill/BillRepository.php
+++ b/app/Repositories/Bill/BillRepository.php
@@ -91,7 +91,7 @@ class BillRepository implements BillRepositoryInterface
public function getBills()
{
/** @var Collection $set */
- $set = Auth::user()->bills()->orderBy('name', 'ASC')->get()->sortBy('name');
+ $set = Auth::user()->bills()->orderBy('name', 'ASC')->get();
return $set;
}
diff --git a/app/Repositories/Budget/BudgetRepository.php b/app/Repositories/Budget/BudgetRepository.php
index a4a9bda75f..1b8dd99b93 100644
--- a/app/Repositories/Budget/BudgetRepository.php
+++ b/app/Repositories/Budget/BudgetRepository.php
@@ -63,7 +63,6 @@ class BudgetRepository extends ComponentRepository implements BudgetRepositoryIn
public function getActiveBudgets()
{
$budgets = Auth::user()->budgets()->where('active', 1)->get();
- $budgets->sortBy('name');
return $budgets;
}
diff --git a/app/Support/Search/Search.php b/app/Support/Search/Search.php
index a493ad0741..bb2f126bbb 100644
--- a/app/Support/Search/Search.php
+++ b/app/Support/Search/Search.php
@@ -127,8 +127,7 @@ class Search implements SearchInterface
}
);
$filtered = $set->merge($decrypted);
-
- $filtered->sortBy(
+ $filtered = $filtered->sortBy(
function (TransactionJournal $journal) {
return intval($journal->date->format('U'));
}