Remove lots of debug logs

This commit is contained in:
James Cole
2024-12-27 07:36:30 +01:00
parent 36457455ca
commit 9bfef892f8
3 changed files with 44 additions and 43 deletions

View File

@@ -102,7 +102,7 @@ class CorrectsNativeAmounts extends Command
foreach ($set as $account) { foreach ($set as $account) {
$account->touch(); $account->touch();
} }
Log::debug(sprintf('Recalculated %d accounts', $set->count())); Log::debug(sprintf('Recalculated %d accounts for user group #%d.', $set->count(), $userGroup->id));
} }
private function recalculatePiggyBanks(UserGroup $userGroup, TransactionCurrency $currency): void private function recalculatePiggyBanks(UserGroup $userGroup, TransactionCurrency $currency): void
@@ -131,7 +131,7 @@ class CorrectsNativeAmounts extends Command
} }
$this->recalculatePiggyBankEvents($piggyBank); $this->recalculatePiggyBankEvents($piggyBank);
} }
Log::debug(sprintf('Recalculated %d piggy banks.', $set->count())); Log::debug(sprintf('Recalculated %d piggy banks for user group #%d.', $set->count(), $userGroup->id));
} }
@@ -168,7 +168,7 @@ class CorrectsNativeAmounts extends Command
$limit->touch(); $limit->touch();
Log::debug(sprintf('Done with touch BL #%d', $limit->id)); Log::debug(sprintf('Done with touch BL #%d', $limit->id));
} }
Log::debug(sprintf('Recalculated %d budget limits.', $set->count())); Log::debug(sprintf('Recalculated %d budget limits for budget #%d.', $set->count(), $budget->id));
} }
private function recalculateAutoBudgets(Budget $budget, TransactionCurrency $currency): void private function recalculateAutoBudgets(Budget $budget, TransactionCurrency $currency): void
@@ -179,7 +179,7 @@ class CorrectsNativeAmounts extends Command
foreach ($set as $autoBudget) { foreach ($set as $autoBudget) {
$autoBudget->touch(); $autoBudget->touch();
} }
Log::debug(sprintf('Recalculated %d auto budgets.', $set->count())); Log::debug(sprintf('Recalculated %d auto budgets for budget #%d.', $set->count(), $budget->id));
} }
private function recalculateAvailableBudgets(UserGroup $userGroup, TransactionCurrency $currency): void private function recalculateAvailableBudgets(UserGroup $userGroup, TransactionCurrency $currency): void

View File

@@ -37,7 +37,7 @@ class AccountObserver
{ {
public function created(Account $account): void public function created(Account $account): void
{ {
Log::debug('Observe "created" of an account.'); // Log::debug('Observe "created" of an account.');
$this->updateNativeAmount($account); $this->updateNativeAmount($account);
} }
@@ -57,7 +57,7 @@ class AccountObserver
$account->native_virtual_balance = null; $account->native_virtual_balance = null;
} }
$account->saveQuietly(); $account->saveQuietly();
Log::debug('Account native virtual balance is updated.'); //Log::debug('Account native virtual balance is updated.');
} }
/** /**
@@ -65,7 +65,7 @@ class AccountObserver
*/ */
public function deleting(Account $account): void public function deleting(Account $account): void
{ {
app('log')->debug('Observe "deleting" of an account.'); // app('log')->debug('Observe "deleting" of an account.');
$account->accountMeta()->delete(); $account->accountMeta()->delete();
/** @var PiggyBank $piggy */ /** @var PiggyBank $piggy */
@@ -84,7 +84,7 @@ class AccountObserver
public function updated(Account $account): void public function updated(Account $account): void
{ {
Log::debug('Observe "updated" of an account.'); // Log::debug('Observe "updated" of an account.');
$this->updateNativeAmount($account); $this->updateNativeAmount($account);
} }
} }

View File

