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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 55fa72604c911bc9aea067d0d517b3915d50a961aa2b3dc58f55aa0abf137821
|
4
|
+
data.tar.gz: b7af4ba8d405b7f5261740b1c1c49283b3f1bb6d5ecfd46f1a03ee22c230e4cf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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: :
|
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: #{
|
41
|
+
Rails.logger.info "Process status: #{items.count}/#{data.count}"
|
42
42
|
end
|
43
43
|
|
44
44
|
def export
|
45
|
-
|
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)
|
@@ -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.
|
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-
|
11
|
+
date: 2022-08-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|