ddr-batch 1.2.0.rc1 → 1.2.0.rc2

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
  SHA1:
3
- metadata.gz: e99d993322b0feb42c08dd0a367aa2cbb9a8bd36
4
- data.tar.gz: 7d3ea407d8f1cc09f33725c8c54cbbb934967a98
3
+ metadata.gz: 6af55cc37d93326bdcad084634c17b1ef3206412
4
+ data.tar.gz: 806152ec7c04f3f88eda1b325f9c72cc814fe523
5
5
  SHA512:
6
- metadata.gz: 8954284d5fed970fbaa7ee95626bafc28f7e906ba668d657d95279191555f842b6b5832943bc9034fdcf5bf699f27ad2d7c2d412d34cb4d89f6d9fff24bb1eb5
7
- data.tar.gz: 2de0336399b640e5b3b85daa2ca65ebd1ac31f85e259907d80701d68198c8969e1dc155024ebe9a3bbe16b50cc61703677fe5cb2a9392d2306e2d5094b914bcc
6
+ metadata.gz: 7d1d932ba6ebc49a97e81a0f127b2b0bc60c05cf189322fd704db0ec7fc12ff74b2c8f5f4839de1df7f3d3530306d548a631ceb0f11cf8f40dec05df6ae1c89d
7
+ data.tar.gz: 9472b3ccec76010514e8e529aebc01ae0c56369308cb601c859ce22cc8986b4933d7870eaf34e5f601764c5a905cad59eee4a21d891481960f52df2a8561f4af
@@ -9,6 +9,9 @@ module Ddr::Batch
9
9
  @title = "Batch Processor Run #{@batch.status} #{@batch.outcome}"
10
10
  @host = `uname -n`.strip
11
11
  @subject = "[#{@host}] #{@title}"
12
+ @size = @batch.batch_objects.size
13
+ @handled = @batch.handled_count
14
+ @success = @batch.success_count
12
15
  from = "#{`echo $USER`.strip}@#{@host}"
13
16
  attachments["details.txt"] = File.read(@batch.logfile.path)
14
17
  mail(from: from, to: @batch.user.email, subject: @subject)
@@ -26,6 +26,10 @@ module Ddr::Batch
26
26
  batch_objects.where(handled: true).count
27
27
  end
28
28
 
29
+ def success_count
30
+ batch_objects.where(verified: true).count
31
+ end
32
+
29
33
  def time_to_complete
30
34
  unless start.nil?
31
35
  if handled_count > 0
@@ -60,7 +60,7 @@ module Ddr::Batch
60
60
  end
61
61
 
62
62
  def update_batch(batch)
63
- outcome = batch.success.eql?(batch.batch_objects.size) ? Batch::OUTCOME_SUCCESS : Batch::OUTCOME_FAILURE
63
+ outcome = batch.success_count.eql?(batch.batch_objects.size) ? Batch::OUTCOME_SUCCESS : Batch::OUTCOME_FAILURE
64
64
  logfile = File.new(Ddr::Batch::Log.file_path(batch.id))
65
65
  batch.update!(stop: DateTime.now,
66
66
  status: Batch::STATUS_FINISHED,
@@ -13,7 +13,6 @@ module Ddr::Batch
13
13
 
14
14
  def batch_object_handled(batch_object, batch)
15
15
  log_batch_object_messages(batch_object, batch.id)
16
- update_batch(batch_object, batch)
17
16
  unless batch.unhandled_objects?
18
17
  ActiveSupport::Notifications.instrument('finished.batch.batch.ddr', batch_id: batch.id)
19
18
  end
@@ -26,10 +25,6 @@ module Ddr::Batch
26
25
  end
27
26
  logger.close
28
27
  end
29
-
30
- def update_batch(batch_object, batch)
31
- batch_object.verified? ? batch.update!(success: batch.success + 1) : batch.update!(failure: batch.failure + 1)
32
- end
33
28
  end
34
29
 
35
30
  end
@@ -22,13 +22,13 @@ td { text-align: right; }
22
22
  Outcome: <%= @batch.outcome %>
23
23
  </p>
24
24
  <p>
25
- Objects in batch: <%= @batch.batch_objects.size %><br />
26
- Successfully processed: <%= @batch.success %><br />
27
- Processing failures: <%= @batch.failure %><br />
28
- Unprocessed: <%= @batch.batch_objects.size - @batch.success - @batch.failure %>
25
+ Objects in batch: <%= @size %><br />
26
+ Successfully processed: <%= @success %><br />
27
+ Processing failures: <%= @handled - @success %><br />
28
+ Unprocessed: <%= @size - @handled %>
29
29
  </p>
30
30
  <p>
31
31
  See attachment for details of batch run.
32
32
  </p>
33
33
  </body>
34
- </html>
34
+ </html>
@@ -12,9 +12,9 @@ Stopped at: <%= @batch.stop %>
12
12
  Status: <%= @batch.status %>
13
13
  Outcome: <%= @batch.outcome %>
14
14
 
15
- Objects in batch: <%= @batch.batch_objects.size %>
16
- Successfully processed: <%= @batch.success %>
17
- Processing failures: <%= @batch.failure %>
18
- Unprocessed: <%= @batch.batch_objects.size - @batch.success - @batch.failure %>
15
+ Objects in batch: <%= @size %>
16
+ Successfully processed: <%= @success %>
17
+ Processing failures: <%= @handled - @success %>
18
+ Unprocessed: <%= @size - @handled %>
19
19
 
20
- See attachment for details of batch run.
20
+ See attachment for details of batch run.
@@ -0,0 +1,13 @@
1
+ class RemoveColumnsFromBatch < ActiveRecord::Migration
2
+ def up
3
+ remove_column :batches, :failure
4
+ remove_column :batches, :success
5
+ end
6
+
7
+ def down
8
+ change_table :batches do |t|
9
+ t.integer "failure", default: 0
10
+ t.integer "success", default: 0
11
+ end
12
+ end
13
+ end
@@ -1,5 +1,5 @@
1
1
  module Ddr
2
2
  module Batch
3
- VERSION = "1.2.0.rc1"
3
+ VERSION = "1.2.0.rc2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ddr-batch
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0.rc1
4
+ version: 1.2.0.rc2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jim Coble
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-12-19 00:00:00.000000000 Z
12
+ date: 2016-12-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -210,6 +210,7 @@ files:
210
210
  - db/migrate/20160816164010_create_batch_object_roles.rb
211
211
  - db/migrate/20161115191636_add_columns_to_batch_object.rb
212
212
  - db/migrate/20161116142512_create_batch_object_messages.rb
213
+ - db/migrate/20161222192611_remove_columns_from_batch.rb
213
214
  - lib/ddr-batch.rb
214
215
  - lib/ddr/batch.rb
215
216
  - lib/ddr/batch/batch_user.rb