This commit is contained in:
James Cole 2019-08-02 05:49:20 +02:00
parent 3dbde59787
commit 59801b8bc1
No known key found for this signature in database
GPG Key ID: C16961E655E74B5E

View File

@ -95,6 +95,7 @@ class SummaryController extends Controller
$dates = $request->getAll();
$start = $dates['start'];
$end = $dates['end'];
$code = $request->get('currency_code');
// balance information:
$balanceData = $this->getBalanceInformation($start, $end);
@ -103,9 +104,15 @@ class SummaryController extends Controller
$networthData = $this->getNetWorthInfo($start, $end);
$total = array_merge($balanceData, $billData, $spentData, $networthData);
// TODO: liabilities with icon line-chart
// give new keys
$return = [];
foreach ($total as $entry) {
if (null === $code || (null !== $code && $code === $entry['currency_code'])) {
$return[$entry['key']] = $entry;
}
}
return response()->json($total);
return response()->json($return);
}