Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
A new chart, single count.
James Cole48624d0a349e
diff --git a/app/Generator/Chart/Account/ChartJsAccountChartGenerator.php b/app/Generator/Chart/Account/ChartJsAccountChartGenerator.phpindex c496d2fb49..b3b22e11b5 100644--- a/app/Generator/Chart/Account/ChartJsAccountChartGenerator.php+++ b/app/Generator/Chart/Account/ChartJsAccountChartGenerator.php@@ -85,7 +85,30 @@ class ChartJsAccountChartGenerator implements AccountChartGenerator*/public function single(Account $account, Carbon $start, Carbon $end){- // TODO: Implement single() method.- //throw new NotImplementedException;+ // language:+ $language = Preferences::get('language', 'en')->data;+ $format = Config::get('firefly.monthAndDay.' . $language);++ $data = [+ 'count' => 1,+ 'labels' => [],+ 'datasets' => [+ [+ 'label' => $account->name,+ 'data' => []+ ]+ ],+ ];++ $current = clone $start;+ $today = new Carbon;++ while ($end >= $current) {+ $data['labels'][] = $current->formatLocalized($format);+ $data['datasets'][0]['data'][] = Steam::balance($account, $current);+ $current->addDay();+ }++ return $data;}}\ No newline at end of filediff --git a/app/Http/Controllers/Chart/AccountController.php b/app/Http/Controllers/Chart/AccountController.phpindex c8b7834bc5..be63ef012c 100644--- a/app/Http/Controllers/Chart/AccountController.php+++ b/app/Http/Controllers/Chart/AccountController.php@@ -133,7 +133,7 @@ class AccountController extends Controller$cache->addProperty('single');$cache->addProperty($account->id);if ($cache->has()) {- return Response::json($cache->get()); // @codeCoverageIgnore+ //return Response::json($cache->get()); // @codeCoverageIgnore}$data = $this->generator->single($account, $start, $end);