bpm_manager 0.9.15 → 0.9.16
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 +18 -5
- data/lib/bpm_manager/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4e3b5c1eadedf5de66e46f004736de6881b0fe8d
|
4
|
+
data.tar.gz: b0d13b931a1960e2002fe7289a04ede0e2b80f1e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b21c4533a24490bdb5fcd99b00037aa649f35dfc9bea8c450e0b44936690e0e5fee6d3c8542b32e32e46bf1653f2b3e041a6e3a138bc842340fc755a8419b921
|
7
|
+
data.tar.gz: 3d6815e7f7655788a1440ed8cdb267833317e266983d6fe352ae5b48e5e114202a8416dd8ba6a498317134e7b8672be7686436d84dad573c970d34e0f69711f5
|
data/lib/bpm_manager/red_hat.rb
CHANGED
@@ -157,13 +157,26 @@ 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
|
-
total = Time.now.utc > start.utc ? (Time.now.utc - start.utc).to_f : (start.utc - Time.now.utc).to_f
|
161
160
|
sla_hours = sla_hours.to_f * 3600 # converts to seconds
|
162
|
-
|
163
161
|
percent = OpenStruct.new
|
164
|
-
|
165
|
-
|
166
|
-
|
162
|
+
|
163
|
+
unless sla_hours < 1
|
164
|
+
if Time.now.utc > (start.utc + sla_hours) # Still Green
|
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
|
170
|
+
total = (Time.now.utc - start.utc).to_f
|
171
|
+
percent.green = ((sla_hours * (100 - offset) / 100) / total * 100).round(2)
|
172
|
+
percent.yellow = ((sla_hours / total * 100) - percent.green).round(2)
|
173
|
+
percent.red = (100 - percent.yellow - percent.green).round(2)
|
174
|
+
end
|
175
|
+
else
|
176
|
+
percent.green = 100.0
|
177
|
+
percent.yellow = 0.0
|
178
|
+
percent.red = 0.0
|
179
|
+
end
|
167
180
|
|
168
181
|
return percent
|
169
182
|
end
|
data/lib/bpm_manager/version.rb
CHANGED