active_job_status 1.2.0 → 1.2.1

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: 5431b8cc6fed8a99592123c01fc9357cf4a46192
4
- data.tar.gz: bd92db0a996e02e8ac1cabdb1af6d9e8092de953
3
+ metadata.gz: 84db9cd64e705477457dc8a26e5eb933feafc0db
4
+ data.tar.gz: f9d888e8d8bdfff969f85fa00a8c461053ee9fdd
5
5
  SHA512:
6
- metadata.gz: 1e081751d977356a0315b686321c526e02ddc881b5e8624c59434a187bb40625aa452ca31188a6d7905550eadb93dd0c2f8c03d02390c3c3913f61e4da730480
7
- data.tar.gz: 88df222fab4619634fe7073fc024b691c649bbd22df91c5261a9f304e3eaff9117f35ab2a05ff903e6c303a002650f5baa86884c8fd74758f51868a85daefb0f
6
+ metadata.gz: 071d38cda3a6c6d94ba193f2e0e838a13b989633b229fd2c0fecb11b4b04e8c260a963ee88ca747096a1f3aea286b4831b29f25886f3a2ee20b68a6efd122aa8
7
+ data.tar.gz: 5bc2c62021717551fa696a5bf5db14a6e1826b2617cca1d262674dddc46402b403fa9770fcde807e68e251bb783d156e5a368cbfade6f18efcfd8d667be0b64b
@@ -1,4 +1,7 @@
1
1
  # ActiveJobStatus
2
+ ## 1.2.1
3
+ - Fixes bug with JobBatch#completed? (https://github.com/cdale77/active_job_status/pull/19)
4
+
2
5
  ## 1.2.0
3
6
  - Add support for Rails 5
4
7
  - Adds many small improvements (see https://github.com/cdale77/active_job_status/pull/15)
@@ -8,7 +11,7 @@
8
11
 
9
12
  ## 1.0.0
10
13
  - Move TrackableJob inside ActiveJobStatus namespace. Bump version to 1.0.0, as
11
- this may be a breaking change for some users.
14
+ this may be a breaking change for some users.
12
15
 
13
16
  ## 0.0.5
14
17
  - Use ActiveSupport::Cache instead of Redis, reducing dependencies. Changes
@@ -34,9 +34,9 @@ module ActiveJobStatus
34
34
  end
35
35
 
36
36
  def completed?
37
- @job_ids.map do |job_id|
37
+ !@job_ids.map do |job_id|
38
38
  job_status = ActiveJobStatus.get_status(job_id)
39
- job_status == nil || job_status == :completed
39
+ job_status != nil && job_status != :completed
40
40
  end.any?
41
41
  end
42
42
 
@@ -1,3 +1,3 @@
1
1
  module ActiveJobStatus
2
- VERSION = "1.2.0"
2
+ VERSION = "1.2.1"
3
3
  end
@@ -57,6 +57,11 @@ describe ActiveJobStatus::JobBatch do
57
57
  update_store(id_array: total_jobs, job_status: :working)
58
58
  expect(batch.completed?).to be_falsey
59
59
  end
60
+ it "should be false with mixed jobs status of working and completed" do
61
+ update_store_mixed_status(id_array: total_jobs,
62
+ job_status_array: [:working, :completed])
63
+ expect(batch.completed?).to be_falsey
64
+ end
60
65
  it "should be true when jobs are all completed" do
61
66
  update_store(id_array: total_jobs, job_status: :completed)
62
67
  expect(batch.completed?).to be_truthy
@@ -109,6 +114,13 @@ describe ActiveJobStatus::JobBatch do
109
114
  end
110
115
  end
111
116
 
117
+ def update_store_mixed_status(id_array: [], job_status_array: [:queued])
118
+ n_element = job_status_array.count
119
+ id_array.each_with_index do |id, index|
120
+ store.write(id, job_status_array[index % n_element].to_s)
121
+ end
122
+ end
123
+
112
124
  def clear_store(id_array: [])
113
125
  id_array.each do |id|
114
126
  store.delete(id)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_job_status
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brad Johnson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-10-04 00:00:00.000000000 Z
11
+ date: 2016-11-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler