Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed importer issue

  • Loading branch information...
commit 52a0dbccad6f2b7799c8258df8ee74d81a52305a 1 parent 2ad7b5a
@mattmacleod authored
Showing with 9 additions and 3 deletions.
  1. +9 −3 app/models/imported_performance.rb
View
12 app/models/imported_performance.rb
@@ -86,8 +86,11 @@ def create_from_csv!( csv_data )
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]}").getlocal rescue nil
- end_at = Time::parse( "#{data[:end_date]} #{data[:end_time]}" ).getlocal rescue nil
-
+ if data[:end_date].blank
+ end_at = Time::parse( "#{data[:start_date]} #{data[:end_time]}" ).getlocal rescue nil
+ else
+ end_at = Time::parse( "#{data[:end_date]} #{data[:end_time]}" ).getlocal rescue nil
+ end
end_at = (end_at + 1.day) if end_at && start_at && (end_at < start_at)
# Bit of a hack to account for DST
@@ -204,7 +207,10 @@ def convert!( selected_ids )
end
end
-
+
+ # Force an index
+ Sunspot.index( new_events + updated_events )
+
return saved_performances, failed_imports, new_events, updated_events
end
Please sign in to comment.
Something went wrong with that request. Please try again.