fix: correct date filtering logic in get_all method of ExchangeRateService

This commit is contained in:
AlexeerCT
2026-01-07 11:46:02 -06:00
parent 8cdcc369bb
commit b56c56d96d

View File

@@ -35,15 +35,15 @@ class ExchangeRateService:
date_val = datetime.strptime(date_str, "%Y-%m-%d").date()
start_date = datetime.combine(date_val, time.min)
end_date = datetime.combine(date_val, time.max)
query = query.filter(
models.ExchangeRate.date >= start_date,
models.ExchangeRate.date <= end_date
models.ExchangeRate.date <= end_date,
)
except (ValueError, TypeError):
# Fallback to cast if date format is invalid or logic fails, though validation should catch this
query = query.filter(
cast(models.ExchangeRate.date, Date) == filters["date"]
cast(models.ExchangeRate.date, Date) == filters["date"]
)
if filters.get("local_currency"):
query = query.filter(