mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Expand net worth calculation. TODO in three places.
This commit is contained in:
parent
8447670ed5
commit
862140a9fc
@ -360,7 +360,7 @@ class BasicController extends Controller
|
|||||||
/** @var NetWorthInterface $netWorthHelper */
|
/** @var NetWorthInterface $netWorthHelper */
|
||||||
$netWorthHelper = app(NetWorthInterface::class);
|
$netWorthHelper = app(NetWorthInterface::class);
|
||||||
$netWorthHelper->setUser($user);
|
$netWorthHelper->setUser($user);
|
||||||
$allAccounts = $this->accountRepository->getActiveAccountsByType([AccountType::ASSET]);
|
$allAccounts = $this->accountRepository->getActiveAccountsByType([AccountType::ASSET, AccountType::DEFAULT, AccountType::LOAN, AccountType::MORTGAGE, AccountType::DEBT]);
|
||||||
|
|
||||||
// filter list on preference of being included.
|
// filter list on preference of being included.
|
||||||
$filtered = $allAccounts->filter(
|
$filtered = $allAccounts->filter(
|
||||||
|
@ -73,7 +73,7 @@ class NetWorth implements NetWorthInterface
|
|||||||
$cache->addProperty('net-worth-by-currency');
|
$cache->addProperty('net-worth-by-currency');
|
||||||
$cache->addProperty(implode(',', $accounts->pluck('id')->toArray()));
|
$cache->addProperty(implode(',', $accounts->pluck('id')->toArray()));
|
||||||
if ($cache->has()) {
|
if ($cache->has()) {
|
||||||
return $cache->get();
|
// return $cache->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
$netWorth = [];
|
$netWorth = [];
|
||||||
@ -184,7 +184,7 @@ class NetWorth implements NetWorthInterface
|
|||||||
*/
|
*/
|
||||||
private function getAccounts(): Collection
|
private function getAccounts(): Collection
|
||||||
{
|
{
|
||||||
$accounts = $this->accountRepository->getAccountsByType([AccountType::ASSET, AccountType::DEFAULT]);
|
$accounts = $this->accountRepository->getAccountsByType([AccountType::ASSET, AccountType::DEFAULT, AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE]);
|
||||||
$filtered = new Collection();
|
$filtered = new Collection();
|
||||||
/** @var Account $account */
|
/** @var Account $account */
|
||||||
foreach ($accounts as $account) {
|
foreach ($accounts as $account) {
|
||||||
|
@ -231,7 +231,7 @@ class BoxController extends Controller
|
|||||||
/** @var AccountRepositoryInterface $accountRepository */
|
/** @var AccountRepositoryInterface $accountRepository */
|
||||||
$accountRepository = app(AccountRepositoryInterface::class);
|
$accountRepository = app(AccountRepositoryInterface::class);
|
||||||
$allAccounts = $accountRepository->getActiveAccountsByType(
|
$allAccounts = $accountRepository->getActiveAccountsByType(
|
||||||
[AccountType::DEFAULT, AccountType::ASSET]
|
[AccountType::DEFAULT, AccountType::ASSET, AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE]
|
||||||
);
|
);
|
||||||
Log::debug(sprintf('Found %d accounts.', $allAccounts->count()));
|
Log::debug(sprintf('Found %d accounts.', $allAccounts->count()));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user