app/models/chouette/time_table_period.rb in ninoxe-1.0.3 vs app/models/chouette/time_table_period.rb in ninoxe-1.1.0

- old
+ new

@@ -23,9 +23,25 @@ end if period_end <= period_start errors.add(:period_end,I18n.t("activerecord.errors.models.time_table_period.start_must_be_before_end")) end end + def update_parent time_table.shortcuts_update end + + def copy + Chouette::TimeTablePeriod.new(:period_start => self.period_start,:period_end => self.period_end) + end + + # Test to see if a period overlap this period + def overlap?(p) + (p.period_start >= self.period_start && p.period_start <= self.period_end) || (p.period_end >= self.period_start && p.period_end <= self.period_end) + end + + # Test to see if a period is included in this period + def contains?(p) + (p.period_start >= self.period_start && p.period_end <= self.period_end) + end + end