fix: correct date filtering logic in get_all method of ExchangeRateService
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user