mirror of
https://github.com/hakanensari/frankfurter.git
synced 2024-11-22 11:02:30 +01:00
Fix 24b5435
This commit is contained in:
parent
ec302e726c
commit
2e83b9d50d
@ -4,7 +4,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
### Changed
|
### Changed
|
||||||
- Sample weekly when querying over 365 days
|
- Sample weekly when querying over a year
|
||||||
- Bump PostgreSQL to 12
|
- Bump PostgreSQL to 12
|
||||||
|
|
||||||
## 1.0.0 - 2020-01-02
|
## 1.0.0 - 2020-01-02
|
||||||
|
@ -17,7 +17,7 @@ class Currency < Sequel::Model(Day.currencies)
|
|||||||
|
|
||||||
def between(interval)
|
def between(interval)
|
||||||
case interval.last - interval.first
|
case interval.last - interval.first
|
||||||
when 91.. then super.sample('week')
|
when 366.. then super.sample('week')
|
||||||
else super
|
else super
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -16,14 +16,14 @@ describe Currency do
|
|||||||
Date.parse('2010-01-01')
|
Date.parse('2010-01-01')
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'returns everything up to 90 days' do
|
it 'returns everything up to a year' do
|
||||||
interval = day..day + 90
|
interval = day..day + 365
|
||||||
Currency.between(interval).map(:date).uniq.count.must_be :>, 30
|
Currency.between(interval).map(:date).uniq.count.must_be :>, 52
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'samples weekly over 90 days' do
|
it 'samples weekly over a year' do
|
||||||
interval = day..day + 365
|
interval = day..day + 366
|
||||||
Currency.between(interval).map(:date).uniq.count.must_be :<=, 52
|
Currency.between(interval).map(:date).uniq.count.must_be :<, 54
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'sorts by date' do
|
it 'sorts by date' do
|
||||||
|
Loading…
Reference in New Issue
Block a user