reso 0.1.5.3 → 0.1.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c202e32239858f7328d6d4405ece6d57fc8b2eb2
4
- data.tar.gz: 61689e070b733a8fb724d602f748fb55e57a2677
3
+ metadata.gz: 0158ffcc5ee57dbd9dad799714d6e9243a2a0fd0
4
+ data.tar.gz: ad6ff43d4dff5096cb6c8c39c71812e5527a478a
5
5
  SHA512:
6
- metadata.gz: 6402750a552b05f4361dd74c27c24ba749266d0e653620302ee1b9a8461b3d82619bf4eaf6074ac9d7492c7114b0c9db4c3f1192be5cbc34ae062490a1b89008
7
- data.tar.gz: 9dd9872160c71ad30605c667c14c145f820b8e3e65fecceff146b370046f2cff1bd6b13175dcc95c791f3626213b6fdff1c14690a21a6ed3be7a2d62c788db7e
6
+ metadata.gz: bf2411a7ecda8969c36cca764e7a00dd2e5d571d7223b4d061cac7568576d239a7a3879c48bd2675ad57c762869c9cd18a2ef802a7c36e820addaf5e2f0c9710
7
+ data.tar.gz: d767028deaefd8b65230d4be186bda89324f9c1a7592d3dd73cdaf53bd8a184f2133fbd6dc355a9157eba9f04b5cf323b7da47352b2212390a0fcb16e5df41e9
data/app/models/import.rb CHANGED
@@ -49,7 +49,7 @@ class Import < ActiveRecord::Base
49
49
  source_data_modified = self.source_url_last_modified
50
50
  self.update_attribute(:source_data_modified, source_data_modified)
51
51
 
52
- l, count, found_listing_keys, snapshots, stream = 0, 0, [], [], ''
52
+ listing_count, count, found_listing_keys, snapshots, stream = 0, 0, [], [], ''
53
53
  open_tag, close_tag = get_open_and_closing_tag_for self.repeating_element
54
54
 
55
55
  # Grab a file to work with
@@ -68,16 +68,16 @@ class Import < ActiveRecord::Base
68
68
  doc = Nokogiri::XML([xml_header, xml].join).remove_namespaces!
69
69
  found_listing_keys << create_queued_listing_and_return_listing_key(doc, self)
70
70
  stream.gsub!(xml, '')
71
- if ((l += 1) % 100).zero?
71
+ if ((listing_count += 1) % 100).zero?
72
72
  GC.start
73
- snapshots << [l, l/(Time.now - start_time)]
73
+ snapshots << [listing_count, listing_count/(Time.now - start_time)]
74
74
  import_result.update_attribute(:snapshots, snapshots)
75
- import_result.update_attribute(:found_listing_keys, found_listing_keys)
75
+ import_result.update_attribute(:found_listing_keys, found_listing_keys) unless listing_count > 10000
76
76
  puts snapshots.last.inspect if Rails.env.development?
77
77
  end
78
78
  end
79
79
  end
80
- snapshots << [l, l/(Time.now - start_time)]
80
+ snapshots << [listing_count, listing_count/(Time.now - start_time)]
81
81
  end_time = Time.now
82
82
  self.update_attribute(:status, :active)
83
83
  removed_listing_keys = self.remove_listings_not_present(found_listing_keys)
@@ -1,6 +1,12 @@
1
1
  class ImportResult < ActiveRecord::Base
2
2
  belongs_to :import
3
+ enum status: [ :starting, :running, :finishing, :finished, :stalled, :aborted ]
3
4
  serialize :found_listing_keys
4
5
  serialize :removed_listing_keys
5
6
  serialize :snapshots
7
+
8
+ def found_count_difference
9
+ previous_run = self.import.import_results.where(['start_time < ?', self.start_time]).order("start_time DESC").limit(1).first
10
+ previous_run.present? ? self.found_listing_keys.count - previous_run.found_listing_keys.count : nil
11
+ end
6
12
  end
@@ -2,6 +2,7 @@ class CreateImportResults < ActiveRecord::Migration
2
2
  def change
3
3
  create_table :import_results do |t|
4
4
  t.references :import, index: true, foreign_key: true
5
+ t.integer :status, default: 0
5
6
  t.datetime :source_data_modified
6
7
  t.datetime :start_time
7
8
  t.datetime :end_time
data/lib/reso/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Reso
2
- VERSION = "0.1.5.3"
2
+ VERSION = "0.1.5.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reso
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5.3
4
+ version: 0.1.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Edlund
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-04 00:00:00.000000000 Z
11
+ date: 2015-09-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake