You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
457 B
20 lines
457 B
# The code to manage adl scheduling. Repeat events, is managed here
|
|
module Schedule
|
|
def schedule
|
|
IceCube::Schedule.new start_time, end_time: end_time do |s|
|
|
s.add_recurrence_rule prepare_schedule.count repeat + 1
|
|
end
|
|
end
|
|
|
|
private
|
|
|
|
def prepare_schedule
|
|
r = IceCube::Rule.send rule.split('_').first
|
|
if rule == 'monthly_day'
|
|
r.day_of_week start_time.wday => [(start_time.day - 1) / 7 + 1]
|
|
else
|
|
r
|
|
end
|
|
end
|
|
end
|