mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-29 18:20:01 +00:00
Code cleanup.
This commit is contained in:
@@ -13,7 +13,6 @@ use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
|
||||
use Illuminate\Pagination\LengthAwarePaginator;
|
||||
use Illuminate\Support\Collection;
|
||||
use Input;
|
||||
use Log;
|
||||
use Navigation;
|
||||
use Preferences;
|
||||
use Response;
|
||||
@@ -193,7 +192,6 @@ class BudgetController extends Controller
|
||||
/** @var LimitRepetition $repetition */
|
||||
foreach ($allRepetitions as $repetition) {
|
||||
if ($repetition->budget_id == $budget->id) {
|
||||
Log::debug('Repetition #' . $repetition->id . ' with budget #' . $repetition->budget_id . ' (current = ' . $budget->id . ')');
|
||||
if ($repetition->budgetLimit->repeat_freq == $repeatFreq
|
||||
&& $repetition->startdate->format('Y-m-d') == $startAsString
|
||||
&& $repetition->enddate->format('Y-m-d') == $endAsString
|
||||
|
@@ -53,7 +53,7 @@ class AccountController extends Controller
|
||||
$cache->addProperty('expenseAccounts');
|
||||
$cache->addProperty('accounts');
|
||||
if ($cache->has()) {
|
||||
return Response::json($cache->get());
|
||||
return Response::json($cache->get());
|
||||
}
|
||||
$accounts = $repository->getAccountsByType(['Expense account', 'Beneficiary account']);
|
||||
|
||||
@@ -105,7 +105,7 @@ class AccountController extends Controller
|
||||
$cache->addProperty('frontpage');
|
||||
$cache->addProperty('accounts');
|
||||
if ($cache->has()) {
|
||||
return Response::json($cache->get());
|
||||
return Response::json($cache->get());
|
||||
}
|
||||
|
||||
$frontPage = Preferences::get('frontPageAccounts', $repository->getAccountsByType([AccountType::DEFAULT, AccountType::ASSET])->pluck('id')->toArray());
|
||||
@@ -151,7 +151,7 @@ class AccountController extends Controller
|
||||
$cache->addProperty('default');
|
||||
$cache->addProperty($accounts);
|
||||
if ($cache->has()) {
|
||||
return Response::json($cache->get());
|
||||
return Response::json($cache->get());
|
||||
}
|
||||
|
||||
foreach ($accounts as $account) {
|
||||
@@ -196,7 +196,7 @@ class AccountController extends Controller
|
||||
$cache->addProperty('single');
|
||||
$cache->addProperty($account->id);
|
||||
if ($cache->has()) {
|
||||
return Response::json($cache->get());
|
||||
return Response::json($cache->get());
|
||||
}
|
||||
|
||||
$format = (string)trans('config.month_and_day');
|
||||
|
@@ -12,7 +12,6 @@ use FireflyIII\Models\TransactionJournal;
|
||||
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
|
||||
use FireflyIII\Support\CacheProperties;
|
||||
use Illuminate\Support\Collection;
|
||||
use Log;
|
||||
use Navigation;
|
||||
use Preferences;
|
||||
use Response;
|
||||
@@ -67,7 +66,6 @@ class BudgetController extends Controller
|
||||
$budgetCollection = new Collection([$budget]);
|
||||
$last = Navigation::endOfX($last, $range, $final); // not to overshoot.
|
||||
$entries = new Collection;
|
||||
Log::debug('---- now at chart');
|
||||
while ($first < $last) {
|
||||
|
||||
// periodspecific dates:
|
||||
@@ -115,7 +113,6 @@ class BudgetController extends Controller
|
||||
$entries = new Collection;
|
||||
$amount = $repetition->amount;
|
||||
$budgetCollection = new Collection([$budget]);
|
||||
Log::debug('amount starts ' . $amount);
|
||||
while ($start <= $end) {
|
||||
$spent = $repository->spentInPeriod($budgetCollection, new Collection, $start, $start);
|
||||
$amount = bcadd($amount, $spent);
|
||||
|
@@ -11,7 +11,6 @@ use FireflyIII\Models\Category;
|
||||
use FireflyIII\Repositories\Category\CategoryRepositoryInterface as CRI;
|
||||
use FireflyIII\Support\CacheProperties;
|
||||
use Illuminate\Support\Collection;
|
||||
use Log;
|
||||
use Navigation;
|
||||
use Preferences;
|
||||
use Response;
|
||||
@@ -69,10 +68,9 @@ class CategoryController extends Controller
|
||||
|
||||
while ($start <= $end) {
|
||||
$currentEnd = Navigation::endOfPeriod($start, $range);
|
||||
Log::debug('Searching for expenses from ' . $start . ' to ' . $currentEnd);
|
||||
$spent = $repository->spentInPeriod($categoryCollection, new Collection, $start, $currentEnd);
|
||||
$earned = $repository->earnedInPeriod($categoryCollection, new Collection, $start, $currentEnd);
|
||||
$date = Navigation::periodShow($start, $range);
|
||||
$spent = $repository->spentInPeriod($categoryCollection, new Collection, $start, $currentEnd);
|
||||
$earned = $repository->earnedInPeriod($categoryCollection, new Collection, $start, $currentEnd);
|
||||
$date = Navigation::periodShow($start, $range);
|
||||
$entries->push([clone $start, $date, $spent, $earned]);
|
||||
$start = Navigation::addPeriod($start, $range, 0);
|
||||
}
|
||||
@@ -126,7 +124,6 @@ class CategoryController extends Controller
|
||||
/** @var Category $category */
|
||||
foreach ($categories as $category) {
|
||||
$spent = $repository->spentInPeriod(new Collection([$category]), new Collection, $start, $end);
|
||||
Log::debug('Spent for ' . $category->name . ' is ' . $spent . ' (' . bccomp($spent, '0') . ')');
|
||||
if (bccomp($spent, '0') === -1) {
|
||||
$category->spent = $spent;
|
||||
$set->push($category);
|
||||
@@ -255,17 +252,13 @@ class CategoryController extends Controller
|
||||
$cache->addProperty('specific-period');
|
||||
|
||||
if ($cache->has()) {
|
||||
return $cache->get();
|
||||
return $cache->get();
|
||||
}
|
||||
$entries = new Collection;
|
||||
Log::debug('Start is ' . $start . ' en end is ' . $end);
|
||||
while ($start <= $end) {
|
||||
Log::debug('Now at ' . $start);
|
||||
$spent = $repository->spentInPeriod($categoryCollection, new Collection, $start, $start);
|
||||
Log::debug('spent: ' . $spent);
|
||||
$spent = $repository->spentInPeriod($categoryCollection, new Collection, $start, $start);
|
||||
$earned = $repository->earnedInPeriod($categoryCollection, new Collection, $start, $start);
|
||||
Log::debug('earned: ' . $earned);
|
||||
$date = Navigation::periodShow($start, '1D');
|
||||
$date = Navigation::periodShow($start, '1D');
|
||||
$entries->push([clone $start, $date, $spent, $earned]);
|
||||
$start->addDay();
|
||||
}
|
||||
|
@@ -100,7 +100,7 @@ class ReportController extends Controller
|
||||
$cache->addProperty($accounts);
|
||||
$cache->addProperty($end);
|
||||
if ($cache->has()) {
|
||||
return Response::json($cache->get());
|
||||
return Response::json($cache->get());
|
||||
}
|
||||
|
||||
// always per month.
|
||||
|
@@ -311,12 +311,10 @@ class CsvController extends Controller
|
||||
return redirect(route('csv.index'));
|
||||
}
|
||||
|
||||
Log::debug('Created importer');
|
||||
/** @var Importer $importer */
|
||||
$importer = app(Importer::class);
|
||||
$importer->setData($this->data);
|
||||
$importer->run();
|
||||
Log::debug('Done importing!');
|
||||
|
||||
$rows = $importer->getRows();
|
||||
$errors = $importer->getErrors();
|
||||
|
@@ -19,7 +19,6 @@ use FireflyIII\Http\Requests\ExportFormRequest;
|
||||
use FireflyIII\Models\ExportJob;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface as ARI;
|
||||
use FireflyIII\Repositories\ExportJob\ExportJobRepositoryInterface as EJRI;
|
||||
use Log;
|
||||
use Preferences;
|
||||
use Response;
|
||||
use Storage;
|
||||
@@ -62,7 +61,6 @@ class ExportController extends Controller
|
||||
|
||||
|
||||
$job->change('export_downloaded');
|
||||
Log::debug('Will send user file "' . $file . '".');
|
||||
|
||||
return response($disk->get($file), 200)
|
||||
->header('Content-Description', 'File Transfer')
|
||||
|
@@ -49,7 +49,6 @@ class HelpController extends Controller
|
||||
return Response::json($content);
|
||||
}
|
||||
|
||||
Log::debug('Will get help from Github for language "' . $language . '" and route "' . $route . '".');
|
||||
$content = $help->getFromGithub($language, $route);
|
||||
|
||||
$help->putInCache($route, $language, $content);
|
||||
|
@@ -226,7 +226,7 @@ class ReportController extends Controller
|
||||
}
|
||||
);
|
||||
|
||||
$view = view('popup.report.income-entry', compact('journals', 'account'))->render();
|
||||
$view = view('popup.report.income-entry', compact('journals', 'account'))->render();
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
@@ -12,7 +12,6 @@ use FireflyIII\Repositories\Account\AccountRepositoryInterface as ARI;
|
||||
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
|
||||
use FireflyIII\Repositories\Category\CategoryRepositoryInterface;
|
||||
use Illuminate\Support\Collection;
|
||||
use Log;
|
||||
use Preferences;
|
||||
use Session;
|
||||
use Steam;
|
||||
@@ -100,7 +99,6 @@ class ReportController extends Controller
|
||||
|
||||
// lower threshold
|
||||
if ($start < session('first')) {
|
||||
Log::debug('Start is ' . $start . ' but session first is ' . session('first'));
|
||||
$start = session('first');
|
||||
}
|
||||
|
||||
@@ -167,7 +165,7 @@ class ReportController extends Controller
|
||||
* Is there even activity on this account between the requested dates?
|
||||
*/
|
||||
if ($start->between($first, $last) || $end->between($first, $last)) {
|
||||
$exists = true;
|
||||
$exists = true;
|
||||
$journals = $repos->journalsInPeriod($accounts, [], $start, $end);
|
||||
|
||||
}
|
||||
|
@@ -19,7 +19,6 @@ use FireflyIII\Http\Requests\SplitJournalFormRequest;
|
||||
use FireflyIII\Models\Transaction;
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
use Illuminate\Http\Request;
|
||||
use Log;
|
||||
use Preferences;
|
||||
use Session;
|
||||
use Steam;
|
||||
@@ -198,7 +197,6 @@ class SplitController extends Controller
|
||||
private function arrayFromJournal(Request $request, TransactionJournal $journal): array
|
||||
{
|
||||
if (Session::has('_old_input')) {
|
||||
Log::debug('Old input: ', session('_old_input'));
|
||||
}
|
||||
$sourceAccounts = TransactionJournal::sourceAccountList($journal);
|
||||
$destinationAccounts = TransactionJournal::destinationAccountList($journal);
|
||||
|
Reference in New Issue
Block a user