bpm_manager 0.9.12 → 0.9.13
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 +11 -17
- 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: 3d32365d205fa3caf9f8dde5176f45894ada9641
|
4
|
+
data.tar.gz: 7a9c10fc5c8a62c371efcd6a648d06a823d14532
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e08d29baf879a6013dfb077769c8df452d3193b432476b55b7e7af32d39e33eed81c999c6388f23d41f5f3a4e2a634c52169d6ee9ede1c0f9472e81dffb2e4dd
|
7
|
+
data.tar.gz: 19773372ddb9796d42219bebdfa9ed6b5e2278df931c33036bf70ff7e527b32b19108a5902440fcc85563dd9368b1e065d287471a6628e15e77109a5ba91cf06
|
data/lib/bpm_manager/red_hat.rb
CHANGED
@@ -148,30 +148,24 @@ module BpmManager
|
|
148
148
|
# Private class methods
|
149
149
|
def self.calculate_sla(start, sla_hours = 0.0, offset = 20)
|
150
150
|
# Converts to seconds and calculates warning offset
|
151
|
-
|
151
|
+
sla_hours_ok = sla_hours.to_f * 3600
|
152
|
+
sla_hours_warn = sla_hours_ok * ((100 - offset) / 100)
|
152
153
|
|
153
|
-
|
154
|
-
|
155
|
-
0
|
156
|
-
else
|
157
|
-
start.utc + sla_hours >= Time.now.utc ? 1 : 2
|
158
|
-
end
|
159
|
-
else
|
160
|
-
0
|
161
|
-
end
|
154
|
+
# Returns the status
|
155
|
+
sla_hours > 0 ? (start.utc + sla_hours_warn >= Time.now.utc ? (start.utc + sla_hours_ok >= Time.now.utc ? 0 : 1) : 2) : 0
|
162
156
|
end
|
163
157
|
private_class_method :calculate_sla
|
164
158
|
|
165
|
-
def self.calculate_sla_percent(start, sla_hours=0, offset=20)
|
166
|
-
sla_hours = sla_hours.to_f * 3600 # converts to seconds
|
167
|
-
percent = OpenStruct.new
|
159
|
+
def self.calculate_sla_percent(start, sla_hours = 0.0, offset = 20)
|
168
160
|
total = (Time.now.utc - start.utc).to_f
|
161
|
+
sla_hours = sla_hours.to_f * 3600 # converts to seconds
|
162
|
+
percentage = OpenStruct.new
|
169
163
|
|
170
|
-
|
171
|
-
|
172
|
-
|
164
|
+
percentage.green = sla_hours > 0 ? (start.utc + (sla_hours * (100 - offset) / 100)).to_f * 100 / total : 100
|
165
|
+
percentage.yellow = sla_hours > 0 ? ((start.utc + sla_hours).to_f * 100 / total) - percent.green : 0
|
166
|
+
percentage.red = sla_hours > 0 ? 100 - percent.yellow - percent.green : 0
|
173
167
|
|
174
|
-
return
|
168
|
+
return percentage
|
175
169
|
end
|
176
170
|
private_class_method :calculate_sla_percent
|
177
171
|
|
data/lib/bpm_manager/version.rb
CHANGED