Various code cleanup. [skip ci]

This commit is contained in:
James Cole
2018-01-17 09:32:18 +01:00
parent ccf1a6c182
commit 3ccb791674
6 changed files with 17 additions and 11 deletions

View File

@@ -129,12 +129,12 @@ class CategoryController extends Controller
$report = [];
/** @var Category $category */
foreach ($categories as $category) {
$spent = $repository->spentInPeriod(new Collection([$category]), $accounts, $start, $end);
if (0 !== bccomp($spent, '0')) {
$report[$category->id] = ['name' => $category->name, 'spent' => $spent, 'id' => $category->id];
$spent = $repository->spentInPeriod(new Collection([$category]), $accounts, $start, $end);
$earned = $repository->earnedInPeriod(new Collection([$category]), $accounts, $start, $end);
if (0 !== bccomp($spent, '0') || 0 !== bccomp($earned, '0')) {
$report[$category->id] = ['name' => $category->name, 'spent' => $spent, 'earned' => $earned, 'id' => $category->id];
}
}
// sort the result
// Obtain a list of columns
$sum = [];