Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recalculate the interval value #158

Closed
wants to merge 2 commits into from
Closed

Conversation

miry
Copy link

@miry miry commented Apr 2, 2013

I have trouble with interval. If I try to setup interval after initialization, it still use first interval.
But the string of the rule is right.

rule = Rule.daily.until(Date.new(2013,5,1)) # => Daily until May  1, 2013
rule.interval(3)                            # => Every 3 days until May  1, 2013 
schedule = Schedule.new(Date.new(2013,4,1))
schedule.add_recurrence_rule rule # => [Every 3 days until May  1, 2013]

schedule.all_occurrences # => [2013-04-01, 2013-04-02, 2013-04-03, 2013-04-04, 2013-04-05, 2013-04-06, 2013-04-07, 2013-04-08, 2013-04-09, 2013-04-10, 2013-04-11, 2013-04-12, 2013-04-13, 2013-04-14, 2013-04-15, 2013-04-16, 2013-04-17, 2013-04-18, 2013-04-19, 2013-04-20, 2013-04-21, 2013-04-22, 2013-04-23, 2013-04-24, 2013-04-25, 2013-04-26, 2013-04-27, 2013-04-28, 2013-04-29, 2013-04-30, 2013-05-01]

Added patch for DailyInterval, because I do not understand the logic to use several intervals for one Rule.

Solution without this patch is to use next:

rule = Rule.daily.until(Date.new(2013,5,1)) # => Daily until May  1, 2013
rule.replace_validations_for(:interval, [])
rule.interval(3)                            # => Every 3 days until May  1, 2013 

@miry
Copy link
Author

miry commented Apr 2, 2013

@seejohnrun May I work on this issue?

@avit
Copy link
Collaborator

avit commented Apr 2, 2013

Thanks @miry, I'll have a look at the PR and see about merging it for the next point release. (There are a few other fixes waiting so I hope to get it out this week.)

@avit
Copy link
Collaborator

avit commented May 16, 2013

@miry Sorry I didn't have a chance to look at this for a while.

I think this change should affect all rules, not just daily. Do you want to add the rest?

@miry
Copy link
Author

miry commented May 17, 2013

Sure will work on it.

All regards, Michael
JetThoughts

On May 17, 2013, at 1:44 AM, Andrew Vit notifications@github.com wrote:

@miry Sorry I didn't have a chance to look at this for a while.

I think this change should affect all rules, not just daily. Do you want to add the rest?


Reply to this email directly or view it on GitHub.

@avit
Copy link
Collaborator

avit commented May 17, 2013

@miry I fixed this since it was related to another issue too. Thanks for your help.

rlivsey pushed a commit to rlivsey/ice_cube that referenced this pull request Jun 18, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants