This commit is contained in:
Stella Rouzi 2016-06-15 17:52:59 +03:00 committed by Henne Vogelsang
parent 1412369b39
commit 419f3bb296
4 changed files with 13 additions and 10 deletions

View file

@ -14,7 +14,7 @@ class ConferenceController < ApplicationController
def schedule
@rooms = @conference.venue.rooms if @conference.venue
@events = @conference.program.events
@events_xml = @conference.program.events.scheduled.group_by{ |event| event.start_time.to_date }
@events_xml = @events.scheduled.group_by{ |event| event.start_time.to_date }
@dates = @conference.start_date..@conference.end_date
if @dates == Date.current

View file

@ -1,4 +1,14 @@
module ApplicationHelper
##
# Gets an EventType object, and returns its length in timestamp format (HH:MM)
# ====Gets
# * +Integer+ -> 30
# ====Returns
# * +String+ -> "00:30"
def length_timestamp(length)
[length / 60, length % 60].map { |t| t.to_s.rjust(2, '0') }.join(':')
end
##
# ====Returns
# * +String+ -> number of registrations / max allowed registrations

View file

@ -12,13 +12,6 @@ class EventType < ActiveRecord::Base
LENGTH_STEP = 15
##
# Return the length in timestamp format (HH:MM)
#
def length_timestamp
[length / 60, length % 60].map { |t| t.to_s.rjust(2, '0') }.join(':')
end
private
##

View file

@ -6,7 +6,7 @@
%start= @conference.start_date
%end= @conference.end_date
%days= (@conference.end_date - @conference.start_date).to_i + 1
%timeslot_duration= '00:15' #FIXME
%timeslot_duration= length_timestamp(EventType::LENGTH_STEP)
- if @events_xml.any?
- @events_xml.keys.each.with_index(1) do |day, index|
@ -18,7 +18,7 @@
%event{ guid: event.guid, id: event.id }
%date= event.start_time.iso8601
%start= event.start_time.strftime('%H:%M')
%duration= event.event_type.length_timestamp
%duration= length_timestamp(event.event_type.length)
%room= event.room.name
%type= event.event_type.name
%language= 'en' #FIXME