Clean up balance methods.

This commit is contained in:
James Cole
2024-12-22 20:32:58 +01:00
parent a0e92b6969
commit d90ac519f7
93 changed files with 1233 additions and 1853 deletions

View File

@@ -115,7 +115,7 @@ class AccountTransformer extends AbstractTransformer
private function getMetaBalances(Collection $accounts): void
{
try {
$this->convertedBalances = app('steam')->balancesByAccountsConverted($accounts, $this->getDate());
$this->convertedBalances = app('steam')->finalAccountsBalance($accounts, $this->getDate());
} catch (FireflyException $e) {
Log::error($e->getMessage());
}
@@ -172,14 +172,15 @@ class AccountTransformer extends AbstractTransformer
private function getBalanceDifference(Collection $accounts, Carbon $start, Carbon $end): void
{
throw new FireflyException('Used deprecated method, rethink this.');
// collect balances, start and end for both native and converted.
// yes the b is usually used for boolean by idiots but here it's for balance.
$bStart = [];
$bEnd = [];
try {
$bStart = app('steam')->balancesByAccountsConverted($accounts, $start);
$bEnd = app('steam')->balancesByAccountsConverted($accounts, $end);
$bStart = app('steam')->finalAccountsBalance($accounts, $start);
$bEnd = app('steam')->finalAccountsBalance($accounts, $end);
} catch (FireflyException $e) {
Log::error($e->getMessage());
}