Small change in conversion

This commit is contained in:
James Cole 2022-06-10 17:39:00 +02:00
parent 5a02006a42
commit 70ddbd743c
No known key found for this signature in database
GPG Key ID: B49A324B7EAD6D80

View File

@ -63,10 +63,10 @@ trait ConvertsExchangeRates
$return = []; $return = [];
/** @var array $entry */ /** @var array $entry */
foreach ($entries as $entry) { foreach ($entries as $entry) {
$currency = $this->getCurrency((int) $entry['id']); $currency = $this->getCurrency((int) $entry['id']);
$entry['converted'] = true;
if ($currency->id !== $native->id) { if ($currency->id !== $native->id) {
$amount = $this->convertAmount($entry['sum'], $currency, $native); $amount = $this->convertAmount($entry['sum'], $currency, $native);
$entry['converted'] = true;
$entry['native_sum'] = $amount; $entry['native_sum'] = $amount;
$entry['native_id'] = (string) $native->id; $entry['native_id'] = (string) $native->id;
$entry['native_name'] = $native->name; $entry['native_name'] = $native->name;
@ -75,6 +75,7 @@ trait ConvertsExchangeRates
$entry['native_decimal_places'] = $native->decimal_places; $entry['native_decimal_places'] = $native->decimal_places;
} }
if ($currency->id === $native->id) { if ($currency->id === $native->id) {
$entry['converted'] = false;
$entry['native_sum'] = $entry['sum']; $entry['native_sum'] = $entry['sum'];
$entry['native_id'] = (string) $native->id; $entry['native_id'] = (string) $native->id;
$entry['native_name'] = $native->name; $entry['native_name'] = $native->name;