From 4673170531c7d63c0c9bbaf1fc9dcd298958525c Mon Sep 17 00:00:00 2001 From: James Cole Date: Sat, 27 Jun 2015 22:22:27 +0200 Subject: [PATCH] Restored some cache [skip ci] --- .../Chart/Budget/ChartJsBudgetChartGenerator.php | 6 +----- .../Chart/Category/ChartJsCategoryChartGenerator.php | 6 +----- app/Http/Controllers/Chart/AccountController.php | 4 ++-- app/Http/Controllers/Chart/BillController.php | 2 +- app/Http/Controllers/Chart/BudgetController.php | 8 ++++---- app/Http/Controllers/Chart/CategoryController.php | 6 +++--- app/Http/Controllers/Chart/PiggyBankController.php | 2 +- app/Http/Controllers/Chart/ReportController.php | 4 ++-- public/js/charts.js | 5 +++-- resources/twig/reports/year.twig | 2 +- 10 files changed, 19 insertions(+), 26 deletions(-) diff --git a/app/Generator/Chart/Budget/ChartJsBudgetChartGenerator.php b/app/Generator/Chart/Budget/ChartJsBudgetChartGenerator.php index 009c600d88..49f9fbf694 100644 --- a/app/Generator/Chart/Budget/ChartJsBudgetChartGenerator.php +++ b/app/Generator/Chart/Budget/ChartJsBudgetChartGenerator.php @@ -33,13 +33,9 @@ class ChartJsBudgetChartGenerator implements BudgetChartGenerator ], ]; - // language: - $language = Preferences::get('language', 'en')->data; - $format = Config::get('firefly.month.' . $language); - /** @var array $entry */ foreach ($entries as $entry) { - $data['labels'][] = $entry[0]->formatLocalized($format); + $data['labels'][] = trans('firefly.spent'); $data['datasets'][0]['data'][] = $entry[1]; } diff --git a/app/Generator/Chart/Category/ChartJsCategoryChartGenerator.php b/app/Generator/Chart/Category/ChartJsCategoryChartGenerator.php index 0dcf665b4c..2908967928 100644 --- a/app/Generator/Chart/Category/ChartJsCategoryChartGenerator.php +++ b/app/Generator/Chart/Category/ChartJsCategoryChartGenerator.php @@ -22,10 +22,6 @@ class ChartJsCategoryChartGenerator implements CategoryChartGenerator */ public function all(Collection $entries) { - // language: - $language = Preferences::get('language', 'en')->data; - $format = Config::get('firefly.month.' . $language); - $data = [ 'count' => 1, 'labels' => [], @@ -38,7 +34,7 @@ class ChartJsCategoryChartGenerator implements CategoryChartGenerator ]; foreach ($entries as $entry) { - $data['labels'][] = $entry[0]->formatLocalized($format); + $data['labels'][] = trans('firefly.spent'); $data['datasets'][0]['data'][] = round($entry[1], 2); } diff --git a/app/Http/Controllers/Chart/AccountController.php b/app/Http/Controllers/Chart/AccountController.php index be63ef012c..a49478d8b5 100644 --- a/app/Http/Controllers/Chart/AccountController.php +++ b/app/Http/Controllers/Chart/AccountController.php @@ -101,7 +101,7 @@ class AccountController extends Controller $cache->addProperty('frontpage'); $cache->addProperty('accounts'); if ($cache->has()) { - //return Response::json($cache->get()); // @codeCoverageIgnore + return Response::json($cache->get()); // @codeCoverageIgnore } $data = $this->generator->frontpage($accounts, $start, $end); @@ -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); diff --git a/app/Http/Controllers/Chart/BillController.php b/app/Http/Controllers/Chart/BillController.php index cd58cd8be2..9d6934277a 100644 --- a/app/Http/Controllers/Chart/BillController.php +++ b/app/Http/Controllers/Chart/BillController.php @@ -57,7 +57,7 @@ class BillController extends Controller $cache->addProperty('bills'); $cache->addProperty('frontpage'); if ($cache->has()) { - //return Response::json($cache->get()); // @codeCoverageIgnore + return Response::json($cache->get()); // @codeCoverageIgnore } $bills = $repository->getActiveBills(); diff --git a/app/Http/Controllers/Chart/BudgetController.php b/app/Http/Controllers/Chart/BudgetController.php index b63119a092..ffc9d82320 100644 --- a/app/Http/Controllers/Chart/BudgetController.php +++ b/app/Http/Controllers/Chart/BudgetController.php @@ -60,7 +60,7 @@ class BudgetController extends Controller $cache->addProperty($last); $cache->addProperty('budget'); if ($cache->has()) { - //return Response::json($cache->get()); // @codeCoverageIgnore + return Response::json($cache->get()); // @codeCoverageIgnore } $entries = new Collection; @@ -105,7 +105,7 @@ class BudgetController extends Controller $cache->addProperty($budget->id); $cache->addProperty($repetition->id); if ($cache->has()) { - //return Response::json($cache->get()); // @codeCoverageIgnore + return Response::json($cache->get()); // @codeCoverageIgnore } $entries = new Collection; @@ -149,7 +149,7 @@ class BudgetController extends Controller $cache->addProperty('budget'); $cache->addProperty('all'); if ($cache->has()) { - //return Response::json($cache->get()); // @codeCoverageIgnore + return Response::json($cache->get()); // @codeCoverageIgnore } bcscale(2); @@ -215,7 +215,7 @@ class BudgetController extends Controller $cache->addProperty('budget'); $cache->addProperty('year'); if ($cache->has()) { - //return Response::json($cache->get()); // @codeCoverageIgnore + return Response::json($cache->get()); // @codeCoverageIgnore } $entries = new Collection; diff --git a/app/Http/Controllers/Chart/CategoryController.php b/app/Http/Controllers/Chart/CategoryController.php index 57ca30bfd8..866ff6a4d0 100644 --- a/app/Http/Controllers/Chart/CategoryController.php +++ b/app/Http/Controllers/Chart/CategoryController.php @@ -62,7 +62,7 @@ class CategoryController extends Controller $cache->addProperty('all'); $cache->addProperty('categories'); if ($cache->has()) { - //return Response::json($cache->get()); // @codeCoverageIgnore + return Response::json($cache->get()); // @codeCoverageIgnore } while ($start <= $end) { @@ -101,7 +101,7 @@ class CategoryController extends Controller $cache->addProperty('category'); $cache->addProperty('frontpage'); if ($cache->has()) { - //return Response::json($cache->get()); // @codeCoverageIgnore + return Response::json($cache->get()); // @codeCoverageIgnore } $array = $repository->getCategoriesAndExpensesCorrected($start, $end); @@ -184,7 +184,7 @@ class CategoryController extends Controller $cache->addProperty('category'); $cache->addProperty('year'); if ($cache->has()) { - //return Response::json($cache->get()); // @codeCoverageIgnore + return Response::json($cache->get()); // @codeCoverageIgnore } $shared = $shared == 'shared' ? true : false; diff --git a/app/Http/Controllers/Chart/PiggyBankController.php b/app/Http/Controllers/Chart/PiggyBankController.php index 1d174420c8..22e2a0790e 100644 --- a/app/Http/Controllers/Chart/PiggyBankController.php +++ b/app/Http/Controllers/Chart/PiggyBankController.php @@ -47,7 +47,7 @@ class PiggyBankController extends Controller $cache->addProperty('piggy-history'); $cache->addProperty($piggyBank->id); if ($cache->has()) { - //return Response::json($cache->get()); // @codeCoverageIgnore + return Response::json($cache->get()); // @codeCoverageIgnore } /** @var Collection $set */ diff --git a/app/Http/Controllers/Chart/ReportController.php b/app/Http/Controllers/Chart/ReportController.php index 120126dc59..7e1b435e8d 100644 --- a/app/Http/Controllers/Chart/ReportController.php +++ b/app/Http/Controllers/Chart/ReportController.php @@ -55,7 +55,7 @@ class ReportController extends Controller $cache->addProperty($year); $cache->addProperty($shared); if ($cache->has()) { - //return Response::json($cache->get()); // @codeCoverageIgnore + return Response::json($cache->get()); // @codeCoverageIgnore } $entries = new Collection; @@ -95,7 +95,7 @@ class ReportController extends Controller $cache->addProperty($year); $cache->addProperty($shared); if ($cache->has()) { - //return Response::json($cache->get()); // @codeCoverageIgnore + return Response::json($cache->get()); // @codeCoverageIgnore } $start = new Carbon($year . '-01-01'); diff --git a/public/js/charts.js b/public/js/charts.js index 10dfe4faaa..555c0a3108 100644 --- a/public/js/charts.js +++ b/public/js/charts.js @@ -86,7 +86,7 @@ var defaultLineOptions = { responsive: true, scaleLabel: "<%= '" + currencySymbol + " ' + Number(value).toFixed(2).replace('.', ',') %>", tooltipFillColor: "rgba(0,0,0,0.5)", - multiTooltipTemplate: "<%=datasetLabel%>: <%= '" + currencySymbol + " ' + Number(value).toFixed(2).replace('.', ',') %>" + tooltipTemplate: "<%if (label){%><%=label%>: <%}%>" + currencySymbol + " <%= value %>", }; var defaultColumnOptions = { @@ -100,6 +100,7 @@ var defaultColumnOptions = { scaleLabel: "<%= '" + currencySymbol + " ' + Number(value).toFixed(2).replace('.', ',') %>", tooltipFillColor: "rgba(0,0,0,0.5)", tooltipTemplate: "<%if (label){%><%=label%>: <%}%>" + currencySymbol + " <%= value %>", + multiTooltipTemplate: "<%=datasetLabel%>: "+currencySymbol+" <%= Number(value).toFixed(2).replace('.', ',') %>" }; var defaultStackedColumnOptions = { @@ -112,7 +113,7 @@ var defaultStackedColumnOptions = { responsive: true, scaleLabel: "<%= '" + currencySymbol + " ' + Number(value).toFixed(2).replace('.', ',') %>", tooltipFillColor: "rgba(0,0,0,0.5)", - multiTooltipTemplate: currencySymbol + " <%= Number(value).toFixed(2).replace('.', ',') %>" + multiTooltipTemplate: "<%=datasetLabel%>: "+currencySymbol+" <%= Number(value).toFixed(2).replace('.', ',') %>" }; diff --git a/resources/twig/reports/year.twig b/resources/twig/reports/year.twig index 24c0c21d39..346c5a70d9 100644 --- a/resources/twig/reports/year.twig +++ b/resources/twig/reports/year.twig @@ -32,7 +32,7 @@
{% endif %} {% if Config.get('firefly.chart') == 'chartjs' %} - + {% endif %}