Include empty budgets. #133

This commit is contained in:
James Cole
2015-12-24 09:47:44 +01:00
parent 5a61a11a61
commit 2faae83912

View File

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