Ensure consistent ordering by date and ISO code

This commit is contained in:
Hakan Ensari 2024-11-20 14:58:17 +01:00
parent 4ce9e46f92
commit 418d684343
No known key found for this signature in database

View File

@ -15,7 +15,6 @@ class Day < Sequel::Model
interval.begin, interval.begin,
)) ))
.where(Sequel.expr(:date) <= interval.end) .where(Sequel.expr(:date) <= interval.end)
.order(Sequel.asc(:date))
end end
def currencies def currencies
@ -25,6 +24,7 @@ class Day < Sequel::Model
Sequel.lit("rates.value::text::float").as(:rate), Sequel.lit("rates.value::text::float").as(:rate),
) )
.join(Sequel.function(:jsonb_each, :rates).lateral.as(:rates), true) .join(Sequel.function(:jsonb_each, :rates).lateral.as(:rates), true)
.order(Sequel.asc(:date), Sequel.asc(Sequel.lit("rates.key")))
end end
def _nearest_date_with_rates(date) def _nearest_date_with_rates(date)