app/models/import.rb in reso-0.1.4.3 vs app/models/import.rb in reso-0.1.4.4

- old
+ new

@@ -30,11 +30,16 @@ allow_redirections: :all ){|f| return f.last_modified } end def new_source_data_exists? - (self.source_url_last_modified > self.source_data_modified) ? true : false + if (source_url_last_modified = self.source_url_last_modified) + (self.source_url_last_modified.eql? self.source_data_modified) ? result = true : result = false + else + result = true + end + result end def run_import if self.status == 'active' if self.new_source_data_exists? @@ -63,20 +68,20 @@ stream.gsub!(xml, '') end end end_time = Time.now removed_listing_keys = self.remove_listings_not_present(found_listing_keys) + self.assign_attributes({ + status: :active, + source_data_modified: source_data_modified + }) + self.save import_result.assign_attributes({ end_time: end_time, found_listing_keys: found_listing_keys, removed_listing_keys: removed_listing_keys.inspect }) import_result.save - self.assign_attributes({ - status: :active, - source_data_modified: source_data_modified - }) - self.save File.delete(filepath) end end end