Browse Source

Fixed NPE on schedule

development
Godwin 8 years ago
parent
commit
b89fa43b0e
  1. 18
      Gemfile
  2. 2
      app/controllers/application_controller.rb

18
Gemfile

@ -11,9 +11,9 @@ gem 'haml'
gem 'nokogiri', '~> 1.6.8.rc2'
if Dir.exists?('../lingua_franca')
gem 'lingua_franca', :path => '../lingua_franca'
gem 'lingua_franca', path: '../lingua_franca'
else
gem 'lingua_franca', :git => 'git://github.com/lingua-franca/lingua_franca.git'
gem 'lingua_franca', git: 'git://github.com/lingua-franca/lingua_franca.git'
end
gem 'tzinfo-data'
@ -21,15 +21,15 @@ gem 'sass'
gem 'sass-rails'
if Dir.exists?('../bumbleberry')
gem 'bumbleberry', :path => "../bumbleberry"
gem 'bumbleberry', path: "../bumbleberry"
else
gem 'bumbleberry', :git => 'git://github.com/bumbleberry/bumbleberry.git'
gem 'bumbleberry', git: 'git://github.com/bumbleberry/bumbleberry.git'
end
if Dir.exists?('../paypal-express')
gem 'paypal-express', :path => "../paypal-express"
gem 'paypal-express', path: "../paypal-express"
else
gem 'paypal-express', :git => 'git://github.com/bikebike/paypal-express.git'
gem 'paypal-express', git: 'git://github.com/bikebike/paypal-express.git'
end
gem 'uglifier', '>= 1.3.0'
@ -48,7 +48,7 @@ gem 'redcarpet'
gem 'sidekiq'
gem 'letter_opener'
gem 'launchy'
gem 'to_spreadsheet', :git => 'git://github.com/glebm/to_spreadsheet.git'
gem 'to_spreadsheet', git: 'git://github.com/glebm/to_spreadsheet.git'
group :test do
gem 'rspec'
@ -64,8 +64,8 @@ group :development do
gem 'capistrano-rails', '~> 1.1'
gem 'capistrano-faster-assets', '~> 1.0'
gem 'eventmachine', :github => 'krzcho/eventmachine', :branch => 'master'
gem 'thin', :github => 'krzcho/thin', :branch => 'master'
gem 'eventmachine'#, :github => 'krzcho/eventmachine', :branch => 'master'
gem 'thin'#, :github => 'krzcho/thin', :branch => 'master'
end
group :test do

2
app/controllers/application_controller.rb

@ -586,6 +586,7 @@ class ApplicationController < LinguaFrancaApplicationController
end
@events.each do | event |
if event.present? && event.start_time.present? && event.end_time.present?
day = event.start_time.midnight.to_date
time = event.start_time.hour.to_f + (event.start_time.min / 60.0)
@schedule[day] ||= {}
@ -595,6 +596,7 @@ class ApplicationController < LinguaFrancaApplicationController
@schedule[day][:times][time][:length] = (event.end_time - event.start_time) / 3600.0
@schedule[day][:times][time][:item] = event
end
end
@schedule = @schedule.sort.to_h
@schedule.each do | day, data |

Loading…
Cancel
Save