dfdsf
All checks were successful
Deploy / deploy-staging (push) Successful in 6s
Deploy / deploy-production (push) Has been skipped

This commit is contained in:
2026-05-02 01:25:54 +02:00
parent c098413e23
commit 7ad4b45d22

View File

@@ -267,37 +267,6 @@ final class FxRatesService
return []; return [];
} }
$direct = $this->repository->listDirectHistory($fromCurrency, $toCurrency, $this->normalizeTimestamp($from), $this->normalizeTimestamp($to), $limit);
if ($direct !== []) {
return array_map(fn (array $row): array => $this->localizeRateResult($row), $direct);
}
$inverse = $this->repository->listDirectHistory($toCurrency, $fromCurrency, $this->normalizeTimestamp($from), $this->normalizeTimestamp($to), $limit);
if ($inverse !== []) {
$result = [];
foreach ($inverse as $row) {
$inverseRate = is_numeric($row['rate'] ?? null) ? (float) $row['rate'] : null;
if ($inverseRate === null || $inverseRate <= 0) {
continue;
}
$result[] = [
'fetch_id' => $row['fetch_id'] ?? null,
'base_currency' => $fromCurrency,
'target_currency' => $toCurrency,
'rate' => 1 / $inverseRate,
'rate_date' => $row['rate_date'] ?? null,
'provider' => $row['provider'] ?? null,
'fetched_at' => $row['fetched_at'] ?? null,
'is_exact_pair' => false,
];
}
if ($result !== []) {
return array_map(fn (array $row): array => $this->localizeRateResult($row), $result);
}
}
return $this->crossHistory($fromCurrency, $toCurrency, $from, $to, $limit); return $this->crossHistory($fromCurrency, $toCurrency, $from, $to, $limit);
} }