method added to autocycle through sponsors based on sponsor level and code added to inherit twitter env variables
This commit is contained in:
parent
881518f1f3
commit
e8d3177ec1
14 changed files with 89 additions and 163 deletions
|
|
@ -41,6 +41,7 @@ class Event < ActiveRecord::Base
|
|||
scope :canceled, -> { where(state: 'canceled') }
|
||||
scope :withdrawn, -> { where(state: 'withdrawn') }
|
||||
scope :highlighted, -> { where(is_highlight: true) }
|
||||
scope :current, -> { joins(:event_type).where('start_time <= ? AND state = ?', Time.current, 'confirmed').map { |e| e if e.end_time > Time.current }.compact }
|
||||
|
||||
state_machine initial: :new do
|
||||
state :new
|
||||
|
|
@ -248,10 +249,10 @@ class Event < ActiveRecord::Base
|
|||
end
|
||||
|
||||
##
|
||||
# Compares event start_time, end_with with current time to predict current events
|
||||
# Returns end of the event
|
||||
#
|
||||
def current?
|
||||
Time.current >= self.start_time && Time.current <= self.end_time
|
||||
def end_time
|
||||
self.start_time + self.event_type.length.minutes
|
||||
end
|
||||
|
||||
private
|
||||
|
|
@ -308,5 +309,4 @@ class Event < ActiveRecord::Base
|
|||
def current?
|
||||
Time.current >= self.start_time && Time.current <= self.end_time
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue