Merge pull request #1032 from Ana06/all-events
All events grouped by date and time
This commit is contained in:
commit
63750345e7
20 changed files with 436 additions and 218 deletions
|
|
@ -34,7 +34,7 @@ class Ability
|
|||
conference.splashpage && conference.splashpage.public == true
|
||||
end
|
||||
# Can view the schedule
|
||||
can [:schedule], Conference do |conference|
|
||||
can [:schedule, :events], Conference do |conference|
|
||||
conference.program.cfp && conference.program.schedule_public
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -609,6 +609,21 @@ class Conference < ActiveRecord::Base
|
|||
next_color(start_index[collection])
|
||||
end
|
||||
|
||||
# Returns the current day if it is a day of the schedule or nil otherwise
|
||||
def current_conference_day
|
||||
day = Time.find_zone(timezone).today
|
||||
day if (start_date..end_date).cover? day
|
||||
end
|
||||
|
||||
# Returns the number of hours since the conference start hour (9) to the
|
||||
# current hour, in case that the current hour is beetween the start and the
|
||||
# end hour (20). Otherwise, returns 0
|
||||
def hours_from_start_time(start_hour, end_hour)
|
||||
current_time = Time.find_zone(timezone).now
|
||||
current_hour = current_time.strftime('%H').to_i
|
||||
(start_hour..(end_hour-1)).cover?(current_hour) ? current_hour - start_hour : 0
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
# Returns a different html colour for every i and consecutive colors are
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ class Event < ActiveRecord::Base
|
|||
# ====Returns
|
||||
# * +true+ or +false+
|
||||
def scheduled?
|
||||
room && start_time ? true : false
|
||||
room.present? && start_time.present?
|
||||
end
|
||||
|
||||
def registration_possible?
|
||||
|
|
|
|||
|
|
@ -27,7 +27,11 @@ class Program < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def scheduled
|
||||
where.not(start_time: nil).where.not(room: nil)
|
||||
where.not(start_time: nil).where.not(room: nil).order(start_time: :asc)
|
||||
end
|
||||
|
||||
def unscheduled
|
||||
confirmed.where('start_time IS NULL OR room_id IS NULL')
|
||||
end
|
||||
|
||||
def highlights
|
||||
|
|
@ -87,6 +91,17 @@ class Program < ActiveRecord::Base
|
|||
self.languages.split(',').map {|l| ISO_639.find(l).english_name} if self.languages.present?
|
||||
end
|
||||
|
||||
##
|
||||
# Checks if there is any event in the program that starts in the given date
|
||||
#
|
||||
# ====Returns
|
||||
# * +True+ -> If there is any event for the given date
|
||||
# * +False+ -> If there is not any event for the given date
|
||||
def any_event_for_this_date?(date)
|
||||
parsed_date = DateTime.parse("#{date} 00:00").utc
|
||||
events.where(start_time: parsed_date..(parsed_date + 1)).any?
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
##
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue