lib/generators/reso/templates/reso.rake in reso-0.1.2.0 vs lib/generators/reso/templates/reso.rake in reso-0.1.3.0

- old
+ new

@@ -91,14 +91,15 @@ desc "Download and import data file for specified import." task :import, [:import_token] => [:environment] do |t, args| args.with_defaults(:import_token => "reso") - import = Import.find_by(token: args.import_token) + import = Import.where(status: 'active', token: args.import_token).first unless import.blank? unless import.new_source_data_exists? + import.update_attribute(:status, :running) source_data_modified = import.source_url_last_modified l, count, found_listing_keys, stream = 0, 0, [], '' open_tag, close_tag = get_open_and_closing_tag_for import.repeating_element # Grab a file to work with @@ -129,9 +130,10 @@ end_time: end_time, found_listing_keys: found_listing_keys, removed_listing_keys: removed_listing_keys.inspect }) import_result.save + import.update_attribute(:status, :active) import.update_attribute(:source_data_modified, source_data_modified) File.delete(filepath) end end end