From 48e548eb52b6a0b41db482e0019f72fe759ba35f Mon Sep 17 00:00:00 2001 From: James Cole Date: Sun, 30 Jun 2024 18:20:52 +0200 Subject: [PATCH] Better disable thing. --- app/Support/Http/Api/ExchangeRateConverter.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/app/Support/Http/Api/ExchangeRateConverter.php b/app/Support/Http/Api/ExchangeRateConverter.php index 05fa2e001d..9b1004845d 100644 --- a/app/Support/Http/Api/ExchangeRateConverter.php +++ b/app/Support/Http/Api/ExchangeRateConverter.php @@ -48,6 +48,9 @@ class ExchangeRateConverter */ public function convert(TransactionCurrency $from, TransactionCurrency $to, Carbon $date, string $amount): string { + if(false === config('cer.enabled')) { + return $amount; + } Log::debug('convert()'); $rate = $this->getCurrencyRate($from, $to, $date); @@ -59,6 +62,9 @@ class ExchangeRateConverter */ public function getCurrencyRate(TransactionCurrency $from, TransactionCurrency $to, Carbon $date): string { + if(false === config('cer.enabled')) { + return '1'; + } Log::debug('getCurrencyRate()'); $rate = $this->getRate($from, $to, $date); @@ -233,6 +239,9 @@ class ExchangeRateConverter */ public function prepare(TransactionCurrency $from, TransactionCurrency $to, Carbon $start, Carbon $end): void { + if(false === config('cer.enabled')) { + return; + } Log::debug('prepare()'); $start->startOfDay(); $end->endOfDay(); @@ -305,6 +314,9 @@ class ExchangeRateConverter public function summarize(): void { + if(false === config('cer.enabled')) { + return; + } Log::debug(sprintf('ExchangeRateConverter ran %d queries.', $this->queryCount)); } }