cleanup: Commands are a lot less verbal and report better on success / failue

This commit is contained in:
James Cole
2023-06-02 07:36:17 +02:00
parent 1e1497ff4e
commit dcf71c6fdf
60 changed files with 1108 additions and 1698 deletions

View File

@@ -33,18 +33,8 @@ use Illuminate\Support\Facades\Log;
*/
class TransferBudgets extends Command
{
/**
* The console command description.
*
* @var string
*/
protected $description = 'Removes budgets from transfers.';
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'firefly-iii:fix-transfer-budgets';
protected $signature = 'firefly-iii:fix-transfer-budgets';
/**
* Execute the console command.
@@ -53,7 +43,6 @@ class TransferBudgets extends Command
*/
public function handle(): int
{
$start = microtime(true);
$set = TransactionJournal::distinct()
->leftJoin('transaction_types', 'transaction_types.id', '=', 'transaction_journals.transaction_type_id')
->leftJoin('budget_transaction_journal', 'transaction_journals.id', '=', 'budget_transaction_journal.transaction_journal_id')
@@ -69,8 +58,7 @@ class TransferBudgets extends Command
$count++;
}
if (0 === $count) {
$message = 'No invalid budget/journal entries.';
Log::debug($message);
$message = 'Correct: no invalid budget/journal entries.';
$this->info($message);
}
if (0 !== $count) {
@@ -78,9 +66,6 @@ class TransferBudgets extends Command
Log::debug($message);
$this->line($message);
}
$end = round(microtime(true) - $start, 2);
$this->info(sprintf('Verified budget/journals in %s seconds.', $end));
return 0;
}
}