@@ -24,6 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Services\Internal\Support; namespace FireflyIII\Services\Internal\Support;
use FireflyIII\Enums\TransactionTypeEnum;
use FireflyIII\Exceptions\FireflyException; use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Factory\AccountMetaFactory; use FireflyIII\Factory\AccountMetaFactory;
use FireflyIII\Models\Account; use FireflyIII\Models\Account;
@@ -80,8 +81,8 @@ class CreditRecalculateService
try { try {
$this->findByJournal($journal); $this->findByJournal($journal);
} catch (FireflyException $e) { } catch (FireflyException $e) {
app('log')->error($e->getTraceAsString()); Log::error($e->getTraceAsString());
app('log')->error(sprintf('Could not find work account for transaction group #%d.', $this->group->id)); Log::error(sprintf('Could not find work account for transaction group #%d.', $this->group->id));
} }
} }
} }
@@ -158,13 +159,13 @@ class CreditRecalculateService
private function processWorkAccount(Account $account): void private function processWorkAccount(Account $account): void
{ {
app('log')->debug(sprintf('Now processing account #%d ("%s"). All amounts with 2 decimals!', $account->id, $account->name)); Log::debug(sprintf('Now processing account #%d ("%s"). All amounts with 2 decimals!', $account->id, $account->name));
// get opening balance (if present) // get opening balance (if present)
$this->repository->setUser($account->user); $this->repository->setUser($account->user);
$direction = (string) $this->repository->getMetaValue($account, 'liability_direction'); $direction = (string) $this->repository->getMetaValue($account, 'liability_direction');
$openingBalance = $this->repository->getOpeningBalance($account); $openingBalance = $this->repository->getOpeningBalance($account);
if (null !== $openingBalance) { if (null !== $openingBalance) {
app('log')->debug(sprintf('Found opening balance transaction journal #%d', $openingBalance->id)); // Log::debug(sprintf('Found opening balance transaction journal #%d', $openingBalance->id));
// if account direction is "debit" ("I owe this amount") the opening balance must always be AWAY from the account: // if account direction is "debit" ("I owe this amount") the opening balance must always be AWAY from the account:
if ('debit' === $direction) { if ('debit' === $direction) {
$this->validateOpeningBalance($account, $openingBalance); $this->validateOpeningBalance($account, $openingBalance);
@@ -172,7 +173,7 @@ class CreditRecalculateService
} }
$startOfDebt = $this->repository->getOpeningBalanceAmount($account) ?? '0'; $startOfDebt = $this->repository->getOpeningBalanceAmount($account) ?? '0';
$leftOfDebt = app('steam')->positive($startOfDebt); $leftOfDebt = app('steam')->positive($startOfDebt);
app('log')->debug(sprintf('Start of debt is "%s", so initial left of debt is "%s"', app('steam')->bcround($startOfDebt, 2), app('steam')->bcround($leftOfDebt, 2))); // Log::debug(sprintf('Start of debt is "%s", so initial left of debt is "%s"', app('steam')->bcround($startOfDebt, 2), app('steam')->bcround($leftOfDebt, 2)));
/** @var AccountMetaFactory $factory */ /** @var AccountMetaFactory $factory */
$factory = app(AccountMetaFactory::class); $factory = app(AccountMetaFactory::class);
@@ -180,7 +181,7 @@ class CreditRecalculateService
// amount is positive or negative, doesn't matter. // amount is positive or negative, doesn't matter.
$factory->crud($account, 'start_of_debt', $startOfDebt); $factory->crud($account, 'start_of_debt', $startOfDebt);
app('log')->debug(sprintf('Debt direction is "%s"', $direction)); // Log::debug(sprintf('Debt direction is "%s"', $direction));
// now loop all transactions (except opening balance and credit thing) // now loop all transactions (except opening balance and credit thing)
$transactions = $account->transactions() $transactions = $account->transactions()
@@ -189,15 +190,15 @@ class CreditRecalculateService
->get(['transactions.*']) ->get(['transactions.*'])
; ;
$total = $transactions->count(); $total = $transactions->count();
app('log')->debug(sprintf('Found %d transaction(s) to process.', $total)); // Log::debug(sprintf('Found %d transaction(s) to process.', $total));
/** @var Transaction $transaction */ /** @var Transaction $transaction */
foreach ($transactions as $index => $transaction) { foreach ($transactions as $index => $transaction) {
app('log')->debug(sprintf('[%d/%d] Processing transaction.', $index + 1, $total)); // Log::debug(sprintf('[%d/%d] Processing transaction.', $index + 1, $total));
$leftOfDebt = $this->processTransaction($account, $direction, $transaction, $leftOfDebt); $leftOfDebt = $this->processTransaction($account, $direction, $transaction, $leftOfDebt);
} }
$factory->crud($account, 'current_debt', $leftOfDebt); $factory->crud($account, 'current_debt', $leftOfDebt);
app('log')->debug(sprintf('Done processing account #%d ("%s")', $account->id, $account->name)); Log::debug(sprintf('Done processing account #%d ("%s")', $account->id, $account->name));
} }
/** /**
@@ -211,25 +212,25 @@ class CreditRecalculateService
/** @var Transaction $dest */ /** @var Transaction $dest */
$dest = $openingBalance->transactions()->where('amount', '>', 0)->first(); $dest = $openingBalance->transactions()->where('amount', '>', 0)->first();
if ($source->account_id !== $account->id) { if ($source->account_id !== $account->id) {
app('log')->info(sprintf('Liability #%d has a reversed opening balance. Will fix this now.', $account->id)); Log::info(sprintf('Liability #%d has a reversed opening balance. Will fix this now.', $account->id));
app('log')->debug(sprintf('Source amount "%s" is now "%s"', $source->amount, app('steam')->positive($source->amount))); Log::debug(sprintf('Source amount "%s" is now "%s"', $source->amount, app('steam')->positive($source->amount)));
app('log')->debug(sprintf('Destination amount "%s" is now "%s"', $dest->amount, app('steam')->negative($dest->amount))); Log::debug(sprintf('Destination amount "%s" is now "%s"', $dest->amount, app('steam')->negative($dest->amount)));
$source->amount = app('steam')->positive($source->amount); $source->amount = app('steam')->positive($source->amount);
$dest->amount = app('steam')->negative($source->amount); $dest->amount = app('steam')->negative($source->amount);
if (null !== $source->foreign_amount && '' !== $source->foreign_amount) { if (null !== $source->foreign_amount && '' !== $source->foreign_amount) {
$source->foreign_amount = app('steam')->positive($source->foreign_amount); $source->foreign_amount = app('steam')->positive($source->foreign_amount);
app('log')->debug(sprintf('Source foreign amount "%s" is now "%s"', $source->foreign_amount, app('steam')->positive($source->foreign_amount))); Log::debug(sprintf('Source foreign amount "%s" is now "%s"', $source->foreign_amount, app('steam')->positive($source->foreign_amount)));
} }
if (null !== $dest->foreign_amount && '' !== $dest->foreign_amount) { if (null !== $dest->foreign_amount && '' !== $dest->foreign_amount) {
$dest->foreign_amount = app('steam')->negative($dest->foreign_amount); $dest->foreign_amount = app('steam')->negative($dest->foreign_amount);
app('log')->debug(sprintf('Destination amount "%s" is now "%s"', $dest->foreign_amount, app('steam')->negative($dest->foreign_amount))); Log::debug(sprintf('Destination amount "%s" is now "%s"', $dest->foreign_amount, app('steam')->negative($dest->foreign_amount)));
} }
$source->save(); $source->save();
$dest->save(); $dest->save();
return; return;
} }
app('log')->debug('Opening balance is valid'); Log::debug('Opening balance is valid');
} }
/** /**
@@ -245,7 +246,7 @@ class CreditRecalculateService
// here be null pointers. // here be null pointers.
if (null === $journal) { if (null === $journal) {
app('log')->warning(sprintf('Transaction #%d has no journal.', $transaction->id)); Log::warning(sprintf('Transaction #%d has no journal.', $transaction->id));
return $leftOfDebt; return $leftOfDebt;
} }
@@ -254,19 +255,19 @@ class CreditRecalculateService
$foreignCurrency = $transaction->foreignCurrency; $foreignCurrency = $transaction->foreignCurrency;
$accountCurrency = $this->repository->getAccountCurrency($account); $accountCurrency = $this->repository->getAccountCurrency($account);
$type = $journal->transactionType->type; $type = $journal->transactionType->type;
app('log')->debug(sprintf('Left of debt is: %s', app('steam')->bcround($leftOfDebt, 2))); // Log::debug(sprintf('Left of debt is: %s', app('steam')->bcround($leftOfDebt, 2)));
if ('' === $direction) { if ('' === $direction) {
app('log')->warning('Direction is empty, so do nothing.'); // Log::warning('Direction is empty, so do nothing.');
return $leftOfDebt; return $leftOfDebt;
} }
if (TransactionType::LIABILITY_CREDIT === $type || TransactionType::OPENING_BALANCE === $type) { if (TransactionTypeEnum::LIABILITY_CREDIT->value === $type || TransactionTypeEnum::OPENING_BALANCE->value === $type) {
app('log')->warning(sprintf('Transaction type is "%s", so do nothing.', $type)); Log::warning(sprintf('Transaction type is "%s", so do nothing.', $type));
return $leftOfDebt; return $leftOfDebt;
} }
Log::debug(sprintf('Liability direction is "%s"', $direction)); // Log::debug(sprintf('Liability direction is "%s"', $direction));
// amount to use depends on the currency: // amount to use depends on the currency:
$usedAmount = $this->getAmountToUse($transaction, $accountCurrency, $foreignCurrency); $usedAmount = $this->getAmountToUse($transaction, $accountCurrency, $foreignCurrency);
@@ -277,7 +278,7 @@ class CreditRecalculateService
if ($isSameAccount && $isCredit && $this->isWithdrawalIn($usedAmount, $type)) { // case 1 if ($isSameAccount && $isCredit && $this->isWithdrawalIn($usedAmount, $type)) { // case 1
$usedAmount = app('steam')->positive($usedAmount); $usedAmount = app('steam')->positive($usedAmount);
$result = bcadd($leftOfDebt, $usedAmount); $result = bcadd($leftOfDebt, $usedAmount);
app('log')->debug(sprintf('Case 1 (withdrawal into credit liability): %s + %s = %s', app('steam')->bcround($leftOfDebt, 2), app('steam')->bcround($usedAmount, 2), app('steam')->bcround($result, 2))); // Log::debug(sprintf('Case 1 (withdrawal into credit liability): %s + %s = %s', app('steam')->bcround($leftOfDebt, 2), app('steam')->bcround($usedAmount, 2), app('steam')->bcround($result, 2)));
return $result; return $result;
} }
@@ -285,7 +286,7 @@ class CreditRecalculateService
if ($isSameAccount && $isCredit && $this->isWithdrawalOut($usedAmount, $type)) { // case 2 if ($isSameAccount && $isCredit && $this->isWithdrawalOut($usedAmount, $type)) { // case 2
$usedAmount = app('steam')->positive($usedAmount); $usedAmount = app('steam')->positive($usedAmount);
$result = bcsub($leftOfDebt, $usedAmount); $result = bcsub($leftOfDebt, $usedAmount);
app('log')->debug(sprintf('Case 2 (withdrawal away from liability): %s - %s = %s', app('steam')->bcround($leftOfDebt, 2), app('steam')->bcround($usedAmount, 2), app('steam')->bcround($result, 2))); // Log::debug(sprintf('Case 2 (withdrawal away from liability): %s - %s = %s', app('steam')->bcround($leftOfDebt, 2), app('steam')->bcround($usedAmount, 2), app('steam')->bcround($result, 2)));
return $result; return $result;
} }
@@ -293,7 +294,7 @@ class CreditRecalculateService
if ($isSameAccount && $isCredit && $this->isDepositOut($usedAmount, $type)) { // case 3 if ($isSameAccount && $isCredit && $this->isDepositOut($usedAmount, $type)) { // case 3
$usedAmount = app('steam')->positive($usedAmount); $usedAmount = app('steam')->positive($usedAmount);
$result = bcsub($leftOfDebt, $usedAmount); $result = bcsub($leftOfDebt, $usedAmount);
app('log')->debug(sprintf('Case 3 (deposit away from liability): %s - %s = %s', app('steam')->bcround($leftOfDebt, 2), app('steam')->bcround($usedAmount, 2), app('steam')->bcround($result, 2))); // Log::debug(sprintf('Case 3 (deposit away from liability): %s - %s = %s', app('steam')->bcround($leftOfDebt, 2), app('steam')->bcround($usedAmount, 2), app('steam')->bcround($result, 2)));
return $result; return $result;
} }
@@ -301,35 +302,35 @@ class CreditRecalculateService
if ($isSameAccount && $isCredit && $this->isDepositIn($usedAmount, $type)) { // case 4 if ($isSameAccount && $isCredit && $this->isDepositIn($usedAmount, $type)) { // case 4
$usedAmount = app('steam')->positive($usedAmount); $usedAmount = app('steam')->positive($usedAmount);
$result = bcadd($leftOfDebt, $usedAmount); $result = bcadd($leftOfDebt, $usedAmount);
app('log')->debug(sprintf('Case 4 (deposit into credit liability): %s + %s = %s', app('steam')->bcround($leftOfDebt, 2), app('steam')->bcround($usedAmount, 2), app('steam')->bcround($result, 2))); // Log::debug(sprintf('Case 4 (deposit into credit liability): %s + %s = %s', app('steam')->bcround($leftOfDebt, 2), app('steam')->bcround($usedAmount, 2), app('steam')->bcround($result, 2)));
return $result; return $result;
} }
if ($isSameAccount && $isCredit && $this->isTransferIn($usedAmount, $type)) { // case 5 if ($isSameAccount && $isCredit && $this->isTransferIn($usedAmount, $type)) { // case 5
$usedAmount = app('steam')->positive($usedAmount); $usedAmount = app('steam')->positive($usedAmount);
$result = bcadd($leftOfDebt, $usedAmount); $result = bcadd($leftOfDebt, $usedAmount);
app('log')->debug(sprintf('Case 5 (transfer into credit liability): %s + %s = %s', app('steam')->bcround($leftOfDebt, 2), app('steam')->bcround($usedAmount, 2), app('steam')->bcround($result, 2))); // Log::debug(sprintf('Case 5 (transfer into credit liability): %s + %s = %s', app('steam')->bcround($leftOfDebt, 2), app('steam')->bcround($usedAmount, 2), app('steam')->bcround($result, 2)));
return $result; return $result;
} }
if ($isSameAccount && $isDebit && $this->isWithdrawalIn($usedAmount, $type)) { // case 6 if ($isSameAccount && $isDebit && $this->isWithdrawalIn($usedAmount, $type)) { // case 6
$usedAmount = app('steam')->positive($usedAmount); $usedAmount = app('steam')->positive($usedAmount);
$result = bcsub($leftOfDebt, $usedAmount); $result = bcsub($leftOfDebt, $usedAmount);
app('log')->debug(sprintf('Case 6 (withdrawal into debit liability): %s - %s = %s', app('steam')->bcround($leftOfDebt, 2), app('steam')->bcround($usedAmount, 2), app('steam')->bcround($result, 2))); // Log::debug(sprintf('Case 6 (withdrawal into debit liability): %s - %s = %s', app('steam')->bcround($leftOfDebt, 2), app('steam')->bcround($usedAmount, 2), app('steam')->bcround($result, 2)));
return $result; return $result;
} }
if ($isSameAccount && $isDebit && $this->isDepositOut($usedAmount, $type)) { // case 7 if ($isSameAccount && $isDebit && $this->isDepositOut($usedAmount, $type)) { // case 7
$usedAmount = app('steam')->positive($usedAmount); $usedAmount = app('steam')->positive($usedAmount);
$result = bcadd($leftOfDebt, $usedAmount); $result = bcadd($leftOfDebt, $usedAmount);
app('log')->debug(sprintf('Case 7 (deposit away from liability): %s + %s = %s', app('steam')->bcround($leftOfDebt, 2), app('steam')->bcround($usedAmount, 2), app('steam')->bcround($result, 2))); // Log::debug(sprintf('Case 7 (deposit away from liability): %s + %s = %s', app('steam')->bcround($leftOfDebt, 2), app('steam')->bcround($usedAmount, 2), app('steam')->bcround($result, 2)));
return $result; return $result;
} }
if ($isSameAccount && $isDebit && $this->isWithdrawalOut($usedAmount, $type)) { // case 8 if ($isSameAccount && $isDebit && $this->isWithdrawalOut($usedAmount, $type)) { // case 8
$usedAmount = app('steam')->positive($usedAmount); $usedAmount = app('steam')->positive($usedAmount);
$result = bcadd($leftOfDebt, $usedAmount); $result = bcadd($leftOfDebt, $usedAmount);
app('log')->debug(sprintf('Case 8 (withdrawal away from liability): %s + %s = %s', app('steam')->bcround($leftOfDebt, 2), app('steam')->bcround($usedAmount, 2), app('steam')->bcround($result, 2))); // Log::debug(sprintf('Case 8 (withdrawal away from liability): %s + %s = %s', app('steam')->bcround($leftOfDebt, 2), app('steam')->bcround($usedAmount, 2), app('steam')->bcround($result, 2)));
return $result; return $result;
} }
@@ -338,7 +339,7 @@ class CreditRecalculateService
$usedAmount = app('steam')->positive($usedAmount); $usedAmount = app('steam')->positive($usedAmount);
$result = bcsub($leftOfDebt, $usedAmount); $result = bcsub($leftOfDebt, $usedAmount);
// 2024-10-05, #9225 this used to say you would owe more, but a transfer INTO a debit from wherever means you owe LESS. // 2024-10-05, #9225 this used to say you would owe more, but a transfer INTO a debit from wherever means you owe LESS.
app('log')->debug(sprintf('Case 9 (transfer into debit liability, means you owe LESS): %s - %s = %s', app('steam')->bcround($leftOfDebt, 2), app('steam')->bcround($usedAmount, 2), app('steam')->bcround($result, 2))); // Log::debug(sprintf('Case 9 (transfer into debit liability, means you owe LESS): %s - %s = %s', app('steam')->bcround($leftOfDebt, 2), app('steam')->bcround($usedAmount, 2), app('steam')->bcround($result, 2)));
return $result; return $result;
} }
@@ -346,7 +347,7 @@ class CreditRecalculateService
$usedAmount = app('steam')->positive($usedAmount); $usedAmount = app('steam')->positive($usedAmount);
$result = bcadd($leftOfDebt, $usedAmount); $result = bcadd($leftOfDebt, $usedAmount);
// 2024-10-05, #9225 this used to say you would owe less, but a transfer OUT OF a debit from wherever means you owe MORE. // 2024-10-05, #9225 this used to say you would owe less, but a transfer OUT OF a debit from wherever means you owe MORE.
app('log')->debug(sprintf('Case 10 (transfer out of debit liability, means you owe MORE): %s + %s = %s', app('steam')->bcround($leftOfDebt, 2), app('steam')->bcround($usedAmount, 2), app('steam')->bcround($result, 2))); // Log::debug(sprintf('Case 10 (transfer out of debit liability, means you owe MORE): %s + %s = %s', app('steam')->bcround($leftOfDebt, 2), app('steam')->bcround($usedAmount, 2), app('steam')->bcround($result, 2)));
return $result; return $result;
} }
@@ -355,12 +356,12 @@ class CreditRecalculateService
if (in_array($type, [TransactionType::WITHDRAWAL, TransactionType::DEPOSIT, TransactionType::TRANSFER], true)) { if (in_array($type, [TransactionType::WITHDRAWAL, TransactionType::DEPOSIT, TransactionType::TRANSFER], true)) {
$usedAmount = app('steam')->negative($usedAmount); $usedAmount = app('steam')->negative($usedAmount);
$result = bcadd($leftOfDebt, $usedAmount); $result = bcadd($leftOfDebt, $usedAmount);
app('log')->debug(sprintf('Case X (all other cases): %s + %s = %s', app('steam')->bcround($leftOfDebt, 2), app('steam')->bcround($usedAmount, 2), app('steam')->bcround($result, 2))); // Log::debug(sprintf('Case X (all other cases): %s + %s = %s', app('steam')->bcround($leftOfDebt, 2), app('steam')->bcround($usedAmount, 2), app('steam')->bcround($result, 2)));
return $result; return $result;
} }
app('log')->warning(sprintf('[-1] Catch-all, should not happen. Left of debt = %s', app('steam')->bcround($leftOfDebt, 2))); Log::warning(sprintf('[-1] Catch-all, should not happen. Left of debt = %s', app('steam')->bcround($leftOfDebt, 2)));
return $leftOfDebt; return $leftOfDebt;
} }
@@ -368,10 +369,10 @@ class CreditRecalculateService
private function getAmountToUse(Transaction $transaction, TransactionCurrency $accountCurrency, ?TransactionCurrency $foreignCurrency): string private function getAmountToUse(Transaction $transaction, TransactionCurrency $accountCurrency, ?TransactionCurrency $foreignCurrency): string
{ {
$usedAmount = $transaction->amount; $usedAmount = $transaction->amount;
app('log')->debug(sprintf('Amount of transaction is %s', app('steam')->bcround($usedAmount, 2))); // Log::debug(sprintf('Amount of transaction is %s', app('steam')->bcround($usedAmount, 2)));
if (null !== $foreignCurrency && $foreignCurrency->id === $accountCurrency->id) { if (null !== $foreignCurrency && $foreignCurrency->id === $accountCurrency->id) {
$usedAmount = $transaction->foreign_amount; $usedAmount = $transaction->foreign_amount;
app('log')->debug(sprintf('Overruled by foreign amount. Amount of transaction is now %s', app('steam')->bcround($usedAmount, 2))); // Log::debug(sprintf('Overruled by foreign amount. Amount of transaction is now %s', app('steam')->bcround($usedAmount, 2)));
} }
return $usedAmount; return $usedAmount;