Merge pull request #1082 from nishanthvijayan/handle-cancelled-events

Handle cancellation of scheduled events
This commit is contained in:
Henne Vogelsang 2016-07-25 15:52:53 +02:00 committed by GitHub
commit 96155eb87f
5 changed files with 50 additions and 0 deletions

View file

@ -38,6 +38,8 @@ class Event < ActiveRecord::Base
validate :max_attendees_no_more_than_room_size
scope :confirmed, -> { where(state: 'confirmed') }
scope :canceled, -> { where(state: 'canceled') }
scope :withdrawn, -> { where(state: 'withdrawn') }
scope :highlighted, -> { where(is_highlight: true) }
state_machine initial: :new do
@ -246,6 +248,13 @@ class Event < ActiveRecord::Base
self.start_time + self.event_type.length.minutes
end
##
# Returns events that are scheduled in the same room and start_time as event
#
def intersecting_events
room.events.where(start_time: start_time).where.not(id: id)
end
private
##