Cleanup and prep-work for new charts (will be a new feature).

This commit is contained in:
Sander Dorigo
2014-10-28 09:25:29 +01:00
parent 4533b46436
commit a0afa25145
5 changed files with 46 additions and 114 deletions

View File

@@ -111,7 +111,8 @@ class AccountController extends BaseController
return Response::jsoN($return);
}
public function transactions(Account $account) {
public function transactions(Account $account)
{
/*
* TODO get the JSON helper to get transactions or something.
*/
@@ -123,7 +124,7 @@ class AccountController extends BaseController
*
* @return \Illuminate\View\View
*/
public function sankey($account)
public function sankeyOut($account)
{
/*
@@ -162,7 +163,7 @@ class AccountController extends BaseController
$from = $to;
$category = $entry->categories()->first();
if ($category) {
$to = $category->name . ' (cat)';
$to = ' ' . $category->name;
} else {
$to = '(no category)';
}
@@ -211,16 +212,18 @@ class AccountController extends BaseController
}
}
ksort($filtered);
/*
* Collect amounts to give the labels the proper
* Take out the keys:
*/
foreach ($filtered as $key => $entry) {
$result[] = [$entry['from'],$entry['to'],$entry['amount']];
}
/*
* Loop it again to add the amounts.
*/
return View::make('accounts.sankey', compact('filtered'));
return Response::json($result);
}