mirror of
https://github.com/hakanensari/frankfurter.git
synced 2024-11-25 04:22:28 +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]
|
||||
### Changed
|
||||
- Sample weekly when querying over 365 days
|
||||
- Sample weekly when querying over a year
|
||||
- Bump PostgreSQL to 12
|
||||
|
||||
## 1.0.0 - 2020-01-02
|
||||
|
@ -17,7 +17,7 @@ class Currency < Sequel::Model(Day.currencies)
|
||||
|
||||
def between(interval)
|
||||
case interval.last - interval.first
|
||||
when 91.. then super.sample('week')
|
||||
when 366.. then super.sample('week')
|
||||
else super
|
||||
end
|
||||
end
|
||||
|
@ -16,14 +16,14 @@ describe Currency do
|
||||
Date.parse('2010-01-01')
|
||||
end
|
||||
|
||||
it 'returns everything up to 90 days' do
|
||||
interval = day..day + 90
|
||||
Currency.between(interval).map(:date).uniq.count.must_be :>, 30
|
||||
it 'returns everything up to a year' do
|
||||
interval = day..day + 365
|
||||
Currency.between(interval).map(:date).uniq.count.must_be :>, 52
|
||||
end
|
||||
|
||||
it 'samples weekly over 90 days' do
|
||||
interval = day..day + 365
|
||||
Currency.between(interval).map(:date).uniq.count.must_be :<=, 52
|
||||
it 'samples weekly over a year' do
|
||||
interval = day..day + 366
|
||||
Currency.between(interval).map(:date).uniq.count.must_be :<, 54
|
||||
end
|
||||
|
||||
it 'sorts by date' do
|
||||
|
Loading…
Reference in New Issue
Block a user