A calendar management project, for events and activities related to communities fighting for freedoms.
This can be related to software, art, data, hardware, content, commons, internet.
https://www.agendadulibre.org
This can be related to software, art, data, hardware, content, commons, internet.
https://www.agendadulibre.org
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.
19 lines
457 B
19 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
|
|
|