Original fix in place. #133

This commit is contained in:
James Cole 2015-12-24 09:50:28 +01:00
parent 8bab9e84e2
commit 8cdcba3231

View File

@ -289,13 +289,13 @@ class BudgetController extends Controller
return Response::json($cache->get()); // @codeCoverageIgnore
}
// filter empty budgets:
// foreach ($allBudgets as $budget) {
// $spent = $repository->balanceInPeriodForList($budget, $start, $end, $accounts);
// if ($spent != 0) {
// $budgets->push($budget);
// }
// }
// filter empty budgets:
foreach ($allBudgets as $budget) {
$spent = $repository->balanceInPeriodForList($budget, $start, $end, $accounts);
if ($spent != 0) {
$budgets->push($budget);
}
}
$entries = new Collection;
@ -306,7 +306,7 @@ class BudgetController extends Controller
$row = [clone $start];
// each budget, fill the row:
foreach ($allBudgets as $budget) {
foreach ($budgets as $budget) {
$spent = $repository->balanceInPeriodForList($budget, $start, $month, $accounts);
$row[] = $spent * -1;
}
@ -314,7 +314,7 @@ class BudgetController extends Controller
$start->endOfMonth()->addDay();
}
$data = $this->generator->year($allBudgets, $entries);
$data = $this->generator->year($budgets, $entries);
$cache->store($data);
return Response::json($data);