Permalink
Browse files

Merge branch 'skinny' of github.com:mattmacleod/Braincube into skinny

  • Loading branch information...
2 parents cc608cb + 2a870e9 commit 5f2d2b02b93d0021c2e9eb9b76fd4f44260ecc95 @mattmacleod committed Sep 22, 2011
Showing with 8 additions and 3 deletions.
  1. +8 −2 app/models/imported_performance.rb
  2. +0 −1 test/functional/admin_controller_test.rb
@@ -85,11 +85,17 @@ def create_from_csv!( csv_data )
event = Event.find_by_title( data[:event_name] )
city = City.find_by_name(data[:city]) || City.first
venue = Venue.find(:first, :conditions => { :title => data[:venue_name], :city_id => city.id})
- start_at = Time::parse( "#{data[:start_date]} #{data[:start_time]}") rescue nil
- end_at = Time::parse( "#{data[:end_date]} #{data[:end_time]}" ) rescue nil
+ start_at = Time::parse( "#{data[:start_date]} #{data[:start_time]}").getlocal rescue nil
+ end_at = Time::parse( "#{data[:end_date]} #{data[:end_time]}" ).getlocal rescue nil
end_at = (end_at + 1.day) if end_at && start_at && (end_at < start_at)
+ # Bit of a hack to account for DST
+ if start_at.dst?
+ start_at += 1.hour
+ end_at += 1.hour if end_at
+ end
+
imported_attributes = {
:event_name => data[:event_name],
:event => event,
@@ -44,7 +44,6 @@ class AdminControllerTest < ActionController::TestCase
should_require_admin_login
end
-
# Logging in/out
##############################

0 comments on commit 5f2d2b0

Please sign in to comment.