app/models/import.rb in reso-0.1.4.6 vs app/models/import.rb in reso-0.1.4.7
- old
+ new
@@ -30,21 +30,16 @@
allow_redirections: :all
){|f| return f.last_modified }
end
def new_source_data_exists?
- result = true
- if (source_url_last_modified = self.source_url_last_modified)
- if source_url_last_modified.eql? self.source_data_modified)
- result = true
- else
- result = false
- end
+ source_url_last_modified = self.source_url_last_modified
+ if source_url_last_modified.present? && self.source_data_modified.present?
+ DateTime.parse(source_url_last_modified.to_s) > DateTime.parse(self.source_data_modified.to_s) ? true : false
else
- result = true
+ true
end
- result
end
def run_import
if self.status == 'active'
if self.new_source_data_exists?
@@ -71,10 +66,10 @@
doc = Nokogiri::XML([xml_header, xml].join).remove_namespaces!
found_listing_keys << create_queued_listing_and_return_listing_key(doc, self)
stream.gsub!(xml, '')
if ((l += 1) % 100).zero?
GC.start
- snapshots << [l, ] l/(Time.now - start_time)
+ snapshots << [l, l/(Time.now - start_time)]
end
end
end
end_time = Time.now
removed_listing_keys = self.remove_listings_not_present(found_listing_keys)