mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-22 12:11:19 +00:00
Remove various sort routines.
This commit is contained in:
@@ -94,7 +94,7 @@ class BillRepository implements BillRepositoryInterface
|
||||
*
|
||||
* @return Bill|null
|
||||
*/
|
||||
public function findBill( ?int $billId, ?string $billName): ?Bill
|
||||
public function findBill(?int $billId, ?string $billName): ?Bill
|
||||
{
|
||||
if (null !== $billId) {
|
||||
$searchResult = $this->find((int)$billId);
|
||||
@@ -146,8 +146,8 @@ class BillRepository implements BillRepositoryInterface
|
||||
/** @var Collection $set */
|
||||
$set = $this->user->bills()
|
||||
->where('active', 1)
|
||||
->get(['bills.*', DB::raw('((bills.amount_min + bills.amount_max) / 2) AS expectedAmount'),])
|
||||
->sortBy('name');
|
||||
->orderBy('bills.name', 'ASC')
|
||||
->get(['bills.*', DB::raw('((bills.amount_min + bills.amount_max) / 2) AS expectedAmount'),]);
|
||||
|
||||
return $set;
|
||||
}
|
||||
@@ -170,15 +170,7 @@ class BillRepository implements BillRepositoryInterface
|
||||
public function getBills(): Collection
|
||||
{
|
||||
/** @var Collection $set */
|
||||
$set = $this->user->bills()->orderBy('name', 'ASC')->get();
|
||||
|
||||
$set = $set->sortBy(
|
||||
function (Bill $bill) {
|
||||
$int = $bill->active ? 0 : 1;
|
||||
|
||||
return $int . strtolower($bill->name);
|
||||
}
|
||||
);
|
||||
$set = $this->user->bills()->orderBy('active', 'DESC')->orderBy('name', 'ASC')->get();
|
||||
|
||||
return $set;
|
||||
}
|
||||
@@ -210,17 +202,11 @@ class BillRepository implements BillRepositoryInterface
|
||||
)
|
||||
->whereIn('transactions.account_id', $ids)
|
||||
->whereNull('transaction_journals.deleted_at')
|
||||
->orderBy('bills.active', 'DESC')
|
||||
->orderBy('bills.name', 'ASC')
|
||||
->groupBy($fields)
|
||||
->get($fields);
|
||||
|
||||
$set = $set->sortBy(
|
||||
function (Bill $bill) {
|
||||
$int = $bill->active ? 0 : 1;
|
||||
|
||||
return $int . strtolower($bill->name);
|
||||
}
|
||||
);
|
||||
|
||||
return $set;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user