diff options
Diffstat (limited to 'app/models/calendar.rb')
| -rw-r--r-- | app/models/calendar.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/app/models/calendar.rb b/app/models/calendar.rb index 91a17e853..39e0d6d49 100644 --- a/app/models/calendar.rb +++ b/app/models/calendar.rb @@ -19,6 +19,17 @@ class Calendar < ActiveRecord::Base [:contains_date] end + def convert_to_time_table + Chouette::TimeTable.new.tap do |tt| + self.dates.each do |d| + tt.dates << Chouette::TimeTableDate.new(date: d, in_out: true) + end + self.date_ranges.each do |p| + tt.periods << Chouette::TimeTablePeriod.new(period_start: p.begin, period_end: p.end) + end + end + end + class Period include ActiveAttr::Model |
