Some new stuff for budget management. [skip ci]

This commit is contained in:
James Cole
2014-07-24 22:16:42 +02:00
parent 36901359d0
commit a40b281ea3
19 changed files with 317 additions and 156 deletions

View File

@@ -36,8 +36,7 @@ class ChartController extends BaseController
*/
public function homeAccount($accountId = null)
{
list($start, $end) = $this->_tk->getDateRange();
\Log::debug('Start is (cannot clone?): ' . $start);
list($start, $end) = $this->_tk->getDateRangeDates();
$current = clone $start;
$return = [];
$account = null;
@@ -75,10 +74,7 @@ class ChartController extends BaseController
}
} else {
$return[0] = ['name' => $account->name, 'id' => $account->id, 'data' => []];
\Log::debug('Start is: '.$start);
\Log::debug('End is: '.$end);
while ($current <= $end) {
\Log::debug('Current: ' . $current.' is smaller or equal to ' . $end);
if ($current > $today) {
$return[0]['data'][] = [$current->timestamp * 1000, $account->predict(clone $current)];
} else {
@@ -88,21 +84,6 @@ class ChartController extends BaseController
$current->addDay();
}
}
// // add an error bar as experiment:
// foreach($return as $index => $serie) {
// $err = [
// 'type' => 'errorbar',
// 'name' => $serie['name'].' pred',
// 'linkedTo' => $serie['id'],
// 'data' => []
// ];
// foreach($serie['data'] as $entry) {
// $err['data'][] = [$entry[0],10,300];
// }
// $return[] = $err;
// }
return Response::json($return);
}
@@ -140,7 +121,7 @@ class ChartController extends BaseController
public function homeCategories()
{
list($start, $end) =$this->_tk->getDateRange();
list($start, $end) =$this->_tk->getDateRangeDates();
$account = null;
$result = [];
// grab all transaction journals in this period: