mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-01-07 06:31:22 +00:00
Optimize currency search.
This commit is contained in:
@@ -142,7 +142,7 @@ class PiggyBankEnrichment implements EnrichmentInterface
|
||||
$accountId = (int)$item->account_id;
|
||||
$currencyId = (int)$item->data;
|
||||
if (!array_key_exists($currencyId, $this->currencies)) {
|
||||
$this->currencies[$currencyId] = TransactionCurrency::find($currencyId);
|
||||
$this->currencies[$currencyId] = Amount::getTransactionCurrencyById($currencyId);
|
||||
}
|
||||
// $this->accountCurrencies[$accountId] = $this->currencies[$currencyId];
|
||||
}
|
||||
|
||||
@@ -121,7 +121,7 @@ class PiggyBankEventEnrichment implements EnrichmentInterface
|
||||
$accountId = (int)$item->account_id;
|
||||
$currencyId = (int)$item->data;
|
||||
if (!array_key_exists($currencyId, $this->currencies)) {
|
||||
$this->currencies[$currencyId] = TransactionCurrency::find($currencyId);
|
||||
$this->currencies[$currencyId] = Amount::getTransactionCurrencyById($currencyId);
|
||||
}
|
||||
$this->accountCurrencies[$accountId] = $this->currencies[$currencyId];
|
||||
}
|
||||
|
||||
@@ -321,7 +321,7 @@ class SubscriptionEnrichment implements EnrichmentInterface
|
||||
if ($this->convertToPrimary && null !== $entry->foreign_currency_id && (int)$entry->foreign_currency_id !== $this->primaryCurrency->id) {
|
||||
// TODO this is very database intensive.
|
||||
/** @var TransactionCurrency $foreignCurrency */
|
||||
$foreignCurrency = TransactionCurrency::find($entry->foreign_currency_id);
|
||||
$foreignCurrency = Amount::getTransactionCurrencyById($entry->foreign_currency_id);
|
||||
$array['pc_foreign_amount'] = $converter->convert($foreignCurrency, $this->primaryCurrency, $entry->date, $entry->amount);
|
||||
}
|
||||
$result[] = $array;
|
||||
|
||||
Reference in New Issue
Block a user