Small optimisations.

This commit is contained in:
James Cole
2015-03-29 18:28:49 +02:00
parent bd96b2819f
commit 9be05e7e17
3 changed files with 21 additions and 2 deletions

View File

@@ -1,5 +1,6 @@
<?php namespace FireflyIII\Http\Controllers;
use Auth;
use Carbon\Carbon;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use Input;
@@ -46,6 +47,16 @@ class HomeController extends Controller
$accounts = $repository->getFrontpageAccounts($frontPage);
$savings = $repository->getSavingsAccounts();
// check if all books are correct.
$sum = floatval(Auth::user()->transactions()->sum('amount'));
if ($sum == 0) {
Session::flash(
'error', 'Your transactions are unbalanced. This means a'
. ' withdrawal, deposit or transfer was not stored properly. '
. 'Please check your accounts and transactions for errors.'
);
}
foreach ($accounts as $account) {
$set = $repository->getFrontpageTransactions($account, $start, $end);
if (count($set) > 0) {