From d7f2b7cd630d8a366484cb30aa2d44d0346f530a Mon Sep 17 00:00:00 2001 From: James Cole Date: Mon, 11 Dec 2017 05:57:07 +0100 Subject: [PATCH] Remove unused overview #384 --- .../Controllers/Report/ExpenseController.php | 51 +------------------ public/js/ff/reports/account/month.js | 1 - resources/views/reports/account/report.twig | 15 ------ .../views/reports/partials/exp-grouped.twig | 37 -------------- routes/web.php | 3 +- 5 files changed, 2 insertions(+), 105 deletions(-) delete mode 100644 resources/views/reports/partials/exp-grouped.twig diff --git a/app/Http/Controllers/Report/ExpenseController.php b/app/Http/Controllers/Report/ExpenseController.php index 5d40104f28..ccaad3cd78 100644 --- a/app/Http/Controllers/Report/ExpenseController.php +++ b/app/Http/Controllers/Report/ExpenseController.php @@ -207,58 +207,9 @@ class ExpenseController extends Controller /** * @param Collection $accounts - * @param Collection $expense - * @param Carbon $start - * @param Carbon $end * - * @return array|mixed|string - * @throws \Throwable + * @return array */ - public function spentGrouped(Collection $accounts, Collection $expense, Carbon $start, Carbon $end) - { - // Properties for cache: - $cache = new CacheProperties; - $cache->addProperty($start); - $cache->addProperty($end); - $cache->addProperty('expense-spent-grouped'); - $cache->addProperty($accounts->pluck('id')->toArray()); - $cache->addProperty($expense->pluck('id')->toArray()); - if ($cache->has()) { - return $cache->get(); // @codeCoverageIgnore - } - - $combined = $this->combineAccounts($expense); - $format = app('navigation')->preferredRangeFormat($start, $end); - $result = []; - - foreach ($combined as $name => $combi) { - $current = clone $start; - $combiSet = []; - while ($current <= $end) { - $period = $current->format('Ymd'); - $periodName = app('navigation')->periodShow($current, $format); - $currentEnd = app('navigation')->endOfPeriod($current, $format); - /** - * @var string $name - * @var Collection $combi - */ - $spent = $this->spentInPeriod($accounts, $combi, $current, $currentEnd); - $earned = $this->earnedInPeriod($accounts, $combi, $current, $currentEnd); - $current = app('navigation')->addPeriod($current, $format, 0); - $combiSet[$period] = [ - 'period' => $periodName, - 'spent' => $spent, - 'earned' => $earned, - ]; - } - $result[$name] = $combiSet; - } - $result = view('reports.partials.exp-grouped', compact('result'))->render(); - $cache->store($result); - - return $result; - } - protected function combineAccounts(Collection $accounts): array { $combined = []; diff --git a/public/js/ff/reports/account/month.js b/public/js/ff/reports/account/month.js index 914908f4a1..099cf9a906 100644 --- a/public/js/ff/reports/account/month.js +++ b/public/js/ff/reports/account/month.js @@ -24,7 +24,6 @@ $(function () { drawChart(); loadAjaxPartial('inOutAccounts', spentUri); - loadAjaxPartial('inOutPeriod', groupedUri); loadAjaxPartial('inOutCategory', categoryUri); loadAjaxPartial('inOutBudget', budgetUri); loadAjaxPartial('topXexpense', expenseUri); diff --git a/resources/views/reports/account/report.twig b/resources/views/reports/account/report.twig index 9f84f39170..4dbaf2b5f1 100644 --- a/resources/views/reports/account/report.twig +++ b/resources/views/reports/account/report.twig @@ -21,20 +21,6 @@ - -
-
-
-

{{ ('in_out_accounts_period_'~preferredPeriod)|_ }}

-
-
- {# loading indicator #} -
- -
-
-
-
{# chart #} @@ -133,7 +119,6 @@ // boxes with stuff: var spentUri = '{{ route('report-data.expense.spent', [accountIds, expenseIds, start.format('Ymd'), end.format('Ymd')]) }}'; - var groupedUri = '{{ route('report-data.expense.spent-grouped', [accountIds, expenseIds, start.format('Ymd'), end.format('Ymd')]) }}'; var categoryUri = '{{ route('report-data.expense.category', [accountIds, expenseIds, start.format('Ymd'), end.format('Ymd')]) }}'; var budgetUri = '{{ route('report-data.expense.budget', [accountIds, expenseIds, start.format('Ymd'), end.format('Ymd')]) }}'; var expenseUri = '{{ route('report-data.expense.expenses', [accountIds, expenseIds, start.format('Ymd'), end.format('Ymd')]) }}'; diff --git a/resources/views/reports/partials/exp-grouped.twig b/resources/views/reports/partials/exp-grouped.twig deleted file mode 100644 index a5b4ea4936..0000000000 --- a/resources/views/reports/partials/exp-grouped.twig +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - - {% for name, periods in result %} - {% for periodIndex, period in periods %} - - - - - - - {% endfor %} - {% endfor %} - - -
{{ 'name'|_ }}{{ 'period'|_ }}
{{ name }}{{ period.period }} - {% if period.spent|length == 0%} - {{ '0'|formatAmount }} - {% endif %} - {% for expense in period.spent %} - {{ formatAmountBySymbol(expense.sum, expense.currency.symbol, expense.currency.dp) }}
- {% endfor %} -
- {% if period.earned|length == 0 %} - {{ '0'|formatAmount }} - {% endif %} - {% for income in period.earned %} - {{ formatAmountBySymbol(income.sum, income.currency.symbol, income.currency.dp) }}
- {% endfor %} -
diff --git a/routes/web.php b/routes/web.php index 9dabbc018e..39083bbe46 100755 --- a/routes/web.php +++ b/routes/web.php @@ -614,9 +614,8 @@ Route::group( Route::group( ['middleware' => 'user-full-auth', 'namespace' => 'Report', 'prefix' => 'report-data/expense', 'as' => 'report-data.expense.'], function () { - // spent per period / spent grouped + // spent per period Route::get('spent/{accountList}/{expenseList}/{start_date}/{end_date}', ['uses' => 'ExpenseController@spent', 'as' => 'spent']); - Route::get('spent-grouped/{accountList}/{expenseList}/{start_date}/{end_date}', ['uses' => 'ExpenseController@spentGrouped', 'as' => 'spent-grouped']); // per category && per budget Route::get('category/{accountList}/{expenseList}/{start_date}/{end_date}', ['uses' => 'ExpenseController@category', 'as' => 'category']);