diff --git a/app/Http/Controllers/Account/IndexController.php b/app/Http/Controllers/Account/IndexController.php index 55d8f886c4..64d8f37eb5 100644 --- a/app/Http/Controllers/Account/IndexController.php +++ b/app/Http/Controllers/Account/IndexController.php @@ -96,7 +96,7 @@ class IndexController extends Controller [ $startBalances, $endBalances, - ] = Steam::accountsBalancesInRange($start, $end, $accounts, $this->primaryCurrency, $this->convertToPrimary); + ] = Steam::accountsBalancesInRange($accounts, $start, $end, $this->primaryCurrency, $this->convertToPrimary); $activities = Steam::getLastActivities($ids); @@ -172,7 +172,7 @@ class IndexController extends Controller [ $startBalances, $endBalances, - ] = Steam::accountsBalancesInRange($start, $end, $accounts, $this->primaryCurrency, $this->convertToPrimary); + ] = Steam::accountsBalancesInRange($accounts, $start, $end, $this->primaryCurrency, $this->convertToPrimary); $activities = Steam::getLastActivities($ids); diff --git a/app/Http/Controllers/Chart/AccountController.php b/app/Http/Controllers/Chart/AccountController.php index 81309854b7..5d09db1267 100644 --- a/app/Http/Controllers/Chart/AccountController.php +++ b/app/Http/Controllers/Chart/AccountController.php @@ -120,7 +120,7 @@ class AccountController extends Controller [ $startBalances, $endBalances, - ] = Steam::accountsBalancesInRange($start, $end, $accounts, $this->primaryCurrency, $this->convertToPrimary); + ] = Steam::accountsBalancesInRange($accounts, $start, $end, $this->primaryCurrency, $this->convertToPrimary); Log::debug('Done collecting balances'); // loop the accounts, then check for balance and currency info. foreach ($accounts as $account) { @@ -671,7 +671,7 @@ class AccountController extends Controller [ $startBalances, $endBalances, - ] = Steam::accountsBalancesInRange($start, $end, $accounts, $this->primaryCurrency, $this->convertToPrimary); + ] = Steam::accountsBalancesInRange($accounts, $start, $end , $this->primaryCurrency, $this->convertToPrimary); // loop the accounts, then check for balance and currency info. diff --git a/app/Repositories/Account/AccountTasker.php b/app/Repositories/Account/AccountTasker.php index 1b0cc75be1..119ea48426 100644 --- a/app/Repositories/Account/AccountTasker.php +++ b/app/Repositories/Account/AccountTasker.php @@ -54,7 +54,7 @@ class AccountTasker implements AccountTaskerInterface, UserGroupInterface [ $startSet, $endSet, - ] = Steam::accountsBalancesInRange($yesterday, $end, $accounts); + ] = Steam::accountsBalancesInRange($accounts, $yesterday, $end); Log::debug('Start of accountreport'); /** @var AccountRepositoryInterface $repository */ diff --git a/app/Support/JsonApi/Enrichments/AccountEnrichment.php b/app/Support/JsonApi/Enrichments/AccountEnrichment.php index d89bb2c704..43179333d6 100644 --- a/app/Support/JsonApi/Enrichments/AccountEnrichment.php +++ b/app/Support/JsonApi/Enrichments/AccountEnrichment.php @@ -292,7 +292,7 @@ class AccountEnrichment implements EnrichmentInterface [ $this->startBalances, $this->endBalances, - ] = Steam::accountsBalancesInRange($this->start, $this->end, $this->collection, $this->primaryCurrency, $this->convertToPrimary); + ] = Steam::accountsBalancesInRange($this->collection, $this->start, $this->end, $this->primaryCurrency, $this->convertToPrimary); } } diff --git a/app/Support/Steam.php b/app/Support/Steam.php index b5d14b5ead..b45f30a310 100644 --- a/app/Support/Steam.php +++ b/app/Support/Steam.php @@ -127,7 +127,7 @@ class Steam /** * Calls accountsBalancesOptimized for the given accounts and makes sure that inclusive is set to false, so it properly gets the balance of a range. */ - public function accountsBalancesInRange(Carbon $start, Carbon $end, Collection $accounts, ?TransactionCurrency $primary = null, ?bool $convertToPrimary = null): array + public function accountsBalancesInRange(Collection $accounts, Carbon $start, Carbon $end, ?TransactionCurrency $primary = null, ?bool $convertToPrimary = null): array { return [ $this->accountsBalancesOptimized($accounts, $start, $primary, $convertToPrimary, inclusive: false), @@ -373,6 +373,9 @@ class Steam return $final; } + /** + * @deprecated + */ public function finalAccountBalanceInRange(Account $account, Carbon $start, Carbon $end, bool $convertToPrimary): array { // expand period.