mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Included full home controller tests.
This commit is contained in:
@@ -32,6 +32,9 @@ class HomeController extends Controller
|
||||
Session::put('end', $end);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function flush()
|
||||
{
|
||||
Session::clear();
|
||||
@@ -58,7 +61,7 @@ class HomeController extends Controller
|
||||
$savings = $repository->getSavingsAccounts();
|
||||
|
||||
// check if all books are correct.
|
||||
$sum = floatval(Auth::user()->transactions()->sum('amount'));
|
||||
$sum = $repository->sumOfEverything();
|
||||
if ($sum != 0) {
|
||||
Session::flash(
|
||||
'error', 'Your transactions are unbalanced. This means a'
|
||||
|
@@ -151,6 +151,13 @@ class AccountRepository implements AccountRepositoryInterface
|
||||
->get(['transaction_journals.*', 'transaction_currencies.symbol', 'transaction_types.type']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return float
|
||||
*/
|
||||
public function sumOfEverything() {
|
||||
return floatval(Auth::user()->transactions()->sum('amount'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Account $account
|
||||
* @param int $page
|
||||
|
@@ -94,6 +94,11 @@ interface AccountRepositoryInterface
|
||||
*/
|
||||
public function getLastActivity(Account $account);
|
||||
|
||||
/**
|
||||
* @return float
|
||||
*/
|
||||
public function sumOfEverything();
|
||||
|
||||
/**
|
||||
* Get savings accounts and the balance difference in the period.
|
||||
*
|
||||
|
Reference in New Issue
Block a user