is_current method added to check an event is current and function addded to refresh conference_wide_information
This commit is contained in:
parent
35afdcead4
commit
febd3451ad
8 changed files with 74 additions and 2 deletions
|
|
@ -41,6 +41,8 @@ class Event < ActiveRecord::Base
|
|||
scope :canceled, -> { where(state: 'canceled') }
|
||||
scope :withdrawn, -> { where(state: 'withdrawn') }
|
||||
scope :highlighted, -> { where(is_highlight: true) }
|
||||
|
||||
|
||||
|
||||
state_machine initial: :new do
|
||||
state :new
|
||||
|
|
@ -247,6 +249,13 @@ class Event < ActiveRecord::Base
|
|||
event_schedules.find_by(schedule_id: program.selected_schedule_id).try(:start_time)
|
||||
end
|
||||
|
||||
##
|
||||
#Compares event start_time, end_with with current time to predict current events
|
||||
#
|
||||
def is_current?
|
||||
Time.current >= self.start_time && Time.current <= end_time
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
##
|
||||
|
|
@ -294,4 +303,12 @@ class Event < ActiveRecord::Base
|
|||
def conference_id
|
||||
program.conference_id
|
||||
end
|
||||
|
||||
##
|
||||
#Compares event start_time, end_with with current time to predict current events
|
||||
#
|
||||
def is_current?
|
||||
Time.current >= self.start_time && Time.current <= end_time
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue