Should fix tests.

This commit is contained in:
James Cole
2015-06-03 21:15:52 +02:00
parent a7f6848e53
commit 409ec2e086
21 changed files with 151 additions and 132 deletions

View File

@@ -48,14 +48,10 @@ class AccountController extends Controller
$chartProperties->addProperty($end);
$chartProperties->addProperty('all');
$chartProperties->addProperty('accounts');
$md5 = $chartProperties->md5();
if (Cache::has($md5)) {
Log::debug('Successfully returned cached chart [' . $md5 . '].');
return Response::json(Cache::get($md5));
if ($chartProperties->has()) {
return Response::json($chartProperties->get());
}
$md5 = $chartProperties->getMd5();
$chart->addColumn(trans('firefly.dayOfMonth'), 'date');
@@ -123,14 +119,10 @@ class AccountController extends Controller
$chartProperties->addProperty($end);
$chartProperties->addProperty('frontpage');
$chartProperties->addProperty('accounts');
$md5 = $chartProperties->md5();
if (Cache::has($md5)) {
Log::debug('Successfully returned cached chart [' . $md5 . '].');
return Response::json(Cache::get($md5));
if ($chartProperties->has()) {
return Response::json($chartProperties->get());
}
$md5 = $chartProperties->getMd5();
$index = 1;
@@ -188,14 +180,10 @@ class AccountController extends Controller
$chartProperties->addProperty('frontpage');
$chartProperties->addProperty('single');
$chartProperties->addProperty($account->id);
$md5 = $chartProperties->md5();
if (Cache::has($md5)) {
Log::debug('Successfully returned cached chart [' . $md5 . '].');
return Response::json(Cache::get($md5));
if ($chartProperties->has()) {
return Response::json($chartProperties->get());
}
$md5 = $chartProperties->getMd5();

View File

@@ -44,13 +44,10 @@ class BillController extends Controller
$chartProperties->addProperty('single');
$chartProperties->addProperty('bill');
$chartProperties->addProperty($bill->id);
$md5 = $chartProperties->md5();
if (Cache::has($md5)) {
Log::debug('Successfully returned cached chart [' . $md5 . '].');
return Response::json(Cache::get($md5));
if ($chartProperties->has()) {
return Response::json($chartProperties->get());
}
$md5 = $chartProperties->getMd5();
// get first transaction or today for start:
$results = $repository->getJournals($bill);
@@ -92,13 +89,10 @@ class BillController extends Controller
$chartProperties->addProperty($end);
$chartProperties->addProperty('bills');
$chartProperties->addProperty('frontpage');
$md5 = $chartProperties->md5();
if (Cache::has($md5)) {
Log::debug('Successfully returned cached chart [' . $md5 . '].');
return Response::json(Cache::get($md5));
if ($chartProperties->has()) {
return Response::json($chartProperties->get());
}
$md5 = $chartProperties->getMd5();
$bills = $repository->getActiveBills();
$paid = new Collection; // journals.

View File

@@ -50,13 +50,10 @@ class BudgetController extends Controller
$chartProperties->addProperty($last);
$chartProperties->addProperty('budget');
$chartProperties->addProperty('budget');
$md5 = $chartProperties->md5();
if (Cache::has($md5)) {
Log::debug('Successfully returned cached chart [' . $md5 . '].');
return Response::json(Cache::get($md5));
if ($chartProperties->has()) {
return Response::json($chartProperties->get());
}
$md5 = $chartProperties->getMd5();
while ($first < $last) {
@@ -100,13 +97,10 @@ class BudgetController extends Controller
$chartProperties->addProperty('limit');
$chartProperties->addProperty($budget->id);
$chartProperties->addProperty($repetition->id);
$md5 = $chartProperties->md5();
if (Cache::has($md5)) {
Log::debug('Successfully returned cached chart [' . $md5 . '].');
return Response::json(Cache::get($md5));
if ($chartProperties->has()) {
return Response::json($chartProperties->get());
}
$md5 = $chartProperties->getMd5();
$chart->addColumn(trans('firefly.day'), 'date');
$chart->addColumn(trans('firefly.left'), 'number');
@@ -158,13 +152,10 @@ class BudgetController extends Controller
$chartProperties->addProperty($end);
$chartProperties->addProperty('budget');
$chartProperties->addProperty('all');
$md5 = $chartProperties->md5();
if (Cache::has($md5)) {
Log::debug('Successfully returned cached chart [' . $md5 . '].');
return Response::json(Cache::get($md5));
if ($chartProperties->has()) {
return Response::json($chartProperties->get());
}
$md5 = $chartProperties->getMd5();
/** @var Budget $budget */
@@ -232,14 +223,10 @@ class BudgetController extends Controller
$chartProperties->addProperty($end);
$chartProperties->addProperty('budget');
$chartProperties->addProperty('year');
$md5 = $chartProperties->md5();
if (Cache::has($md5)) {
Log::debug('Successfully returned cached chart [' . $md5 . '].');
return Response::json(Cache::get($md5));
if ($chartProperties->has()) {
return Response::json($chartProperties->get());
}
$md5 = $chartProperties->getMd5();
// add columns:
$chart->addColumn(trans('firefly.month'), 'date');

View File

@@ -85,14 +85,10 @@ class CategoryController extends Controller
$chartProperties->addProperty($end);
$chartProperties->addProperty('category');
$chartProperties->addProperty('frontpage');
$md5 = $chartProperties->md5();
if (Cache::has($md5)) {
Log::debug('Successfully returned cached chart [' . $md5 . '].');
return Response::json(Cache::get($md5));
if ($chartProperties->has()) {
return Response::json($chartProperties->get());
}
$md5 = $chartProperties->getMd5();
$set = $repository->getCategoriesAndExpensesCorrected($start, $end);

View File

@@ -41,16 +41,6 @@ class HomeController extends Controller
{
Session::clear();
// encrypt transaction journal description
$set = TransactionJournal::where('encrypted', 0)->take(100)->get();
/** @var TransactionJournal $entry */
foreach ($set as $entry) {
$description = $entry->description;
$entry->description = $description;
$entry->save();
}
unset($set, $entry, $description);
return Redirect::route('index');
}

View File

@@ -13,7 +13,6 @@ use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
use FireflyIII\Repositories\Tag\TagRepositoryInterface;
use FireflyIII\Support\CacheProperties;
use Illuminate\Support\Collection;
use Log;
use Response;
use Session;
use Steam;
@@ -44,12 +43,10 @@ class JsonController extends Controller
$prop->addProperty($start);
$prop->addProperty($end);
$prop->addProperty('box-bills-paid');
$md5 = $prop->md5();
if (Cache::has($md5)) {
Log::debug('Successfully returned cached box bills-paid [' . $md5 . ']');
return Response::json(Cache::get($md5));
if ($prop->has()) {
return Response::json($prop->get());
}
$md5 = $prop->getMd5();
$amount = 0;
@@ -100,12 +97,10 @@ class JsonController extends Controller
$prop->addProperty($start);
$prop->addProperty($end);
$prop->addProperty('box-bills-unpaid');
$md5 = $prop->md5();
if (Cache::has($md5)) {
Log::debug('Successfully returned cached box bills-unpaid [' . $md5 . ']');
return Response::json(Cache::get($md5));
if ($prop->has()) {
return Response::json($prop->get());
}
$md5 = $prop->getMd5();
$bills = $repository->getActiveBills();
$unpaid = new Collection; // bills
@@ -162,13 +157,10 @@ class JsonController extends Controller
$prop->addProperty($start);
$prop->addProperty($end);
$prop->addProperty('box-in');
$md5 = $prop->md5();
if (Cache::has($md5)) {
Log::debug('Successfully returned cached box in [' . $md5 . ']');
return Response::json(Cache::get($md5));
if ($prop->has()) {
return Response::json($prop->get());
}
$md5 = $prop->getMd5();
$amount = $reportQuery->incomeInPeriodCorrected($start, $end, true)->sum('amount');
@@ -194,12 +186,10 @@ class JsonController extends Controller
$prop->addProperty($start);
$prop->addProperty($end);
$prop->addProperty('box-out');
$md5 = $prop->md5();
if (Cache::has($md5)) {
Log::debug('Successfully returned cached box out [' . $md5 . ']');
return Response::json(Cache::get($md5));
if ($prop->has()) {
return Response::json($prop->get());
}
$md5 = $prop->getMd5();
$amount = $reportQuery->expenseInPeriodCorrected($start, $end, true)->sum('amount');

View File

@@ -57,14 +57,13 @@ class Reminders
$properties = new CacheProperties;
$properties->addProperty('reminders');
$md5 = $properties->md5();
if (Cache::has($md5)) {
$reminders = Cache::get($md5);
if ($properties->has()) {
$reminders = $properties->get();
View::share('reminders', $reminders);
return $next($request);
}
$md5 = $properties->getMd5();
$piggyBanks = $this->auth->user()->piggyBanks()->where('remind_me', 1)->get();