From 9b6314066bec8295c2a24c361972da4bdc14f65d Mon Sep 17 00:00:00 2001 From: James Cole Date: Sun, 11 May 2025 07:23:35 +0200 Subject: [PATCH] Clean up logs. --- app/Console/Commands/Correction/CorrectsUnevenAmount.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/app/Console/Commands/Correction/CorrectsUnevenAmount.php b/app/Console/Commands/Correction/CorrectsUnevenAmount.php index 981c8f6596..91e8d18d37 100644 --- a/app/Console/Commands/Correction/CorrectsUnevenAmount.php +++ b/app/Console/Commands/Correction/CorrectsUnevenAmount.php @@ -77,8 +77,6 @@ class CorrectsUnevenAmount extends Command ->whereNotNull('foreign_amount')->get(['transactions.transaction_journal_id']); $count = 0; - Log::debug(sprintf('Found %d potential journal(s)', $transactions->count())); - /** @var Transaction $transaction */ foreach ($transactions as $transaction) { /** @var null|TransactionJournal $journal */ @@ -120,6 +118,10 @@ class CorrectsUnevenAmount extends Command ++$count; } } + if (0 === $count) { + return; + } + $this->friendlyPositive(sprintf('Fixed %d transfer(s) with unbalanced amounts.', $count)); } private function fixUnevenAmounts(): void @@ -343,8 +345,6 @@ class CorrectsUnevenAmount extends Command ->whereIn('account_types.type', [AccountTypeEnum::ASSET->value, AccountTypeEnum::DEBT->value, AccountTypeEnum::MORTGAGE->value, AccountTypeEnum::LOAN->value]) ->get(['transactions.transaction_journal_id']); - Log::debug(sprintf('Found %d potential journal(s)', $transactions->count())); - /** @var Transaction $transaction */ foreach ($transactions as $transaction) { /** @var null|TransactionJournal $journal */ @@ -359,7 +359,6 @@ class CorrectsUnevenAmount extends Command continue; } - Log::debug(sprintf('Potential fix for #%d', $journal->id)); $source = $journal->transactions()->where('amount', '<', 0)->first(); $destination = $journal->transactions()->where('amount', '>', 0)->first(); if (null === $source || null === $destination) {