Closed uzaif313 closed 7 years ago
This looks correct to me.
its not display hourly based count for other days
You have set hourly(3)
= every 3 hours, and count(4)
= 4 times only. The 4 hourly occurrences are based on the start time, and then they stop:
[2017-08-17 00:00:00 +0530,
2017-08-17 03:00:00 +0530,
2017-08-17 06:00:00 +0530,
2017-08-17 09:00:00 +0530,
After this, the hourly rule is done because of the count limit, so it does the daily.day(1,3,5)
occurrences only.
@avit Thanks for response can you tell me how can I repeat count for every occurrence
Also, end_time:Date.today+13.days
will set the duration (length) of each occurrence, not when the schedule stops repeating. You might want to use until
if you want the schedule to stop instead.
how can I repeat count for every occurrence
I don't understand. Can you tell me more exactly what you mean? Maybe give an example of the result you want?
Thanks @avit for response
i need something like below occurrence which will repeat daily with hourly rules
2017-08-17 03:00:00 +0530,
2017-08-17 06:00:00 +0530,
2017-08-17 09:00:00 +0530,
2017-08-18 03:00:00 +0530,
2017-08-18 06:00:00 +0530,
2017-08-18 09:00:00 +0530,
2017-08-19 03:00:00 +0530,
2017-08-19 06:00:00 +0530,
2017-08-19 09:00:00 +0530,
2017-08-20 03:00:00 +0530,
2017-08-20 06:00:00 +0530,
2017-08-20 09:00:00 +0530,
]
You can do it with 3 daily rules:
schedule.add_recurrence_rule IceCube::Rule.daily.hour_of_day(3)
schedule.add_recurrence_rule IceCube::Rule.daily.hour_of_day(6)
schedule.add_recurrence_rule IceCube::Rule.daily.hour_of_day(9)
Or 1 hourly rule:
schedule.add_recurrence_rule IceCube::Rule.hourly.hour_of_day(3, 6, 9)
The first way is more efficient, but both of these will work.
Thanks for response @avit :+1: its really help me. thanks a lot again. can we make above code based on frequency? eg. Daily Tuesday and Friday every 3 hours repeat frequency is 3
Yes of course, just add .day(:tuesday, :friday)
to the above.
:+1:
schedule = IceCube::Schedule.new(Time.now,end_time:Time.now+12.days+4.hours)
schedule.add_recurrence_rule IceCube::Rule.daily.day(1,3,5).hour_of_day(3,6,9)
schedule.occurrences(Time.now+13.days)
this can also give occurrence within 3 hours on daily rule
hi @avit can we repeat time hourly schedule between start_time and end_time with some frequency
eg.
we need like this
Weekly mondays, tuesday every 2 hours
with frequency of 3
so it will give repeat schedule on 3 time in days between start_time and end_time
how can i combine multiple rules with add_recurrences_rule
method
i follow below process
as above output display correct form of count for 17 but its not display hourly based count for other days