Commit 573770c8 authored by David F.'s avatar David F.

Merge branch '97-liste-saisons-disponibles-e02' into 'master'

Fixes issue when time between min date and max date less than one year: refs #97.

See merge request !97
parents 555cb9c2 481eac05
......@@ -54,6 +54,8 @@ class Season
date += 1.year
break if date > max_date
end
seasons << self.new(max_date).short_label
seasons.uniq!
end
end
......
......@@ -128,8 +128,7 @@ RSpec.describe Season, type: :model do
it "based on :begin_at if no field provided" do
# Given
create :event, begin_at: Date.new(2017,4,1)
create :event, begin_at: Date.new(2017,9,1)
create :event, begin_at: Date.new(2018,8,31)
create :event, begin_at: Date.new(2018,3,31)
expected = ["2016-2017","2017-2018"]
# When
result = Season.all(Event)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment