mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-15 16:57:09 +00:00
Code cleanup [skip ci]
This commit is contained in:
@@ -64,6 +64,7 @@ class BalanceLine
|
|||||||
if ($this->getRole() == self::ROLE_DIFFROLE) {
|
if ($this->getRole() == self::ROLE_DIFFROLE) {
|
||||||
return trans('firefly.leftUnbalanced');
|
return trans('firefly.leftUnbalanced');
|
||||||
}
|
}
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -70,6 +70,7 @@ class ReportHelper implements ReportHelperInterface
|
|||||||
if ($account->accountType->type != 'Cash account') {
|
if ($account->accountType->type != 'Cash account') {
|
||||||
return $account;
|
return $account;
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@@ -5,9 +5,9 @@ namespace FireflyIII\Helpers\Report;
|
|||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use FireflyIII\Helpers\Collection\Account as AccountCollection;
|
use FireflyIII\Helpers\Collection\Account as AccountCollection;
|
||||||
use FireflyIII\Helpers\Collection\Balance;
|
use FireflyIII\Helpers\Collection\Balance;
|
||||||
|
use FireflyIII\Helpers\Collection\Bill as BillCollection;
|
||||||
use FireflyIII\Helpers\Collection\Budget as BudgetCollection;
|
use FireflyIII\Helpers\Collection\Budget as BudgetCollection;
|
||||||
use FireflyIII\Helpers\Collection\Category as CategoryCollection;
|
use FireflyIII\Helpers\Collection\Category as CategoryCollection;
|
||||||
use FireflyIII\Helpers\Collection\Bill as BillCollection;
|
|
||||||
use FireflyIII\Helpers\Collection\Expense;
|
use FireflyIII\Helpers\Collection\Expense;
|
||||||
use FireflyIII\Helpers\Collection\Income;
|
use FireflyIII\Helpers\Collection\Income;
|
||||||
|
|
||||||
|
@@ -72,6 +72,7 @@ class ReportQuery implements ReportQueryInterface
|
|||||||
if ($journal->amount != 0) {
|
if ($journal->amount != 0) {
|
||||||
return $journal;
|
return $journal;
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@@ -189,6 +190,7 @@ class ReportQuery implements ReportQueryInterface
|
|||||||
if ($journal->amount != 0) {
|
if ($journal->amount != 0) {
|
||||||
return $journal;
|
return $journal;
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@@ -7,12 +7,13 @@ use FireflyIII\Http\Requests\AccountFormRequest;
|
|||||||
use FireflyIII\Models\Account;
|
use FireflyIII\Models\Account;
|
||||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||||
use Input;
|
use Input;
|
||||||
|
use Preferences;
|
||||||
use Redirect;
|
use Redirect;
|
||||||
use Session;
|
use Session;
|
||||||
use Steam;
|
use Steam;
|
||||||
use URL;
|
use URL;
|
||||||
use View;
|
use View;
|
||||||
use Preferences;
|
|
||||||
/**
|
/**
|
||||||
* Class AccountController
|
* Class AccountController
|
||||||
*
|
*
|
||||||
|
@@ -2,8 +2,6 @@
|
|||||||
|
|
||||||
namespace FireflyIII\Http\Controllers\Chart;
|
namespace FireflyIII\Http\Controllers\Chart;
|
||||||
|
|
||||||
use Auth;
|
|
||||||
use Cache;
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use FireflyIII\Http\Controllers\Controller;
|
use FireflyIII\Http\Controllers\Controller;
|
||||||
use FireflyIII\Models\Account;
|
use FireflyIII\Models\Account;
|
||||||
@@ -11,7 +9,6 @@ use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
|||||||
use FireflyIII\Support\CacheProperties;
|
use FireflyIII\Support\CacheProperties;
|
||||||
use Grumpydictator\Gchart\GChart;
|
use Grumpydictator\Gchart\GChart;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
use Log;
|
|
||||||
use Preferences;
|
use Preferences;
|
||||||
use Response;
|
use Response;
|
||||||
use Session;
|
use Session;
|
||||||
@@ -43,15 +40,14 @@ class AccountController extends Controller
|
|||||||
$end->endOfMonth();
|
$end->endOfMonth();
|
||||||
|
|
||||||
// chart properties for cache:
|
// chart properties for cache:
|
||||||
$chartProperties = new CacheProperties();
|
$cache = new CacheProperties();
|
||||||
$chartProperties->addProperty($start);
|
$cache->addProperty($start);
|
||||||
$chartProperties->addProperty($end);
|
$cache->addProperty($end);
|
||||||
$chartProperties->addProperty('all');
|
$cache->addProperty('all');
|
||||||
$chartProperties->addProperty('accounts');
|
$cache->addProperty('accounts');
|
||||||
if ($chartProperties->has()) {
|
if ($cache->has()) {
|
||||||
return Response::json($chartProperties->get());
|
return Response::json($cache->get());
|
||||||
}
|
}
|
||||||
$md5 = $chartProperties->getMd5();
|
|
||||||
|
|
||||||
|
|
||||||
$chart->addColumn(trans('firefly.dayOfMonth'), 'date');
|
$chart->addColumn(trans('firefly.dayOfMonth'), 'date');
|
||||||
@@ -91,7 +87,7 @@ class AccountController extends Controller
|
|||||||
$chart->generate();
|
$chart->generate();
|
||||||
|
|
||||||
$data = $chart->getData();
|
$data = $chart->getData();
|
||||||
Cache::forever($md5, $data);
|
$cache->store($data);
|
||||||
|
|
||||||
return Response::json($data);
|
return Response::json($data);
|
||||||
}
|
}
|
||||||
@@ -114,15 +110,14 @@ class AccountController extends Controller
|
|||||||
$accounts = $repository->getFrontpageAccounts($frontPage);
|
$accounts = $repository->getFrontpageAccounts($frontPage);
|
||||||
|
|
||||||
// chart properties for cache:
|
// chart properties for cache:
|
||||||
$chartProperties = new CacheProperties();
|
$cache = new CacheProperties();
|
||||||
$chartProperties->addProperty($start);
|
$cache->addProperty($start);
|
||||||
$chartProperties->addProperty($end);
|
$cache->addProperty($end);
|
||||||
$chartProperties->addProperty('frontpage');
|
$cache->addProperty('frontpage');
|
||||||
$chartProperties->addProperty('accounts');
|
$cache->addProperty('accounts');
|
||||||
if ($chartProperties->has()) {
|
if ($cache->has()) {
|
||||||
return Response::json($chartProperties->get());
|
return Response::json($cache->get());
|
||||||
}
|
}
|
||||||
$md5 = $chartProperties->getMd5();
|
|
||||||
|
|
||||||
|
|
||||||
$index = 1;
|
$index = 1;
|
||||||
@@ -148,7 +143,7 @@ class AccountController extends Controller
|
|||||||
$chart->generate();
|
$chart->generate();
|
||||||
|
|
||||||
$data = $chart->getData();
|
$data = $chart->getData();
|
||||||
Cache::forever($md5, $data);
|
$cache->store($data);
|
||||||
|
|
||||||
return Response::json($data);
|
return Response::json($data);
|
||||||
|
|
||||||
@@ -174,18 +169,15 @@ class AccountController extends Controller
|
|||||||
$today = new Carbon;
|
$today = new Carbon;
|
||||||
|
|
||||||
// chart properties for cache:
|
// chart properties for cache:
|
||||||
$chartProperties = new CacheProperties();
|
$cache = new CacheProperties();
|
||||||
$chartProperties->addProperty($start);
|
$cache->addProperty($start);
|
||||||
$chartProperties->addProperty($end);
|
$cache->addProperty($end);
|
||||||
$chartProperties->addProperty('frontpage');
|
$cache->addProperty('frontpage');
|
||||||
$chartProperties->addProperty('single');
|
$cache->addProperty('single');
|
||||||
$chartProperties->addProperty($account->id);
|
$cache->addProperty($account->id);
|
||||||
if ($chartProperties->has()) {
|
if ($cache->has()) {
|
||||||
return Response::json($chartProperties->get());
|
return Response::json($cache->get());
|
||||||
}
|
}
|
||||||
$md5 = $chartProperties->getMd5();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
while ($end >= $current) {
|
while ($end >= $current) {
|
||||||
$certain = $current < $today;
|
$certain = $current < $today;
|
||||||
@@ -197,7 +189,7 @@ class AccountController extends Controller
|
|||||||
$chart->generate();
|
$chart->generate();
|
||||||
|
|
||||||
$data = $chart->getData();
|
$data = $chart->getData();
|
||||||
Cache::forever($md5, $data);
|
$cache->store($data);
|
||||||
|
|
||||||
return Response::json($data);
|
return Response::json($data);
|
||||||
}
|
}
|
||||||
|
@@ -14,8 +14,7 @@ use Illuminate\Support\Collection;
|
|||||||
use Response;
|
use Response;
|
||||||
use Session;
|
use Session;
|
||||||
use Steam;
|
use Steam;
|
||||||
use Cache;
|
|
||||||
use Log;
|
|
||||||
/**
|
/**
|
||||||
* Class BillController
|
* Class BillController
|
||||||
*
|
*
|
||||||
@@ -40,14 +39,13 @@ class BillController extends Controller
|
|||||||
$chart->addColumn(trans('firefly.minAmount'), 'number');
|
$chart->addColumn(trans('firefly.minAmount'), 'number');
|
||||||
$chart->addColumn(trans('firefly.billEntry'), 'number');
|
$chart->addColumn(trans('firefly.billEntry'), 'number');
|
||||||
|
|
||||||
$chartProperties = new CacheProperties;
|
$cache = new CacheProperties;
|
||||||
$chartProperties->addProperty('single');
|
$cache->addProperty('single');
|
||||||
$chartProperties->addProperty('bill');
|
$cache->addProperty('bill');
|
||||||
$chartProperties->addProperty($bill->id);
|
$cache->addProperty($bill->id);
|
||||||
if ($chartProperties->has()) {
|
if ($cache->has()) {
|
||||||
return Response::json($chartProperties->get());
|
return Response::json($cache->get());
|
||||||
}
|
}
|
||||||
$md5 = $chartProperties->getMd5();
|
|
||||||
|
|
||||||
// get first transaction or today for start:
|
// get first transaction or today for start:
|
||||||
$results = $repository->getJournals($bill);
|
$results = $repository->getJournals($bill);
|
||||||
@@ -59,7 +57,7 @@ class BillController extends Controller
|
|||||||
$chart->generate();
|
$chart->generate();
|
||||||
|
|
||||||
$data = $chart->getData();
|
$data = $chart->getData();
|
||||||
Cache::forever($md5, $data);
|
$cache->store($data);
|
||||||
|
|
||||||
return Response::json($data);
|
return Response::json($data);
|
||||||
}
|
}
|
||||||
@@ -84,15 +82,14 @@ class BillController extends Controller
|
|||||||
|
|
||||||
|
|
||||||
// chart properties for cache:
|
// chart properties for cache:
|
||||||
$chartProperties = new CacheProperties();
|
$cache = new CacheProperties();
|
||||||
$chartProperties->addProperty($start);
|
$cache->addProperty($start);
|
||||||
$chartProperties->addProperty($end);
|
$cache->addProperty($end);
|
||||||
$chartProperties->addProperty('bills');
|
$cache->addProperty('bills');
|
||||||
$chartProperties->addProperty('frontpage');
|
$cache->addProperty('frontpage');
|
||||||
if ($chartProperties->has()) {
|
if ($cache->has()) {
|
||||||
return Response::json($chartProperties->get());
|
return Response::json($cache->get());
|
||||||
}
|
}
|
||||||
$md5 = $chartProperties->getMd5();
|
|
||||||
|
|
||||||
$bills = $repository->getActiveBills();
|
$bills = $repository->getActiveBills();
|
||||||
$paid = new Collection; // journals.
|
$paid = new Collection; // journals.
|
||||||
@@ -163,7 +160,7 @@ class BillController extends Controller
|
|||||||
$chart->generate();
|
$chart->generate();
|
||||||
|
|
||||||
$data = $chart->getData();
|
$data = $chart->getData();
|
||||||
Cache::forever($md5, $data);
|
$cache->store($data);
|
||||||
|
|
||||||
return Response::json($data);
|
return Response::json($data);
|
||||||
}
|
}
|
||||||
|
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace FireflyIII\Http\Controllers\Chart;
|
namespace FireflyIII\Http\Controllers\Chart;
|
||||||
|
|
||||||
use Cache;
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use FireflyIII\Http\Controllers\Controller;
|
use FireflyIII\Http\Controllers\Controller;
|
||||||
use FireflyIII\Models\Budget;
|
use FireflyIII\Models\Budget;
|
||||||
@@ -11,7 +10,6 @@ use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
|
|||||||
use FireflyIII\Support\CacheProperties;
|
use FireflyIII\Support\CacheProperties;
|
||||||
use Grumpydictator\Gchart\GChart;
|
use Grumpydictator\Gchart\GChart;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
use Log;
|
|
||||||
use Navigation;
|
use Navigation;
|
||||||
use Preferences;
|
use Preferences;
|
||||||
use Response;
|
use Response;
|
||||||
@@ -45,15 +43,14 @@ class BudgetController extends Controller
|
|||||||
$last = Navigation::endOfX($last, $range, $final);
|
$last = Navigation::endOfX($last, $range, $final);
|
||||||
|
|
||||||
// chart properties for cache:
|
// chart properties for cache:
|
||||||
$chartProperties = new CacheProperties();
|
$cache = new CacheProperties();
|
||||||
$chartProperties->addProperty($first);
|
$cache->addProperty($first);
|
||||||
$chartProperties->addProperty($last);
|
$cache->addProperty($last);
|
||||||
$chartProperties->addProperty('budget');
|
$cache->addProperty('budget');
|
||||||
$chartProperties->addProperty('budget');
|
$cache->addProperty('budget');
|
||||||
if ($chartProperties->has()) {
|
if ($cache->has()) {
|
||||||
return Response::json($chartProperties->get());
|
return Response::json($cache->get());
|
||||||
}
|
}
|
||||||
$md5 = $chartProperties->getMd5();
|
|
||||||
|
|
||||||
|
|
||||||
while ($first < $last) {
|
while ($first < $last) {
|
||||||
@@ -69,7 +66,7 @@ class BudgetController extends Controller
|
|||||||
$chart->generate();
|
$chart->generate();
|
||||||
|
|
||||||
$data = $chart->getData();
|
$data = $chart->getData();
|
||||||
Cache::forever($md5, $data);
|
$cache->store($data);
|
||||||
|
|
||||||
return Response::json($data);
|
return Response::json($data);
|
||||||
}
|
}
|
||||||
@@ -90,17 +87,16 @@ class BudgetController extends Controller
|
|||||||
$end = $repetition->enddate;
|
$end = $repetition->enddate;
|
||||||
|
|
||||||
// chart properties for cache:
|
// chart properties for cache:
|
||||||
$chartProperties = new CacheProperties();
|
$cache = new CacheProperties();
|
||||||
$chartProperties->addProperty($start);
|
$cache->addProperty($start);
|
||||||
$chartProperties->addProperty($end);
|
$cache->addProperty($end);
|
||||||
$chartProperties->addProperty('budget');
|
$cache->addProperty('budget');
|
||||||
$chartProperties->addProperty('limit');
|
$cache->addProperty('limit');
|
||||||
$chartProperties->addProperty($budget->id);
|
$cache->addProperty($budget->id);
|
||||||
$chartProperties->addProperty($repetition->id);
|
$cache->addProperty($repetition->id);
|
||||||
if ($chartProperties->has()) {
|
if ($cache->has()) {
|
||||||
return Response::json($chartProperties->get());
|
return Response::json($cache->get());
|
||||||
}
|
}
|
||||||
$md5 = $chartProperties->getMd5();
|
|
||||||
|
|
||||||
$chart->addColumn(trans('firefly.day'), 'date');
|
$chart->addColumn(trans('firefly.day'), 'date');
|
||||||
$chart->addColumn(trans('firefly.left'), 'number');
|
$chart->addColumn(trans('firefly.left'), 'number');
|
||||||
@@ -120,7 +116,7 @@ class BudgetController extends Controller
|
|||||||
$chart->generate();
|
$chart->generate();
|
||||||
|
|
||||||
$data = $chart->getData();
|
$data = $chart->getData();
|
||||||
Cache::forever($md5, $data);
|
$cache->store($data);
|
||||||
|
|
||||||
return Response::json($data);
|
return Response::json($data);
|
||||||
|
|
||||||
@@ -147,15 +143,14 @@ class BudgetController extends Controller
|
|||||||
$allEntries = new Collection;
|
$allEntries = new Collection;
|
||||||
|
|
||||||
// chart properties for cache:
|
// chart properties for cache:
|
||||||
$chartProperties = new CacheProperties();
|
$cache = new CacheProperties();
|
||||||
$chartProperties->addProperty($start);
|
$cache->addProperty($start);
|
||||||
$chartProperties->addProperty($end);
|
$cache->addProperty($end);
|
||||||
$chartProperties->addProperty('budget');
|
$cache->addProperty('budget');
|
||||||
$chartProperties->addProperty('all');
|
$cache->addProperty('all');
|
||||||
if ($chartProperties->has()) {
|
if ($cache->has()) {
|
||||||
return Response::json($chartProperties->get());
|
return Response::json($cache->get());
|
||||||
}
|
}
|
||||||
$md5 = $chartProperties->getMd5();
|
|
||||||
|
|
||||||
|
|
||||||
/** @var Budget $budget */
|
/** @var Budget $budget */
|
||||||
@@ -194,7 +189,7 @@ class BudgetController extends Controller
|
|||||||
$chart->generate();
|
$chart->generate();
|
||||||
|
|
||||||
$data = $chart->getData();
|
$data = $chart->getData();
|
||||||
Cache::forever($md5, $data);
|
$cache->store($data);
|
||||||
|
|
||||||
return Response::json($data);
|
return Response::json($data);
|
||||||
|
|
||||||
@@ -218,15 +213,14 @@ class BudgetController extends Controller
|
|||||||
$budgets = $repository->getBudgets();
|
$budgets = $repository->getBudgets();
|
||||||
|
|
||||||
// chart properties for cache:
|
// chart properties for cache:
|
||||||
$chartProperties = new CacheProperties();
|
$cache = new CacheProperties();
|
||||||
$chartProperties->addProperty($start);
|
$cache->addProperty($start);
|
||||||
$chartProperties->addProperty($end);
|
$cache->addProperty($end);
|
||||||
$chartProperties->addProperty('budget');
|
$cache->addProperty('budget');
|
||||||
$chartProperties->addProperty('year');
|
$cache->addProperty('year');
|
||||||
if ($chartProperties->has()) {
|
if ($cache->has()) {
|
||||||
return Response::json($chartProperties->get());
|
return Response::json($cache->get());
|
||||||
}
|
}
|
||||||
$md5 = $chartProperties->getMd5();
|
|
||||||
|
|
||||||
// add columns:
|
// add columns:
|
||||||
$chart->addColumn(trans('firefly.month'), 'date');
|
$chart->addColumn(trans('firefly.month'), 'date');
|
||||||
@@ -254,7 +248,7 @@ class BudgetController extends Controller
|
|||||||
$chart->generate();
|
$chart->generate();
|
||||||
|
|
||||||
$data = $chart->getData();
|
$data = $chart->getData();
|
||||||
Cache::forever($md5, $data);
|
$cache->store($data);
|
||||||
|
|
||||||
return Response::json($data);
|
return Response::json($data);
|
||||||
}
|
}
|
||||||
|
@@ -3,14 +3,12 @@
|
|||||||
namespace FireflyIII\Http\Controllers\Chart;
|
namespace FireflyIII\Http\Controllers\Chart;
|
||||||
|
|
||||||
|
|
||||||
use Cache;
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use FireflyIII\Http\Controllers\Controller;
|
use FireflyIII\Http\Controllers\Controller;
|
||||||
use FireflyIII\Models\Category;
|
use FireflyIII\Models\Category;
|
||||||
use FireflyIII\Repositories\Category\CategoryRepositoryInterface;
|
use FireflyIII\Repositories\Category\CategoryRepositoryInterface;
|
||||||
use FireflyIII\Support\CacheProperties;
|
use FireflyIII\Support\CacheProperties;
|
||||||
use Grumpydictator\Gchart\GChart;
|
use Grumpydictator\Gchart\GChart;
|
||||||
use Log;
|
|
||||||
use Navigation;
|
use Navigation;
|
||||||
use Preferences;
|
use Preferences;
|
||||||
use Response;
|
use Response;
|
||||||
@@ -80,15 +78,14 @@ class CategoryController extends Controller
|
|||||||
$end = Session::get('end', Carbon::now()->endOfMonth());
|
$end = Session::get('end', Carbon::now()->endOfMonth());
|
||||||
|
|
||||||
// chart properties for cache:
|
// chart properties for cache:
|
||||||
$chartProperties = new CacheProperties;
|
$cache = new CacheProperties;
|
||||||
$chartProperties->addProperty($start);
|
$cache->addProperty($start);
|
||||||
$chartProperties->addProperty($end);
|
$cache->addProperty($end);
|
||||||
$chartProperties->addProperty('category');
|
$cache->addProperty('category');
|
||||||
$chartProperties->addProperty('frontpage');
|
$cache->addProperty('frontpage');
|
||||||
if ($chartProperties->has()) {
|
if ($cache->has()) {
|
||||||
return Response::json($chartProperties->get());
|
return Response::json($cache->get());
|
||||||
}
|
}
|
||||||
$md5 = $chartProperties->getMd5();
|
|
||||||
|
|
||||||
$set = $repository->getCategoriesAndExpensesCorrected($start, $end);
|
$set = $repository->getCategoriesAndExpensesCorrected($start, $end);
|
||||||
|
|
||||||
@@ -115,7 +112,7 @@ class CategoryController extends Controller
|
|||||||
$chart->generate();
|
$chart->generate();
|
||||||
|
|
||||||
$data = $chart->getData();
|
$data = $chart->getData();
|
||||||
Cache::forever($md5, $data);
|
$cache->store($data);
|
||||||
|
|
||||||
return Response::json($data);
|
return Response::json($data);
|
||||||
|
|
||||||
|
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Config;
|
use Config;
|
||||||
use FireflyIII\Models\TransactionJournal;
|
|
||||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||||
use Input;
|
use Input;
|
||||||
use Preferences;
|
use Preferences;
|
||||||
@@ -74,7 +73,6 @@ class HomeController extends Controller
|
|||||||
$piggyBankAccounts = $repository->getPiggyBankAccounts();
|
$piggyBankAccounts = $repository->getPiggyBankAccounts();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$savingsTotal = 0;
|
$savingsTotal = 0;
|
||||||
foreach ($savings as $savingAccount) {
|
foreach ($savings as $savingAccount) {
|
||||||
$savingsTotal += Steam::balance($savingAccount, $end);
|
$savingsTotal += Steam::balance($savingAccount, $end);
|
||||||
@@ -95,6 +93,7 @@ class HomeController extends Controller
|
|||||||
$transactions[] = [$set, $account];
|
$transactions[] = [$set, $account];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return view('index', compact('count', 'title', 'savings', 'subTitle', 'mainTitleIcon', 'transactions', 'savingsTotal', 'piggyBankAccounts'));
|
return view('index', compact('count', 'title', 'savings', 'subTitle', 'mainTitleIcon', 'transactions', 'savingsTotal', 'piggyBankAccounts'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,7 +1,6 @@
|
|||||||
<?php namespace FireflyIII\Http\Controllers;
|
<?php namespace FireflyIII\Http\Controllers;
|
||||||
|
|
||||||
use Amount;
|
use Amount;
|
||||||
use Cache;
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use FireflyIII\Helpers\Report\ReportQueryInterface;
|
use FireflyIII\Helpers\Report\ReportQueryInterface;
|
||||||
use FireflyIII\Models\Account;
|
use FireflyIII\Models\Account;
|
||||||
@@ -39,14 +38,13 @@ class JsonController extends Controller
|
|||||||
$end = Session::get('end', Carbon::now()->endOfMonth());
|
$end = Session::get('end', Carbon::now()->endOfMonth());
|
||||||
|
|
||||||
// works for json too!
|
// works for json too!
|
||||||
$prop = new CacheProperties;
|
$cache = new CacheProperties;
|
||||||
$prop->addProperty($start);
|
$cache->addProperty($start);
|
||||||
$prop->addProperty($end);
|
$cache->addProperty($end);
|
||||||
$prop->addProperty('box-bills-paid');
|
$cache->addProperty('box-bills-paid');
|
||||||
if ($prop->has()) {
|
if ($cache->has()) {
|
||||||
return Response::json($prop->get());
|
return Response::json($cache->get());
|
||||||
}
|
}
|
||||||
$md5 = $prop->getMd5();
|
|
||||||
|
|
||||||
$amount = 0;
|
$amount = 0;
|
||||||
|
|
||||||
@@ -75,7 +73,8 @@ class JsonController extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$data = ['box' => 'bills-paid', 'amount' => Amount::format($amount, false), 'amount_raw' => $amount];
|
$data = ['box' => 'bills-paid', 'amount' => Amount::format($amount, false), 'amount_raw' => $amount];
|
||||||
Cache::forever($md5, $data);
|
$cache->store($data);
|
||||||
|
|
||||||
|
|
||||||
return Response::json($data);
|
return Response::json($data);
|
||||||
}
|
}
|
||||||
@@ -93,14 +92,13 @@ class JsonController extends Controller
|
|||||||
$end = Session::get('end', Carbon::now()->endOfMonth());
|
$end = Session::get('end', Carbon::now()->endOfMonth());
|
||||||
|
|
||||||
// works for json too!
|
// works for json too!
|
||||||
$prop = new CacheProperties;
|
$cache = new CacheProperties;
|
||||||
$prop->addProperty($start);
|
$cache->addProperty($start);
|
||||||
$prop->addProperty($end);
|
$cache->addProperty($end);
|
||||||
$prop->addProperty('box-bills-unpaid');
|
$cache->addProperty('box-bills-unpaid');
|
||||||
if ($prop->has()) {
|
if ($cache->has()) {
|
||||||
return Response::json($prop->get());
|
return Response::json($cache->get());
|
||||||
}
|
}
|
||||||
$md5 = $prop->getMd5();
|
|
||||||
|
|
||||||
$bills = $repository->getActiveBills();
|
$bills = $repository->getActiveBills();
|
||||||
$unpaid = new Collection; // bills
|
$unpaid = new Collection; // bills
|
||||||
@@ -137,7 +135,7 @@ class JsonController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
$data = ['box' => 'bills-unpaid', 'amount' => Amount::format($amount, false), 'amount_raw' => $amount];
|
$data = ['box' => 'bills-unpaid', 'amount' => Amount::format($amount, false), 'amount_raw' => $amount];
|
||||||
Cache::forever($md5, $data);
|
$cache->store($data);
|
||||||
|
|
||||||
return Response::json($data);
|
return Response::json($data);
|
||||||
}
|
}
|
||||||
@@ -153,19 +151,18 @@ class JsonController extends Controller
|
|||||||
$end = Session::get('end', Carbon::now()->endOfMonth());
|
$end = Session::get('end', Carbon::now()->endOfMonth());
|
||||||
|
|
||||||
// works for json too!
|
// works for json too!
|
||||||
$prop = new CacheProperties;
|
$cache = new CacheProperties;
|
||||||
$prop->addProperty($start);
|
$cache->addProperty($start);
|
||||||
$prop->addProperty($end);
|
$cache->addProperty($end);
|
||||||
$prop->addProperty('box-in');
|
$cache->addProperty('box-in');
|
||||||
if ($prop->has()) {
|
if ($cache->has()) {
|
||||||
return Response::json($prop->get());
|
return Response::json($cache->get());
|
||||||
}
|
}
|
||||||
$md5 = $prop->getMd5();
|
|
||||||
|
|
||||||
$amount = $reportQuery->incomeInPeriodCorrected($start, $end, true)->sum('amount');
|
$amount = $reportQuery->incomeInPeriodCorrected($start, $end, true)->sum('amount');
|
||||||
|
|
||||||
$data = ['box' => 'in', 'amount' => Amount::format($amount, false), 'amount_raw' => $amount];
|
$data = ['box' => 'in', 'amount' => Amount::format($amount, false), 'amount_raw' => $amount];
|
||||||
Cache::forever($md5, $data);
|
$cache->store($data);
|
||||||
|
|
||||||
return Response::json($data);
|
return Response::json($data);
|
||||||
}
|
}
|
||||||
@@ -182,19 +179,18 @@ class JsonController extends Controller
|
|||||||
|
|
||||||
|
|
||||||
// works for json too!
|
// works for json too!
|
||||||
$prop = new CacheProperties;
|
$cache = new CacheProperties;
|
||||||
$prop->addProperty($start);
|
$cache->addProperty($start);
|
||||||
$prop->addProperty($end);
|
$cache->addProperty($end);
|
||||||
$prop->addProperty('box-out');
|
$cache->addProperty('box-out');
|
||||||
if ($prop->has()) {
|
if ($cache->has()) {
|
||||||
return Response::json($prop->get());
|
return Response::json($cache->get());
|
||||||
}
|
}
|
||||||
$md5 = $prop->getMd5();
|
|
||||||
|
|
||||||
$amount = $reportQuery->expenseInPeriodCorrected($start, $end, true)->sum('amount');
|
$amount = $reportQuery->expenseInPeriodCorrected($start, $end, true)->sum('amount');
|
||||||
|
|
||||||
$data = ['box' => 'out', 'amount' => Amount::format($amount, false), 'amount_raw' => $amount];
|
$data = ['box' => 'out', 'amount' => Amount::format($amount, false), 'amount_raw' => $amount];
|
||||||
Cache::forever($md5, $data);
|
$cache->store($data);
|
||||||
|
|
||||||
return Response::json($data);
|
return Response::json($data);
|
||||||
}
|
}
|
||||||
|
@@ -1,12 +1,13 @@
|
|||||||
<?php namespace FireflyIII\Http\Middleware;
|
<?php namespace FireflyIII\Http\Middleware;
|
||||||
|
|
||||||
use App;
|
use App;
|
||||||
|
use Carbon\Carbon;
|
||||||
use Closure;
|
use Closure;
|
||||||
use Config;
|
use Config;
|
||||||
use Illuminate\Contracts\Auth\Guard;
|
use Illuminate\Contracts\Auth\Guard;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Preferences;
|
use Preferences;
|
||||||
use Carbon\Carbon;
|
|
||||||
/**
|
/**
|
||||||
* Class Authenticate
|
* Class Authenticate
|
||||||
*
|
*
|
||||||
|
@@ -3,7 +3,6 @@
|
|||||||
namespace FireflyIII\Http\Middleware;
|
namespace FireflyIII\Http\Middleware;
|
||||||
|
|
||||||
use App;
|
use App;
|
||||||
use Cache;
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Closure;
|
use Closure;
|
||||||
use FireflyIII\Models\PiggyBank;
|
use FireflyIII\Models\PiggyBank;
|
||||||
@@ -54,17 +53,15 @@ class Reminders
|
|||||||
// do reminders stuff.
|
// do reminders stuff.
|
||||||
|
|
||||||
// abuse CacheProperties to find out if we need to do this:
|
// abuse CacheProperties to find out if we need to do this:
|
||||||
$properties = new CacheProperties;
|
$cache = new CacheProperties;
|
||||||
|
|
||||||
$properties->addProperty('reminders');
|
$cache->addProperty('reminders');
|
||||||
if ($properties->has()) {
|
if ($cache->has()) {
|
||||||
$reminders = $properties->get();
|
$reminders = $cache->get();
|
||||||
View::share('reminders', $reminders);
|
View::share('reminders', $reminders);
|
||||||
|
|
||||||
return $next($request);
|
return $next($request);
|
||||||
}
|
}
|
||||||
$md5 = $properties->getMd5();
|
|
||||||
|
|
||||||
|
|
||||||
$piggyBanks = $this->auth->user()->piggyBanks()->where('remind_me', 1)->get();
|
$piggyBanks = $this->auth->user()->piggyBanks()->where('remind_me', 1)->get();
|
||||||
|
|
||||||
@@ -89,7 +86,7 @@ class Reminders
|
|||||||
$reminder->description = $helper->getReminderText($reminder);
|
$reminder->description = $helper->getReminderText($reminder);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
Cache::forever($md5, $reminders);
|
$cache->store($reminders);
|
||||||
View::share('reminders', $reminders);
|
View::share('reminders', $reminders);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,6 +1,5 @@
|
|||||||
<?php namespace FireflyIII\Models;
|
<?php namespace FireflyIII\Models;
|
||||||
|
|
||||||
use Cache;
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Crypt;
|
use Crypt;
|
||||||
use FireflyIII\Support\CacheProperties;
|
use FireflyIII\Support\CacheProperties;
|
||||||
@@ -136,13 +135,12 @@ class TransactionJournal extends Model
|
|||||||
*/
|
*/
|
||||||
public function getAmountAttribute()
|
public function getAmountAttribute()
|
||||||
{
|
{
|
||||||
$prop = new CacheProperties();
|
$cache = new CacheProperties();
|
||||||
$prop->addProperty($this->id);
|
$cache->addProperty($this->id);
|
||||||
$prop->addProperty('amount');
|
$cache->addProperty('amount');
|
||||||
if ($prop->has()) {
|
if ($cache->has()) {
|
||||||
return $prop->get();
|
return $cache->get();
|
||||||
}
|
}
|
||||||
$md5 = $prop->getMd5();
|
|
||||||
|
|
||||||
|
|
||||||
$amount = '0';
|
$amount = '0';
|
||||||
@@ -158,7 +156,7 @@ class TransactionJournal extends Model
|
|||||||
* If the journal has tags, it gets complicated.
|
* If the journal has tags, it gets complicated.
|
||||||
*/
|
*/
|
||||||
if ($this->tags->count() == 0) {
|
if ($this->tags->count() == 0) {
|
||||||
Cache::forever($md5, $amount);
|
$cache->store($amount);
|
||||||
|
|
||||||
return $amount;
|
return $amount;
|
||||||
}
|
}
|
||||||
@@ -173,7 +171,7 @@ class TransactionJournal extends Model
|
|||||||
foreach ($others as $other) {
|
foreach ($others as $other) {
|
||||||
$amount = bcsub($amount, $other->actual_amount);
|
$amount = bcsub($amount, $other->actual_amount);
|
||||||
}
|
}
|
||||||
Cache::forever($md5, $amount);
|
$cache->store($amount);
|
||||||
|
|
||||||
return $amount;
|
return $amount;
|
||||||
}
|
}
|
||||||
@@ -181,7 +179,7 @@ class TransactionJournal extends Model
|
|||||||
// if this journal is part of an advancePayment AND the journal is a deposit,
|
// if this journal is part of an advancePayment AND the journal is a deposit,
|
||||||
// then the journal amount is correcting a withdrawal, and the amount is zero:
|
// then the journal amount is correcting a withdrawal, and the amount is zero:
|
||||||
if ($advancePayment && $this->transactionType->type == 'Deposit') {
|
if ($advancePayment && $this->transactionType->type == 'Deposit') {
|
||||||
Cache::forever($md5, '0');
|
$cache->store('0');
|
||||||
|
|
||||||
return '0';
|
return '0';
|
||||||
}
|
}
|
||||||
@@ -196,14 +194,14 @@ class TransactionJournal extends Model
|
|||||||
$transfer = $balancingAct->transactionJournals()->transactionTypes(['Transfer'])->first();
|
$transfer = $balancingAct->transactionJournals()->transactionTypes(['Transfer'])->first();
|
||||||
if ($transfer) {
|
if ($transfer) {
|
||||||
$amount = bcsub($amount, $transfer->actual_amount);
|
$amount = bcsub($amount, $transfer->actual_amount);
|
||||||
Cache::forever($md5, $amount);
|
$cache->store($amount);
|
||||||
|
|
||||||
return $amount;
|
return $amount;
|
||||||
}
|
}
|
||||||
} // @codeCoverageIgnore
|
} // @codeCoverageIgnore
|
||||||
} // @codeCoverageIgnore
|
} // @codeCoverageIgnore
|
||||||
|
|
||||||
Cache::forever($md5, $amount);
|
$cache->store($amount);
|
||||||
|
|
||||||
return $amount;
|
return $amount;
|
||||||
}
|
}
|
||||||
|
@@ -4,7 +4,6 @@ namespace FireflyIII\Repositories\Account;
|
|||||||
|
|
||||||
use App;
|
use App;
|
||||||
use Auth;
|
use Auth;
|
||||||
use Cache;
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Config;
|
use Config;
|
||||||
use DB;
|
use DB;
|
||||||
@@ -117,7 +116,6 @@ class AccountRepository implements AccountRepositoryInterface
|
|||||||
if ($cache->has()) {
|
if ($cache->has()) {
|
||||||
return $cache->get();
|
return $cache->get();
|
||||||
}
|
}
|
||||||
$md5 = $cache->getMd5();
|
|
||||||
|
|
||||||
|
|
||||||
if ($preference->data == []) {
|
if ($preference->data == []) {
|
||||||
@@ -126,7 +124,7 @@ class AccountRepository implements AccountRepositoryInterface
|
|||||||
$accounts = Auth::user()->accounts()->whereIn('id', $preference->data)->orderBy('accounts.name', 'ASC')->get(['accounts.*']);
|
$accounts = Auth::user()->accounts()->whereIn('id', $preference->data)->orderBy('accounts.name', 'ASC')->get(['accounts.*']);
|
||||||
}
|
}
|
||||||
|
|
||||||
Cache::forever($md5, $accounts);
|
$cache->store($accounts);
|
||||||
|
|
||||||
return $accounts;
|
return $accounts;
|
||||||
}
|
}
|
||||||
@@ -144,14 +142,13 @@ class AccountRepository implements AccountRepositoryInterface
|
|||||||
*/
|
*/
|
||||||
public function getFrontpageTransactions(Account $account, Carbon $start, Carbon $end)
|
public function getFrontpageTransactions(Account $account, Carbon $start, Carbon $end)
|
||||||
{
|
{
|
||||||
$prop = new CacheProperties();
|
$cache = new CacheProperties();
|
||||||
$prop->addProperty($account->id);
|
$cache->addProperty($account->id);
|
||||||
$prop->addProperty($start);
|
$cache->addProperty($start);
|
||||||
$prop->addProperty($end);
|
$cache->addProperty($end);
|
||||||
if ($prop->has()) {
|
if ($cache->has()) {
|
||||||
return $prop->get();
|
return $cache->get();
|
||||||
}
|
}
|
||||||
$md5 = $prop->getMd5();
|
|
||||||
|
|
||||||
$set = Auth::user()
|
$set = Auth::user()
|
||||||
->transactionjournals()
|
->transactionjournals()
|
||||||
@@ -166,7 +163,7 @@ class AccountRepository implements AccountRepositoryInterface
|
|||||||
->orderBy('transaction_journals.id', 'DESC')
|
->orderBy('transaction_journals.id', 'DESC')
|
||||||
->take(10)
|
->take(10)
|
||||||
->get(['transaction_journals.*', 'transaction_currencies.symbol', 'transaction_types.type']);
|
->get(['transaction_journals.*', 'transaction_currencies.symbol', 'transaction_types.type']);
|
||||||
Cache::forever($md5, $set);
|
$cache->store($set);
|
||||||
|
|
||||||
return $set;
|
return $set;
|
||||||
}
|
}
|
||||||
@@ -238,7 +235,6 @@ class AccountRepository implements AccountRepositoryInterface
|
|||||||
if ($cache->has()) {
|
if ($cache->has()) {
|
||||||
return $cache->get();
|
return $cache->get();
|
||||||
}
|
}
|
||||||
$md5 = $cache->getMd5();
|
|
||||||
|
|
||||||
$ids = array_unique($ids);
|
$ids = array_unique($ids);
|
||||||
if (count($ids) > 0) {
|
if (count($ids) > 0) {
|
||||||
@@ -264,7 +260,7 @@ class AccountRepository implements AccountRepositoryInterface
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
Cache::forever($md5, $accounts);
|
$cache->store($accounts);
|
||||||
|
|
||||||
return $accounts;
|
return $accounts;
|
||||||
|
|
||||||
|
@@ -99,4 +99,12 @@ class CacheProperties
|
|||||||
|
|
||||||
$this->md5 = md5($this->md5);
|
$this->md5 = md5($this->md5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $data
|
||||||
|
*/
|
||||||
|
public function store($data)
|
||||||
|
{
|
||||||
|
Cache::forever($this->md5, $data);
|
||||||
|
}
|
||||||
}
|
}
|
@@ -4,6 +4,7 @@ namespace FireflyIII\Support;
|
|||||||
|
|
||||||
use Auth;
|
use Auth;
|
||||||
use FireflyIII\Models\Preference;
|
use FireflyIII\Models\Preference;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Preferences
|
* Class Preferences
|
||||||
*
|
*
|
||||||
@@ -21,14 +22,6 @@ class Preferences
|
|||||||
return md5($preference);
|
return md5($preference);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return bool
|
|
||||||
*/
|
|
||||||
public function mark() {
|
|
||||||
$this->set('lastActivity',microtime());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $name
|
* @param $name
|
||||||
* @param null $default
|
* @param null $default
|
||||||
@@ -85,4 +78,14 @@ class Preferences
|
|||||||
return $pref;
|
return $pref;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function mark()
|
||||||
|
{
|
||||||
|
$this->set('lastActivity', microtime());
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace FireflyIII\Support;
|
namespace FireflyIII\Support;
|
||||||
|
|
||||||
use Cache;
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use FireflyIII\Models\Account;
|
use FireflyIII\Models\Account;
|
||||||
|
|
||||||
@@ -25,15 +24,14 @@ class Steam
|
|||||||
{
|
{
|
||||||
|
|
||||||
// abuse chart properties:
|
// abuse chart properties:
|
||||||
$properties = new CacheProperties;
|
$cache = new CacheProperties;
|
||||||
$properties->addProperty($account->id);
|
$cache->addProperty($account->id);
|
||||||
$properties->addProperty('balance');
|
$cache->addProperty('balance');
|
||||||
$properties->addProperty($date);
|
$cache->addProperty($date);
|
||||||
$properties->addProperty($ignoreVirtualBalance);
|
$cache->addProperty($ignoreVirtualBalance);
|
||||||
if ($properties->has()) {
|
if ($cache->has()) {
|
||||||
return $properties->get();
|
return $cache->get();
|
||||||
}
|
}
|
||||||
$md5 = $properties->getMd5();
|
|
||||||
|
|
||||||
|
|
||||||
// find the first known transaction on this account:
|
// find the first known transaction on this account:
|
||||||
@@ -57,7 +55,7 @@ class Steam
|
|||||||
if (!$ignoreVirtualBalance) {
|
if (!$ignoreVirtualBalance) {
|
||||||
$balance = bcadd($balance, $account->virtual_balance);
|
$balance = bcadd($balance, $account->virtual_balance);
|
||||||
}
|
}
|
||||||
Cache::forever($md5, round($balance, 2));
|
$cache->store(round($balance, 2));
|
||||||
|
|
||||||
return round($balance, 2);
|
return round($balance, 2);
|
||||||
}
|
}
|
||||||
|
@@ -4,7 +4,6 @@ namespace FireflyIII\Support\Twig;
|
|||||||
|
|
||||||
|
|
||||||
use App;
|
use App;
|
||||||
use Cache;
|
|
||||||
use FireflyIII\Models\TransactionJournal;
|
use FireflyIII\Models\TransactionJournal;
|
||||||
use FireflyIII\Support\CacheProperties;
|
use FireflyIII\Support\CacheProperties;
|
||||||
use Twig_Extension;
|
use Twig_Extension;
|
||||||
@@ -30,13 +29,12 @@ class Journal extends Twig_Extension
|
|||||||
$filters[] = new Twig_SimpleFilter(
|
$filters[] = new Twig_SimpleFilter(
|
||||||
'typeIcon', function (TransactionJournal $journal) {
|
'typeIcon', function (TransactionJournal $journal) {
|
||||||
|
|
||||||
$prop = new CacheProperties();
|
$cache = new CacheProperties();
|
||||||
$prop->addProperty($journal->id);
|
$cache->addProperty($journal->id);
|
||||||
$prop->addProperty('typeIcon');
|
$cache->addProperty('typeIcon');
|
||||||
if ($prop->has()) {
|
if ($cache->has()) {
|
||||||
return $prop->get();
|
return $cache->get();
|
||||||
}
|
}
|
||||||
$md5 = $prop->getMd5();
|
|
||||||
|
|
||||||
$type = $journal->transactionType->type;
|
$type = $journal->transactionType->type;
|
||||||
|
|
||||||
@@ -57,7 +55,7 @@ class Journal extends Twig_Extension
|
|||||||
$txt = '';
|
$txt = '';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Cache::forever($md5, $txt);
|
$cache->store($txt);
|
||||||
|
|
||||||
return $txt;
|
return $txt;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user