Skip to content

Commit

Permalink
add timezone data to schedule (#721) (#729)
Browse files Browse the repository at this point in the history
  • Loading branch information
elad-eyal authored Nov 5, 2020
1 parent 5639157 commit 9acb723
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/models/conference.rb
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ def timezone
attributes['timezone']
end

def timezone_IANA
ActiveSupport::TimeZone::MAPPING[timezone] or timezone
end

def timeslot_duration
return parent.timeslot_duration if sub_conference?
attributes['timeslot_duration']
Expand Down
1 change: 1 addition & 0 deletions app/views/public/schedule/index.json.jbuilder
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ json.schedule do
end
json.daysCount @conference.days.length
json.timeslot_duration duration_to_time(@conference.timeslot_duration)
json.time_zone_name @conference.timezone_IANA
index = 1
json.days @conference.days do |day|
json.index index
Expand Down
1 change: 1 addition & 0 deletions app/views/public/schedule/index.xml.haml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
%end= @conference.last_day.end_date.strftime('%Y-%m-%d')
%days= @conference.days.length
%timeslot_duration= duration_to_time(@conference.timeslot_duration)
%time_zone_name= @conference.timezone_IANA
- if @conference.program_export_base_url.present?
%base_url= @conference.program_export_base_url
- else
Expand Down
2 changes: 2 additions & 0 deletions test/controllers/public/schedule_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@ class Public::ScheduleControllerTest < ActionController::TestCase
schedule = Hash.from_xml(response.body)['schedule']
assert_includes schedule.keys, 'conference'
assert_includes schedule.keys, 'day'
assert_includes schedule['conference'].keys, 'time_zone_name'
end

test 'displays json schedule' do
get :index, format: :json, params: { conference_acronym: @conference.acronym }
assert_response :success
schedule = JSON.parse(response.body)['schedule']
assert_includes schedule.keys, 'conference'
assert_includes schedule['conference'].keys, 'time_zone_name'
end

test 'displays ical schedule' do
Expand Down

0 comments on commit 9acb723

Please sign in to comment.