Skip to content

Firefly III: a personal finances manager

Expand net worth calculation. TODO in three places.

James Cole862140a9fc09
diff --git a/app/Api/V1/Controllers/Summary/BasicController.php b/app/Api/V1/Controllers/Summary/BasicController.php
index 1ea7ef2967..87130ab778 100644
--- a/app/Api/V1/Controllers/Summary/BasicController.php
+++ b/app/Api/V1/Controllers/Summary/BasicController.php
@@ -360,7 +360,7 @@ class BasicController extends Controller
/** @var NetWorthInterface $netWorthHelper */
$netWorthHelper = app(NetWorthInterface::class);
$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.
$filtered = $allAccounts->filter(
diff --git a/app/Helpers/Report/NetWorth.php b/app/Helpers/Report/NetWorth.php
index cd0ad6e23a..b7166a805a 100644
--- a/app/Helpers/Report/NetWorth.php
+++ b/app/Helpers/Report/NetWorth.php
@@ -73,7 +73,7 @@ class NetWorth implements NetWorthInterface
$cache->addProperty('net-worth-by-currency');
$cache->addProperty(implode(',', $accounts->pluck('id')->toArray()));
if ($cache->has()) {
- return $cache->get();
+ // return $cache->get();
}
$netWorth = [];
@@ -184,7 +184,7 @@ class NetWorth implements NetWorthInterface
*/
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();
/** @var Account $account */
foreach ($accounts as $account) {
diff --git a/app/Http/Controllers/Json/BoxController.php b/app/Http/Controllers/Json/BoxController.php
index d4cfba99d6..2fff761687 100644
--- a/app/Http/Controllers/Json/BoxController.php
+++ b/app/Http/Controllers/Json/BoxController.php
@@ -231,7 +231,7 @@ class BoxController extends Controller
/** @var AccountRepositoryInterface $accountRepository */
$accountRepository = app(AccountRepositoryInterface::class);
$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()));