-
Notifications
You must be signed in to change notification settings - Fork 362
Closed
Labels
Description
I'm not sure what's going one here, but it doesn't seem like next_occurrences
is obeying this recurring rule logic:
hash = {"validations"=>{"day"=>[]}, "rule_type"=>"IceCube::WeeklyRule", "interval"=>2, "until"=>nil, "count"=>nil}
So I turn the hash into an IceCube rule...
$ rule = IceCube::Rule.from_hash hash
=> #<IceCube::WeeklyRule:0x007fb4b5bb39f8
@interval=2,
@uses=0,
@validations=
{:interval=>[#<IceCube::Validations::WeeklyInterval::Validation:0x007fb4b5bb31b0 @interval=2, @week_start=:sunday>],
:base_hour=>[#<IceCube::Validations::ScheduleLock::Validation:0x007fb4b5bb3750 @type=:hour>],
:base_min=>[#<IceCube::Validations::ScheduleLock::Validation:0x007fb4b5bb36b0 @type=:min>],
:base_sec=>[#<IceCube::Validations::ScheduleLock::Validation:0x007fb4b5bb3610 @type=:sec>]},
@week_start=:sunday>
Then I create a schedule...
$ sched = IceCube::Schedule.new Date.today
=> #<IceCube::Schedule:0x007fb4b7214a80 @all_exception_rules=[], @all_recurrence_rules=[], @start_time=2015-02-13 00:00:00 -0600>
Add the rule
$ sched.add_recurrence_rule rule
=> [#<IceCube::WeeklyRule:0x007fb4b5bb39f8
@interval=2,
@uses=0,
@validations=
{:interval=>[#<IceCube::Validations::WeeklyInterval::Validation:0x007fb4b5bb31b0 @interval=2, @week_start=:sunday>],
:base_hour=>[#<IceCube::Validations::ScheduleLock::Validation:0x007fb4b5bb3750 @type=:hour>],
:base_min=>[#<IceCube::Validations::ScheduleLock::Validation:0x007fb4b5bb36b0 @type=:min>],
:base_sec=>[#<IceCube::Validations::ScheduleLock::Validation:0x007fb4b5bb3610 @type=:sec>]},
@week_start=:sunday>]
And inspect the next 20 occurrences
$ sched.next_occurrences 20
=> [Sat, 14 Feb 2015 00:00:00 UTC +00:00,
Sun, 22 Feb 2015 00:00:00 UTC +00:00,
Mon, 23 Feb 2015 00:00:00 UTC +00:00,
Tue, 24 Feb 2015 00:00:00 UTC +00:00,
Wed, 25 Feb 2015 00:00:00 UTC +00:00,
Thu, 26 Feb 2015 00:00:00 UTC +00:00,
Fri, 27 Feb 2015 00:00:00 UTC +00:00,
Sat, 28 Feb 2015 00:00:00 UTC +00:00,
Sun, 08 Mar 2015 00:00:00 UTC +00:00,
Mon, 09 Mar 2015 00:00:00 UTC +00:00,
Tue, 10 Mar 2015 00:00:00 UTC +00:00,
Wed, 11 Mar 2015 00:00:00 UTC +00:00,
Thu, 12 Mar 2015 00:00:00 UTC +00:00,
Fri, 13 Mar 2015 00:00:00 UTC +00:00,
Sat, 14 Mar 2015 00:00:00 UTC +00:00,
Sun, 22 Mar 2015 00:00:00 UTC +00:00,
Mon, 23 Mar 2015 00:00:00 UTC +00:00,
Tue, 24 Mar 2015 00:00:00 UTC +00:00,
Wed, 25 Mar 2015 00:00:00 UTC +00:00,
Thu, 26 Mar 2015 00:00:00 UTC +00:00]
What am I missing here?
What does it show a week of consecutive days?