batches_task_processor 0.3.3 → 0.3.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 35e87c4ae1e2728db3bf365e2bb9ceb74aa7d5605bc5fbf5a94aea4fd9559637
4
- data.tar.gz: 65da53cfe48a3aedc8eece776e3100edb5d4d1e29a2b0b99123a6f50f0aa5ee2
3
+ metadata.gz: 55fa72604c911bc9aea067d0d517b3915d50a961aa2b3dc58f55aa0abf137821
4
+ data.tar.gz: b7af4ba8d405b7f5261740b1c1c49283b3f1bb6d5ecfd46f1a03ee22c230e4cf
5
5
  SHA512:
6
- metadata.gz: 6c2a0f73cd1385dba738cc8a09c2159889f067d9e9743f33bae49feb4085c41b49293599b70241a31bdc9612c52e26a31568a56f69ef51b428a9855df7ed3f60
7
- data.tar.gz: bc945ab30a45c47d0519380cd85efd5c15534c7ba5eb1915deed65777ce3e88aa95910311fbdc64d1e7623e085d6c1857bd305e6261f6effc24e5ee367dd2887
6
+ metadata.gz: 448ede71fdf8000fb9e0a7f38c00b8ab4eb25c1600844bb0e7f6c592e19fabe5fae0f147a0a3c2773f7302d0069e59bbe33815e4602890898d0d05c4d724a486
7
+ data.tar.gz: '081e7b82550eb9f6d222fc28275540cbda005a42b7485dd9f296c6dadc9a59844ceed3e47f1f891e240626d3877c9a519e4615bfc5ca385400b552fe56fccc83'
@@ -4,7 +4,7 @@ require 'csv'
4
4
  module BatchesTaskProcessor
5
5
  class Model < ActiveRecord::Base
6
6
  self.table_name = 'batches_task_processors'
7
- has_many :items, class_name: 'BatchesTaskProcessor::ModelItem', dependent: :destroy, foreign_key: :batches_task_processors_id
7
+ has_many :items, class_name: 'BatchesTaskProcessor::ModelItem', dependent: :delete_all, foreign_key: :batches_task_processors_id
8
8
  validates :process_item, presence: true
9
9
  validates :key, presence: true
10
10
  before_save :apply_data_uniqueness
@@ -38,11 +38,12 @@ module BatchesTaskProcessor
38
38
  end
39
39
 
40
40
  def status
41
- Rails.logger.info "Process status: #{task_model.items.count}/#{task_model.data.count}"
41
+ Rails.logger.info "Process status: #{items.count}/#{data.count}"
42
42
  end
43
43
 
44
44
  def export
45
- path = Rails.root.join('tmp/batches_task_processor_result.csv')
45
+ filename = (key || 'batches_task_processor_result').try(:parameterize)
46
+ path = Rails.root.join("tmp/#{filename}.csv")
46
47
  data = items.pluck(:key, :result, :error_details)
47
48
  data = [['Key', 'Result', 'Error details']] + data
48
49
  File.write(path, data.map(&:to_csv).join)
@@ -1,3 +1,3 @@
1
1
  module BatchesTaskProcessor
2
- VERSION = "0.3.3"
2
+ VERSION = "0.3.4"
3
3
  end
@@ -18,7 +18,7 @@ class AddBatchesTaskProcessor < ActiveRecord::Migration[5.0]
18
18
  create_table :batches_task_processor_items do |t|
19
19
  t.belongs_to :batches_task_processors, foreign_key: true, index: { name: 'index_batches_task_processors_parent_id' }
20
20
  t.string :key
21
- t.text :result
21
+ t.text :result, limit: 999999
22
22
  t.text :error_details
23
23
  t.timestamps
24
24
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: batches_task_processor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Owen Peredo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-08-03 00:00:00.000000000 Z
11
+ date: 2022-08-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails