mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Fix category report.
This commit is contained in:
parent
2e1f31a7f8
commit
fbbbcc4e74
@ -124,10 +124,21 @@ class CategoryController extends Controller
|
||||
$report = [];
|
||||
/** @var Category $category */
|
||||
foreach ($categories as $category) {
|
||||
$spent = $repository->spentInPeriod(new Collection([$category]), $accounts, $start, $end);
|
||||
$report[$category->id] = ['name' => $category->name, 'spent' => $spent];
|
||||
$spent = $repository->spentInPeriod(new Collection([$category]), $accounts, $start, $end);
|
||||
if (bccomp($spent, '0') !== 0) {
|
||||
$report[$category->id] = ['name' => $category->name, 'spent' => $spent];
|
||||
}
|
||||
}
|
||||
|
||||
// sort the result
|
||||
// Obtain a list of columns
|
||||
$sum = [];
|
||||
foreach ($report as $categoryId => $row) {
|
||||
$sum[$categoryId] = floatval($row['spent']);
|
||||
}
|
||||
|
||||
array_multisort($sum, SORT_DESC, $report);
|
||||
|
||||
$result = view('reports.partials.categories', compact('report'))->render();
|
||||
$cache->store($result);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user