From 98358f75787004f5f1fa27bd86ed2bd1ab46d2ef Mon Sep 17 00:00:00 2001 From: James Cole Date: Wed, 13 Oct 2021 05:44:17 +0200 Subject: [PATCH] Drop some log lines. --- app/Handlers/Events/UserEventHandler.php | 3 ++- app/Helpers/Report/NetWorth.php | 12 ++++++------ app/Repositories/Bill/BillRepository.php | 18 +++++++++--------- 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/app/Handlers/Events/UserEventHandler.php b/app/Handlers/Events/UserEventHandler.php index 279dc95fb3..35d5df3262 100644 --- a/app/Handlers/Events/UserEventHandler.php +++ b/app/Handlers/Events/UserEventHandler.php @@ -323,6 +323,7 @@ class UserEventHandler */ public function storeUserIPAddress(Login $event): void { + Log::debug('Now in storeUserIPAddress'); /** @var User $user */ $user = $event->user; /** @var array $preference */ @@ -336,7 +337,7 @@ class UserEventHandler } $inArray = false; $ip = request()->ip(); - Log::debug(sprintf('User logging in from IP address %s', $ip)); + Log::debug(sprintf('User logging in from IP address %s using guard "%s"', $ip, $event->guard)); // update array if in array foreach ($preference as $index => $row) { diff --git a/app/Helpers/Report/NetWorth.php b/app/Helpers/Report/NetWorth.php index da485d5ca8..c0e5318f1d 100644 --- a/app/Helpers/Report/NetWorth.php +++ b/app/Helpers/Report/NetWorth.php @@ -79,7 +79,7 @@ class NetWorth implements NetWorthInterface $netWorth = []; $result = []; - Log::debug(sprintf('Now in getNetWorthByCurrency(%s)', $date->format('Y-m-d'))); + //Log::debug(sprintf('Now in getNetWorthByCurrency(%s)', $date->format('Y-m-d'))); // get default currency $default = app('amount')->getDefaultCurrencyByUser($this->user); @@ -90,16 +90,16 @@ class NetWorth implements NetWorthInterface // get the preferred currency for this account /** @var Account $account */ foreach ($accounts as $account) { - Log::debug(sprintf('Now at account #%d: "%s"', $account->id, $account->name)); + //Log::debug(sprintf('Now at account #%d: "%s"', $account->id, $account->name)); $currencyId = (int)$this->accountRepository->getMetaValue($account, 'currency_id'); $currencyId = 0 === $currencyId ? $default->id : $currencyId; - Log::debug(sprintf('Currency ID is #%d', $currencyId)); + //Log::debug(sprintf('Currency ID is #%d', $currencyId)); // balance in array: $balance = $balances[$account->id] ?? '0'; - Log::debug(sprintf('Balance is %s', $balance)); + //Log::debug(sprintf('Balance is %s', $balance)); // always subtract virtual balance. $virtualBalance = (string)$account->virtual_balance; @@ -107,14 +107,14 @@ class NetWorth implements NetWorthInterface $balance = bcsub($balance, $virtualBalance); } - Log::debug(sprintf('Balance corrected to %s because of virtual balance (%s)', $balance, $virtualBalance)); + //Log::debug(sprintf('Balance corrected to %s because of virtual balance (%s)', $balance, $virtualBalance)); if (!array_key_exists($currencyId, $netWorth)) { $netWorth[$currencyId] = '0'; } $netWorth[$currencyId] = bcadd($balance, $netWorth[$currencyId]); - Log::debug(sprintf('Total net worth for currency #%d is %s', $currencyId, $netWorth[$currencyId])); + //Log::debug(sprintf('Total net worth for currency #%d is %s', $currencyId, $netWorth[$currencyId])); } ksort($netWorth); diff --git a/app/Repositories/Bill/BillRepository.php b/app/Repositories/Bill/BillRepository.php index 3edc745aaa..188007cd12 100644 --- a/app/Repositories/Bill/BillRepository.php +++ b/app/Repositories/Bill/BillRepository.php @@ -251,7 +251,7 @@ class BillRepository implements BillRepositoryInterface $journalIds = $set->pluck('id')->toArray(); $amount = (string)Transaction::whereIn('transaction_journal_id', $journalIds)->where('amount', '<', 0)->sum('amount'); $sum = bcadd($sum, $amount); - Log::debug(sprintf('Total > 0, so add to sum %f, which becomes %f', $amount, $sum)); + //Log::debug(sprintf('Total > 0, so add to sum %f, which becomes %f', $amount, $sum)); } } @@ -281,7 +281,7 @@ class BillRepository implements BillRepositoryInterface $amount = (string)Transaction::whereIn('transaction_journal_id', $journalIds)->where('amount', '<', 0)->sum('amount'); $return[$currencyId] = $return[$currencyId] ?? '0'; $return[$currencyId] = bcadd($amount, $return[$currencyId]); - Log::debug(sprintf('Total > 0, so add to sum %f, which becomes %f (currency %d)', $amount, $return[$currencyId], $currencyId)); + //Log::debug(sprintf('Total > 0, so add to sum %f, which becomes %f (currency %d)', $amount, $return[$currencyId], $currencyId)); } } @@ -302,18 +302,18 @@ class BillRepository implements BillRepositoryInterface $sum = '0'; /** @var Bill $bill */ foreach ($bills as $bill) { - Log::debug(sprintf('Now at bill #%d (%s)', $bill->id, $bill->name)); + //Log::debug(sprintf('Now at bill #%d (%s)', $bill->id, $bill->name)); $dates = $this->getPayDatesInRange($bill, $start, $end); $count = $bill->transactionJournals()->after($start)->before($end)->count(); $total = $dates->count() - $count; - Log::debug(sprintf('Dates = %d, journalCount = %d, total = %d', $dates->count(), $count, $total)); + //Log::debug(sprintf('Dates = %d, journalCount = %d, total = %d', $dates->count(), $count, $total)); if ($total > 0) { $average = bcdiv(bcadd($bill->amount_max, $bill->amount_min), '2'); $multi = bcmul($average, (string)$total); $sum = bcadd($sum, $multi); - Log::debug(sprintf('Total > 0, so add to sum %f, which becomes %f', $multi, $sum)); + //Log::debug(sprintf('Total > 0, so add to sum %f, which becomes %f', $multi, $sum)); } } @@ -334,20 +334,20 @@ class BillRepository implements BillRepositoryInterface $return = []; /** @var Bill $bill */ foreach ($bills as $bill) { - Log::debug(sprintf('Now at bill #%d (%s)', $bill->id, $bill->name)); + //Log::debug(sprintf('Now at bill #%d (%s)', $bill->id, $bill->name)); $dates = $this->getPayDatesInRange($bill, $start, $end); $count = $bill->transactionJournals()->after($start)->before($end)->count(); $total = $dates->count() - $count; $currencyId = (int)$bill->transaction_currency_id; - Log::debug(sprintf('Dates = %d, journalCount = %d, total = %d', $dates->count(), $count, $total)); + //Log::debug(sprintf('Dates = %d, journalCount = %d, total = %d', $dates->count(), $count, $total)); if ($total > 0) { $average = bcdiv(bcadd($bill->amount_max, $bill->amount_min), '2'); $multi = bcmul($average, (string)$total); $return[$currencyId] = $return[$currencyId] ?? '0'; $return[$currencyId] = bcadd($return[$currencyId], $multi); - Log::debug(sprintf('Total > 0, so add to sum %f, which becomes %f (for currency %d)', $multi, $return[$currencyId], $currencyId)); + //Log::debug(sprintf('Total > 0, so add to sum %f, which becomes %f (for currency %d)', $multi, $return[$currencyId], $currencyId)); } } @@ -481,7 +481,7 @@ class BillRepository implements BillRepositoryInterface //Log::debug(sprintf('First currentstart is %s', $currentStart->format('Y-m-d'))); while ($currentStart <= $end) { - Log::debug(sprintf('Currentstart is now %s.', $currentStart->format('Y-m-d'))); + //Log::debug(sprintf('Currentstart is now %s.', $currentStart->format('Y-m-d'))); $nextExpectedMatch = $this->nextDateMatch($bill, $currentStart); //Log::debug(sprintf('Next Date match after %s is %s', $currentStart->format('Y-m-d'), $nextExpectedMatch->format('Y-m-d'))); if ($nextExpectedMatch > $end) {// If nextExpectedMatch is after end, we continue