Class: ScheduleException

Inherits:
Sequel::Model
  • Object
show all
Defined in:
app/models/schedule_exception.rb

Instance Method Summary collapse

Instance Method Details

#affects?(event) ⇒ Boolean

Checks whether this exception affects an event during event planning phase.

Returns:

  • (Boolean)

22
23
24
25
26
27
28
29
# File 'app/models/schedule_exception.rb', line 22

def affects?(event)
  !event.deleted &&
  time_matches?(event) &&
  faculty_matches?(event) &&
  semester_matches?(event) &&
  course_matches?(event) &&
  timetable_slot_matches?(event)
end

#apply(event) ⇒ Object

This method is called by inherited #apply implementations before their own code.


32
33
34
35
# File 'app/models/schedule_exception.rb', line 32

def apply(event)
  event.applied_schedule_exception_ids ||= []
  event.applied_schedule_exception_ids << id
end

#apply_people_assign(event) ⇒ Object

Called when an exception is applied during assign people phase. Should be overridden by subclass if needed.


39
40
# File 'app/models/schedule_exception.rb', line 39

def apply_people_assign(event)
end

#periodObject


11
12
13
# File 'app/models/schedule_exception.rb', line 11

def period
  Period.new(starts_at, ends_at)
end

#period=(new_period) ⇒ Object


15
16
17
18
# File 'app/models/schedule_exception.rb', line 15

def period=(new_period)
  self.starts_at = new_period.starts_at
  self.ends_at = new_period.ends_at
end