Sha256: 934b63928fe38f6f60ca5888d82dcea36055544d5b96658bc4a50958fd9aa063

Contents?: true

Size: 1.16 KB

Versions: 20

Compression:

Stored size: 1.16 KB

Contents

class Agenda < ActiveRecord::Base
  include SocialStream::Models::Object

  belongs_to :event
  has_many :sessions, :dependent => :destroy

  validates_presence_of :event_id

    # Fullcalendar slot values
  SLOT_VALUES=[5,15,30]

=begin
  def to_fullcalendar_json
    sessions.map(&:to_fullcalendar_json).join(", ")

    "[#{sessions.map(&:to_fullcalendar_json).join(", ")}]"
  end
=end


  def start_date
    event.initDate
  end

  def end_date
    event.endDate
  end

  def getSessions(id,time_start,time_end)
    @sessions = sessions.where( "initDate >= '#{time_start.to_formatted_s(:db)}' AND
                             endDate  <= '#{time_end.to_formatted_s(:db)}' ")
  end

  def contents_for_day(i)

      @sessions = sessions.where(
                "initDate >= :day_start AND initDate < :day_end", {:day_start => start_date.to_date + (i-1).day,
                :day_end => start_date.to_date + i.day})


  end

  def self.next_time_slot_for_drop_down
    if Time.zone.now.min > 40
      Time.zone.parse("#{Time.zone.now.hour + 1}:00")
    else
      Time.zone.parse("#{Time.zone.now.hour}:#{(Time.zone.now.min.to_f/SLOT_VALUES[1]).ceil*SLOT_VALUES[1]}")
    end
  end

end




Version data entries

20 entries across 20 versions & 2 rubygems

Version Path
social_stream-0.14.1 events/app/models/agenda.rb
social_stream-0.14.0 events/app/models/agenda.rb
social_stream-0.13.3 events/app/models/agenda.rb
social_stream-0.13.2 events/app/models/agenda.rb
social_stream-0.13.1 events/app/models/agenda.rb
social_stream-0.13.0 events/app/models/agenda.rb
social_stream-events-0.1.0 app/models/agenda.rb
social_stream-0.12.14 events/app/models/agenda.rb
social_stream-0.12.13 events/app/models/agenda.rb
social_stream-0.12.12 events/app/models/agenda.rb
social_stream-0.12.11 events/app/models/agenda.rb
social_stream-0.12.10 events/app/models/agenda.rb
social_stream-0.12.9 events/app/models/agenda.rb
social_stream-0.12.8 events/app/models/agenda.rb
social_stream-0.12.7 events/app/models/agenda.rb
social_stream-events-0.0.20 app/models/agenda.rb
social_stream-0.12.6 events/app/models/agenda.rb
social_stream-events-0.0.19 app/models/agenda.rb
social_stream-0.12.5 events/app/models/agenda.rb
social_stream-events-0.0.18 app/models/agenda.rb