Fixed NPE on schedule
This commit is contained in:
		
							parent
							
								
									c85d6c7d75
								
							
						
					
					
						commit
						b89fa43b0e
					
				
							
								
								
									
										18
									
								
								Gemfile
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								Gemfile
									
									
									
									
									
								
							| @ -11,9 +11,9 @@ gem 'haml' | |||||||
| gem 'nokogiri', '~> 1.6.8.rc2' | gem 'nokogiri', '~> 1.6.8.rc2' | ||||||
| 
 | 
 | ||||||
| if Dir.exists?('../lingua_franca') | if Dir.exists?('../lingua_franca') | ||||||
| 	gem 'lingua_franca', :path => '../lingua_franca' |   gem 'lingua_franca', path: '../lingua_franca' | ||||||
| else | 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 | end | ||||||
| 
 | 
 | ||||||
| gem 'tzinfo-data' | gem 'tzinfo-data' | ||||||
| @ -21,15 +21,15 @@ gem 'sass' | |||||||
| gem 'sass-rails' | gem 'sass-rails' | ||||||
| 
 | 
 | ||||||
| if Dir.exists?('../bumbleberry') | if Dir.exists?('../bumbleberry') | ||||||
| 	gem 'bumbleberry', :path => "../bumbleberry" |   gem 'bumbleberry', path: "../bumbleberry" | ||||||
| else | else | ||||||
| 	gem 'bumbleberry', :git => 'git://github.com/bumbleberry/bumbleberry.git' |   gem 'bumbleberry', git: 'git://github.com/bumbleberry/bumbleberry.git' | ||||||
| end | end | ||||||
| 
 | 
 | ||||||
| if Dir.exists?('../paypal-express') | if Dir.exists?('../paypal-express') | ||||||
| 	gem 'paypal-express', :path => "../paypal-express" |   gem 'paypal-express', path: "../paypal-express" | ||||||
| else | else | ||||||
| 	gem 'paypal-express', :git => 'git://github.com/bikebike/paypal-express.git' |   gem 'paypal-express', git: 'git://github.com/bikebike/paypal-express.git' | ||||||
| end | end | ||||||
| 
 | 
 | ||||||
| gem 'uglifier', '>= 1.3.0' | gem 'uglifier', '>= 1.3.0' | ||||||
| @ -48,7 +48,7 @@ gem 'redcarpet' | |||||||
| gem 'sidekiq' | gem 'sidekiq' | ||||||
| gem 'letter_opener' | gem 'letter_opener' | ||||||
| gem 'launchy' | 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 | group :test do | ||||||
|   gem 'rspec' |   gem 'rspec' | ||||||
| @ -64,8 +64,8 @@ group :development do | |||||||
|   gem 'capistrano-rails', '~> 1.1' |   gem 'capistrano-rails', '~> 1.1' | ||||||
|   gem 'capistrano-faster-assets', '~> 1.0' |   gem 'capistrano-faster-assets', '~> 1.0' | ||||||
| 
 | 
 | ||||||
| 	gem 'eventmachine', :github => 'krzcho/eventmachine', :branch => 'master' |   gem 'eventmachine'#, :github => 'krzcho/eventmachine', :branch => 'master' | ||||||
| 	gem 'thin', :github => 'krzcho/thin', :branch => 'master' |   gem 'thin'#, :github => 'krzcho/thin', :branch => 'master' | ||||||
| end | end | ||||||
| 
 | 
 | ||||||
| group :test do | group :test do | ||||||
|  | |||||||
| @ -586,6 +586,7 @@ class ApplicationController < LinguaFrancaApplicationController | |||||||
|     end |     end | ||||||
| 
 | 
 | ||||||
|     @events.each do | event | |     @events.each do | event | | ||||||
|  |       if event.present? && event.start_time.present? && event.end_time.present? | ||||||
|         day = event.start_time.midnight.to_date |         day = event.start_time.midnight.to_date | ||||||
|         time = event.start_time.hour.to_f + (event.start_time.min / 60.0) |         time = event.start_time.hour.to_f + (event.start_time.min / 60.0) | ||||||
|         @schedule[day] ||= {} |         @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][:length] = (event.end_time - event.start_time) / 3600.0 | ||||||
|         @schedule[day][:times][time][:item] = event |         @schedule[day][:times][time][:item] = event | ||||||
|       end |       end | ||||||
|  |     end | ||||||
| 
 | 
 | ||||||
|     @schedule = @schedule.sort.to_h |     @schedule = @schedule.sort.to_h | ||||||
|     @schedule.each do | day, data | |     @schedule.each do | day, data | | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user