bpm_manager 0.9.16 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bpm_manager/red_hat.rb +10 -9
- data/lib/bpm_manager/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3bd20d32447d3f004ed4b68d85be370981b2b43c
|
4
|
+
data.tar.gz: dcab2e8e810a2c815bd75a001ebc76dc1389890c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ee1f61de34d63d0b4369f0d8ddd3cc9a020b63b071b946e84b86642755fe31ad05d89316aead3a9bbba18fcddf087e69d425ed6a5fc23a20c89e1ad473eb3a2
|
7
|
+
data.tar.gz: 90ef1c0427b3fc1d7d79c72106f949f212c45943791de20142963a61b523307998b2668cb0a6107a358f10e63af0fa8daf138a4c49911c52c486ce520957dbb0
|
data/lib/bpm_manager/red_hat.rb
CHANGED
@@ -157,20 +157,21 @@ module BpmManager
|
|
157
157
|
private_class_method :calculate_sla
|
158
158
|
|
159
159
|
def self.calculate_sla_percent(start, sla_hours = 0.0, offset = 20)
|
160
|
-
sla_hours = sla_hours
|
160
|
+
sla_hours = sla_hours * 3600.0 # converts to seconds
|
161
|
+
offset_pcg = (100.0 - offset) / 100.0
|
161
162
|
percent = OpenStruct.new
|
162
163
|
|
163
|
-
unless sla_hours < 1
|
164
|
-
if Time.now.utc > (start.utc + sla_hours) #
|
165
|
-
total = (start.utc + sla_hours).to_f
|
166
|
-
percent.green = ((sla_hours * (100 - offset) / 100) / total * 100).round(2)
|
167
|
-
percent.yellow = (Time.now.utc > start.utc + (sla_hours * (100 - offset) / 100)) ? ((sla_hours / total * 100) - percent.green).round(2) : 0.0
|
168
|
-
percent.red = 0.0
|
169
|
-
else # Ruby Red
|
164
|
+
unless sla_hours < 1 # it's zero or negative
|
165
|
+
if Time.now.utc > (start.utc + sla_hours) # Ruby Red
|
170
166
|
total = (Time.now.utc - start.utc).to_f
|
171
|
-
percent.green = (
|
167
|
+
percent.green = (sla_hours * offset_pcg / total * 100).round(2)
|
172
168
|
percent.yellow = ((sla_hours / total * 100) - percent.green).round(2)
|
173
169
|
percent.red = (100 - percent.yellow - percent.green).round(2)
|
170
|
+
else # Still Green
|
171
|
+
total = sla_hours
|
172
|
+
percent.green = Time.now.utc <= start.utc + total * offset_pcg ? ((100-offset) - (((start.utc + total * offset_pcg) - Time.now.utc) * 100).to_f / (total * offset_pcg).to_f).round(2) : 100 - offset
|
173
|
+
percent.yellow = Time.now.utc <= start.utc + total * offset_pcg ? 0.0 : (offset - (start.utc + total - Time.now.utc).to_f * 100 / (total * offset_pcg).to_f).round(2)
|
174
|
+
percent.red = 0.0
|
174
175
|
end
|
175
176
|
else
|
176
177
|
percent.green = 100.0
|
data/lib/bpm_manager/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bpm_manager
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ariel Presa
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-02
|
11
|
+
date: 2016-03-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|